开发者

show button after some time delay in actionscript3

I've been working with actionscript 3.0 and have an array that gives me some text and a button on each new p开发者_如何学Cage (clicking the button gets me to the next text-page and button). I'd now like my button to not appear on each page immediately, but time delayed, maybe wait 10 seconds or so before it appears. Does anyone have an idea how I could do that?


When you enter (creationComplete or similar) your "page" set the button's alpha to 0 then kick off a flash.utils.Timer with a callback function that sets the buttons alpha to 1.


Using something like Tweenlite might be the way to go, its really easy to use and should give you the effect you are looking for.


So I talked to someone, and you can apparently also write it in actionscript, this way:

    /* Define a Timer and how long it runs, here 5 sec */

stop();

var timer1:Timer = new Timer(5000);

timer1.addEventListener(TimerEvent.TIMER, hideButtonTimer1);

    /* Define the button going to the next frame on mouseclick */

btn_name.addEventListener(MouseEvent.CLICK, next);

function next(event:MouseEvent) {
    play();
}

    /* Hide the button on start of the timer */

btn_name.visible = false;

timer1.start();

    /* turn the button visible when the timer stops */

function hideButtonTimer1(e:Event) 

{timer1.stop();

btn_name.visible = !btn_name.visible;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜