图片浏览

<?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:mx="library://ns.adobe.com/flex/mx" minWidth="1024" minHeight="768">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>

	<fx:Script>
		<![CDATA[
			private var t:Timer=new Timer(2000);
			private var index:int=1;
			protected function start_clickHandler(event:MouseEvent):void
			{
				t.addEventListener(TimerEvent.TIMER,doTimer);
				t.start();
			}

			private function doTimer(evt:TimerEvent):void{
				index++;
				if(this.index>=7){
					this.index=1;
				}
				this.img.source="../images/"+index+".jpg";
			}
			protected function stop_clickHandler(event:MouseEvent):void
			{
				this.t.stop();
			}


			protected function next_clickHandler(event:MouseEvent):void
			{
				index++;
				if(this.index>=7){
					this.index=1;
				}
				this.img.source="../images/"+index+".jpg";
			}


			protected function prev_clickHandler(event:MouseEvent):void
			{
				index--;
				if(this.index<=0){
					this.index=6;
				}
				this.img.source="../images/"+index+".jpg";
			}

		]]>
	</fx:Script>

	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Panel x="10" y="0" width="783" height="604">
		<s:Group x="23" y="5" width="715" height="389">
			<mx:Image id="img" x="124" y="9" width="416" height="343" source="../images/1.jpg"/>
		</s:Group>
		<s:Group x="23" y="419" width="715" height="72">
			<s:Button x="323" y="24" id="next" label="上一张" click="next_clickHandler(event)"/>
			<s:Button x="427" y="24" label="下一张" id="prev" click="prev_clickHandler(event)"/>
			
			<s:Button x="58" y="24" id="start" label="开始" click="start_clickHandler(event)"/>
			<s:Button x="172" y="24" label="停止" id="stop" click="stop_clickHandler(event)"/>
		</s:Group>
	</s:Panel>
</s:Application>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值