<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="init();">
<mx:Script>
<![CDATA[
private var timer:Timer;
private function init():void {
timer = new Timer(1000); /* 1000ms == 1second */
timer.addEventListener(TimerEvent.TIMER, onTimer);
}
private function onTimer(evt:TimerEvent):void {
var idx:uint = viewStack.selectedIndex;
var max:uint = viewStack.numChildren;
var newIdx:uint = ++idx % max;
viewStack.selectedIndex = newIdx;
}
private function startTimer():void {
if (!timer.running) {
timer.start();
}
}
private function stopTimer():void {
if (timer.running) {
timer.stop();
}
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="Start timer" click="startTimer();" />
<mx:Button label="Stop timer" click="stopTimer();" />
<mx:Spacer width="100%" />
<mx:Label text="selectedIndex:" />
<mx:HSlider id="slider"
minimum="0"
maximum="3"
liveDragging="true"
snapInterval="1"
tickInterval="1"
change="viewStack.selectedIndex = event.value;" />
</mx:ApplicationControlBar>
<mx:ViewStack id="viewStack" width="100%" height="100%">
<mx:VBox backgroundColor="haloBlue"
width="100%"
height="100%">
<mx:Label text="VBox 1" />
</mx:VBox>
<mx:VBox backgroundColor="haloGreen"
width="100%"
height="100%">
<mx:Label text="VBox 2" />
</mx:VBox>
<mx:VBox backgroundColor="haloOrange"
width="100%"
height="100%">
<mx:Label text="VBox 3" />
</mx:VBox>
<mx:VBox backgroundColor="haloSilver"
width="100%"
height="100%">
<mx:Label text="VBox 4" />
</mx:VBox>
</mx:ViewStack>
</mx:Application>
Flex中如何利用timer控制改变ViewStack当前选中Index的例子
转载上一篇:XML Publisher 模板
下一篇:软件工厂简介
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Idea中双击操作总是选中当前行问题
Idea中双击选中整行问题解决
Idea 选中整行 双击 -
flex中ViewStack利用按钮做导航
flex中ViewStack利用按钮做导航
flex ViewStack利用按钮 做导航 -
Flex中如何通过lineStroke样式改变LineChart图表线条颜色的例子
下面是完整代码(或点击这里察看):Download: main.mxmlxml version="1.0"?> mx:Application x
flex application download date import -
Flex中如何利用PopUpManager类创建一个弹出Image控件的例子
接下来的
image flex function import application -
Flex中如何利用folderOpenIcon, folderClosedIcon和defaultLeafIcon样式改变默认文件夹和子项目图标的例子
接下来的例子演示了Flex中如何利用folderOpenIcon, folderClosedIcon和defaultLeafIcon样式,改变默认文件夹和子项目图标。让我们先来看一下Demo(可以右键View Source或点击这里察看源代码): 下面是完整代码(或点击这里察看):Download: main.mxml<?xml version="1.0" encoding="utf-8"?
flex application class download encoding -
Flex中如何通过selectionColor和selectionDisabledColor样式设置DataGrid的行选中与无效时颜色的例子
接下来的例子演示了Flex中如何通过selectionColor和selectionDisabledColor样式,设置DataGrid的行选中与无效时颜色。让我们先来看一下Demo(可以右键View Source或点击这里察看源代码): 下面是完整代码(或点击这里察看):Download: main.mxml<?xml version="1.0" encoding="utf-8"?>
datagrid flex object application c