Reputation: 1
I've been working with actionscript 3.0 and have an array that gives me some text and a button on each new page (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?
Upvotes: 0
Views: 1965
Reputation: 1
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;
}
Upvotes: 0
Reputation: 32532
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.
Upvotes: 1