flex 连续播放图片

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init();">         <mx:Script>         <![CDATA[             private var loader:Loader = new Loader();              private var request:URLRequest;                         private var sizeflag:Boolean = true;    //图片大小标志,true为小图             private var i:int = 0;                  //计数器跳动次数记录                         private var timer:Timer = new Timer(25);                         public function init():void             //初始化             {                 request = new URLRequest("监控背景.jpg");    //放入图片                 loader.load(request);                 loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);                 timer.addEventListener(TimerEvent.TIMER,reloadImg);   //开始计数                 timer.start();             }                         public function onComplete(e:Event):void             {                 var bitmap:Bitmap = Bitmap(loader.content);                 img.source = bitmap;             }                         public function reloadImg(e:TimerEvent):void              //按照计数奇偶切换图片             {                 //img.removeChildAt(0);                                       if (i%2 == 1)                 {                     request = new URLRequest("监控背景.jpg");                     loader.load(request);                 }                 else                 {                     request = new URLRequest("监控背景1.JPG");                     loader.load(request);                 }                    i++;             }             public function changeImgSize():void                   //改变图片大小             {                 if (sizeflag){                     img.width = 640;                     img.height = 480;                                         sizeflag = false;                 }                 else {                                         img.width = 320;                     img.height = 240;                     sizeflag = true;                 }             }         ]]>     </mx:Script>     <mx:Image id="img" x="10" y="10" width="320" height="240"/>     <mx:Button id="myBtn" x="10" y="498" label="Button" click="changeImgSize();"/>     </mx:Application>

相关文章

一:display:flex布局display:flex是一种布局方式。它即可以...
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何...
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些...
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周...
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后...
我在网页上运行了一个Flex应用程序,我想使用Command←组合键...