Actionscript 查看图片计时器动作脚本3,0(FLASH BUILDER)

Actionscript 查看图片计时器动作脚本3,0(FLASH BUILDER),actionscript,time,timer,Actionscript,Time,Timer,我想在几秒钟后查看每张图片。 功能显示正在程序中滚动。 请添加必要的 代码。 我无法理解actionscript的计时器功能 function display(q:int):void{ if(q ==0) { ue.visible= true; migi.visible= false; shita.visible= false;

我想在几秒钟后查看每张图片。 功能显示正在程序中滚动。 请添加必要的 代码。 我无法理解actionscript的计时器功能

            function display(q:int):void{
            if(q ==0)
            {
                ue.visible= true;
                migi.visible= false;
                shita.visible= false;
                hidari.visible= false;
            }
            else if(q ==1)
            {

                ue.visible= false;
                migi.visible= true;
                shita.visible= false;
                hidari.visible= false;
            }
            else if(q ==2)
            {
                ue.visible= false;
                migi.visible= false;
                shita.visible= true;
                hidari.visible= false;
            }
            else
            {
                ue.visible= false;
                migi.visible= false;
                shita.visible= false;
                hidari.visible= true;
            }
                }

试试下面的方法。我试图加入一些评论来解释我在做什么:

import flash.utils.Timer;
import flash.events.TimerEvent;

// Put all the clips in an array to manage
var pictures:Array = [this.ue, this.migi, this.shita, this.hidari];

// Store the current image index
var currentPicture = 0;

// Delay in milliseconds to wait between each image
var delay = 1000; 

// We can reuse the same timer instance throughout cycle
var timer:Timer = new Timer(this.delay, 1);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler);

// Hide all the pictures in the array
function hidePictures():void 
{
    for (var i:int = 0; i < this.pictures.length; i ++)
    {
        MovieClip(this.pictures[i]).visible = false;
    }
}

function showPicture():void 
{
    // Show the current image
    MovieClip(this.pictures[this.currentPicture]).visible = true;

    // Now start the pause on the current image
    timer.start();
}

function timerCompleteHandler(event:TimerEvent):void
{
    // Hide the old image
    MovieClip(this.pictures[this.currentPicture]).visible = false;

    // Increment current picture index unless we're at the end in which case loop
    this.currentPicture = (this.currentPicture < this.pictures.length - 1)
        ? this.currentPicture + 1 : 0;

    // Show the next picture
    showPicture();
}   

hidePictures();
showPicture();
导入flash.utils.Timer;
导入flash.events.TimerEvent;
//将所有剪辑放在一个阵列中进行管理
var pictures:Array=[this.ue,this.migi,this.shita,this.hidari];
//存储当前图像索引
var currentPicture=0;
//每个映像之间等待的延迟(毫秒)
无功延迟=1000;
//我们可以在整个周期中重用相同的计时器实例
var定时器:定时器=新定时器(this.delay,1);
timer.addEventListener(TimerEvent.timer\u COMPLETE,timerCompleteHandler);
//隐藏阵列中的所有图片
函数hidePictures():void
{
for(var i:int=0;i