flex4 image控件,怎么能让图片重复显示?
如题!!就是比如我的image控件很大 但是图片很小,把图片放进去图片就自动被放大了,怎样才能让图片不放大,而是重复填充呢?
[解决办法]
没这么智能,如果你需要重复填充,需要自己去画出另外的图片,给你一个例子,一看就知道了:
<?xml version="1.0" ?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" creationComplete="onInit()"> <mx:Script> <![CDATA[ private function onInit():void { var bitmapdata:BitmapData = new BitmapData(img1.width, img1.height); bitmapdata.draw(img1); canvas.removeChild(img1); canvas.graphics.beginBitmapFill(bitmapdata); canvas.graphics.drawRect(0, 0, canvas.width, canvas.height); canvas.graphics.endFill(); } ]]> </mx:Script> <mx:Canvas id="canvas" width="500" height="500" borderStyle="solid"> <mx:Image id="img1" source="@Embed(source='BuzzyBee.png')"/> </mx:Canvas></mx:Application>
[解决办法]
bitmapimage mode = repeat