Emadpres
Emadpres

Reputation: 3737

AS2: a message with fadeout with _alpha > 100

I'm using Action Script 2 (in Adobe Flash).

I want to show a text message in screen. I need to show it for 2sec. and then fade it out during 1 sec.

I'm trying to use AS2 instead of traditional timeline. ( because it gives me power of changing anything later with just changing some Numbers and I need it)

So my textbox have two period :

  1. _alpha=100 ( 2sec)

  2. _alpha decreasing in 1sec till _alpha=0

In first I implemented it with two timers.

Then I came up with a tricky idea to use just one timer. That is, I first set _alpha to 300 and then decrease it 10(value) every 100ms.

Question : Will this idea make problem for me later ? ( is setting _alpha 300 reliable ?)

Upvotes: 0

Views: 255

Answers (1)

RafH
RafH

Reputation: 4544

Take a look at Greensock tweening librairies , its really simple to use and very powerfull.

Exemple :

import com.greensock.*
TweenMax.to(yourtextboxinstance, 1, {_alpha:0, delay:2});

It will wait for 2 sec, then tween "yourtextboxinstance" from alpha 100 to 0 in 1 seconde.

That's it.

Upvotes: 1

Related Questions