Flex 幻灯片播放

原文链接:http://www.cnblogs.com/vincentradcliffe/archive/2010/11/08/1871880.html

private function OnTimerTick(event:TimerEvent):void

{

try{       

if(imageBuffer.length<5)

return;

if(picIndex==URLList.length)

{

picIndex=0;

}

if(this.tempInt == 0)

{

//当TempInt为0时

// 更新上层的图片

/* this.imageUp.source = this.URLList.getItemAt(picIndex); */

this.imageUp.source = imageBuffer.getItemAt(0);

imageBuffer.removeItemAt(0);

kuvaTitleWindow.title =this.fileList.getItemAt(picIndex).toString();

picIndex++;

}

else

{

//当用一个Image时,更新图片的过程中, 会出现闪烁

//两个Image,其中一个用来更新显示,另一个用来缓存上一次加载的图片

this.imageDown.source = this.imageUp.source;

}

//计算下次时间控件循环时,tempInt的值, tempInt值为 0 或 1

this.tempInt = (this.tempInt + 1) % 2;

}

catch(error:Error)

{

}

}

2.动画窗口装载:

private function pleyBtn_clickHandel():void

{

if(URLList==null)

return;

if (URLList.length==0){

Alert.show("图像列表为空,无法生成动画,请改变日期,选择数据!");

return;

}

try{

imageBuffer=new ArrayCollection();

BufferTimer.start();

//临时读取一个影像,获取其大小,用于调整填出窗体大小

var loader:Loader=new Loader();

var url:String=URLList.getItemAt(0).toString();

var urlRequest:URLRequest=new URLRequest(url);

loader.load(urlRequest);

loader.contentLoaderInfo.addEventListener(Event.COMPLETE,getSize);

//创建相应的titlewindow

kuvaTitleWindow=new TitleWindow();

imageUp=new Image();

imageDown=new Image();

kuvaTitleWindow.width=1024;

kuvaTitleWindow.height=700;

kuvaTitleWindow.layout="absolute";//使用绝对坐标保证两个图片控件前后重叠

kuvaTitleWindow.showCloseButton=true;

kuvaTitleWindow.addEventListener(CloseEvent.CLOSE,exitTitleWindow);

imageUp.maintainAspectRatio = true;

imageUp.addEventListener(HTTPStatusEvent.HTTP_STATUS,img_httpStatus);//当图片URL出错时,响应

imageDown.maintainAspectRatio = true;

imageDown.addEventListener(HTTPStatusEvent.HTTP_STATUS,img_httpStatus);//当图片URL出错时,响应

//注意装载顺序

kuvaTitleWindow.addChild(imageDown);

kuvaTitleWindow.addChild(imageUp);

        kuvaTitleWindow.setStyle("removedEffect",image_removedEffect);

kuvaTitleWindow.setStyle("addedEffect",image_addEffect);

PopUpManager.addPopUp(kuvaTitleWindow, this.parent.parent.parent.parent, true);//这里处理的不好,有待改进

PopUpManager.centerPopUp(kuvaTitleWindow);

imageUp.source="../src/assets/images/weather/Loading.png";

}

catch(error:Error)

{

}

}

转载于:https://www.cnblogs.com/vincentradcliffe/archive/2010/11/08/1871880.html

相关文章

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