Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
VansFannel
Posts: 166
Registered: ‎03-04-2011
My Device: Playbook
Accepted Solution

Fade in, wait a second, and then fade out.

I'm developing an ActionSript 3 app for Playbook.

 

I'm using Tweener class to fade in and fade out a Sprite.

 

I want to do an effect like I say in Subject but I don't know how to wait a second after fade in and before fade out.

 

Any advice?

Please use plain text.
Developer
kdittyr
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: Fade in, wait a second, and then fade out.

[ Edited ]

There are a few things you could do:

 

( I don't suggest this first one as the two tweens may clobber one another )

Tweener.addTween( myMovieClip, { alpha:1, time:0.5 } );
Tweener.addTween( myMovieClip, { alpha:0, time:0.5, delay:1.5 } );

Or you could do the initial fade in, then use an onComplete parameter to initiate another method to fade out the object.

 

Tweener.addTween( myMovieClip, { alpha:1, time:0.5, onComplete:on_complete_method } );

function on_complete_method():void
{
     Tweener.addTween( myMovieClip, { alpha:0, time:0.5, delay:1 } );
}

There is more information here:

http://hosted.zeh.com.br/tweener/docs/en-us/

 

I hope this helped out a little bit :smileyhappy:

 

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Please use plain text.
Developer
berryawesome
Posts: 54
Registered: ‎12-22-2010
My Device: Not Specified

Re: Fade in, wait a second, and then fade out.

without going into much detail, you can set up a timer with a delay of 1000 (ms) and a repeatCount of 1. set up a listener for the timer's TIMER event. When the alpha of the object reaches 1, call the start() method of the timer. On the listener method, call the method performing the fadeout. remeber to reset the timer each time. 

Let me know if you need a code sample.

Please use plain text.
Developer
berryawesome
Posts: 54
Registered: ‎12-22-2010
My Device: Not Specified

Re: Fade in, wait a second, and then fade out.

though my method would work,kdittyr's suggestion is much better. I barely use the Tweener class and completely forgot about the delay parameter. Kudos to you kdittyr

Please use plain text.
Developer
kdittyr
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: Fade in, wait a second, and then fade out.

@berryawesome, I was initially going to use a Timer as well, but then realized that the Tweener class had the delay parameter :smileyhappy:

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Please use plain text.