`
cloud21
  • 浏览: 389873 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

Using non-embedded images in a spark BitmapImage

    博客分类:
  • Flex
阅读更多
TiledImage.mxml
 <?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Script>
        <![CDATA[
            import mx.controls.SWFLoader;
            import flash.display.BitmapData;
            import flash.display.Bitmap;
            
            public function set source(value:Object):void {
                loader.source = value;
            }
            
            private function updateSource():void {
                // use a SWFLoader to download the bitmap data then push that into the BitmapImage
                bitmapImage.source = loader.content;
            }
        ]]>
    </fx:Script>
    <mx:SWFLoader id="loader" complete="updateSource()" width="0" height="0" />
    <s:BitmapImage id="bitmapImage" width="100%" height="100%" fillMode="repeat" />
    
</s:Group>
TiledImageAppcation.mxml
 <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:local="*"
               width="90%" height="90%" viewSourceURL="srcview/index.html">
    
    <s:Group width="{widthSlider.value}" height="100" horizontalCenter="0" y="10">
        <local:TiledImage source="bgDiag.png" width="100%" height="100%" />
        <s:Label text="Tiled Background" fontSize="16" horizontalCenter="0" verticalCenter="0" fontWeight="bold" />
    </s:Group>
    
    <s:HSlider id="widthSlider" value="200" minimum="150" maximum="300" horizontalCenter="0" y="125" />
    
</s:Application>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics