Flex4实现背景图片scale9 九宫格缩放
在使用Flex3时,我们可以通过设置容器的backgroundImage和backgroundSize这两个样式来实现9宫格。如下:
而在Flex4里面,我们可以使用BitmapImage来实现九宫格功能。代码如下:
1 2 3 4 5 | .bg{ backgroundImage:Embed(source= "assets/bg.png" , scaleGridLeft= "24" , scaleGridTop= "31" , scaleGridRight= "50" , scaleGridBottom= "39" ); backgroundSize: "100%" ; } |
而在Flex4里面,我们可以使用BitmapImage来实现九宫格功能。代码如下:
1 2 3 4 | < s:Group width = "100%" height = "100%" > < s:BitmapImage width = "100%" height = "100%" source="@Embed('assets/module_bg.png', scaleGridLeft = '30' , scaleGridRight = '850' , scaleGridTop = '75' , scaleGridBottom = '715' )"/> </ s:Group > |