views:

25

answers:

3

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? Help would be very appreciated!

A: 

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.

Ian
+1  A: 

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.

sdolan
You should also set the button's callback in the timer callback. Otherwise you might have users clicking on the button before you want them to.
tedw4rd
@tedw4rd: Good call... never can trust those users. :)
sdolan
A: 

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;

}

Cee