Answered
Unexplained Looping with tween
First let me say I am new to flash but I have done my
homework, doing the tutorials and having purchased and read, (a
good deal of),"Foundation ActionScript for Flash 8." OK so I think
I've overlooked something basic in Flash and now that I'm knee deep
in actionScript it is showing up.
I want to do a simple effect of cross fading text over text and finally freezing on the final text.
I have each piece of text on a different layer in a folder called "content" the top most folder is called actions where (duh), I have my actionScript. I have each text defined as a movie clip with _mc at the end of the variable name.
In the beginning frame (frame 3 after I used the first two for loading status) I have a key frame for all pieces of text graphic etc.
I have:
// set flash up to locate tweening components
import mx.transitions.Tween;
import mx.transitions.easing.*;
then I have a lot of initialization etc.
//initialize all text & graphics to not appear
txt01_mc._alpha = 0;
txt02_mc._alpha = 0; .... all the other _mc set to 0
then I have some variables etc.
// declaire & initialize variables //
var fadeIntxtSpeed:Number = 2.5;
var fadeOutTxtSpeed:Number = 1.0;
//debugg trace variables (nothing really important here)
Then I have the tween code.
var tweenTxt01:Tween = new Tween(txt01_mc, "_alpha", Strong.easeInOut, 0, 100, fadeIntxtSpeed, true);
tweenTxt01.onMotionFinished = function():Void {
var tweenTxtDone_Bool:Boolean = true;
trace("Line 42 - the value of tweenTxtDone_Bool is "+tweenTxtDone_Bool);
tweenTxt01.continueTo(0, fadeOutTxtSpeed);
tweenTxt01.Tween.stop();
//kick off txt02 tween sequence//
if (tweenTxtDone_Bool) {
var tweenTxt02:Tween = new Tween(txt02_mc, "_alpha", Strong.easeInOut, 0, 100, fadeIntxtSpeed, true);
tweenTxt02.onMotionFinished = function():Void {
tweenTxt02.continueTo(0, fadeOutTxtSpeed);
tweenTxt02.Tween.stop();
stop();
};
}
};
stop();
Originally I did not include the if condition expecting that if I nested the tweenTxt02:Tween within the first tween (following the onMotionFinishd event handler) everything would work. It did not and even with the if statement the actionScript loops on the first tween. (I keep getting "Line 42 - the value of tweenTxtDone_Bool is true") in my output window when I run it.
Visually the first tween appears to work perfectly. I get a nice fade-up and then a fade back and the second movie clip(txt02_mc) pops in and out at different alpha values, none of which make sense to me.
So any help would be appreciated. I hope I've included enough information,
Oh I'm using Flash Professional 8 on a MAC (intel - under rosetta) and my publish settings are set to Flash Player 6 with ActionScript 2.0
Thanks!
Rich Text Text
I want to do a simple effect of cross fading text over text and finally freezing on the final text.
I have each piece of text on a different layer in a folder called "content" the top most folder is called actions where (duh), I have my actionScript. I have each text defined as a movie clip with _mc at the end of the variable name.
In the beginning frame (frame 3 after I used the first two for loading status) I have a key frame for all pieces of text graphic etc.
I have:
// set flash up to locate tweening components
import mx.transitions.Tween;
import mx.transitions.easing.*;
then I have a lot of initialization etc.
//initialize all text & graphics to not appear
txt01_mc._alpha = 0;
txt02_mc._alpha = 0; .... all the other _mc set to 0
then I have some variables etc.
// declaire & initialize variables //
var fadeIntxtSpeed:Number = 2.5;
var fadeOutTxtSpeed:Number = 1.0;
//debugg trace variables (nothing really important here)
Then I have the tween code.
var tweenTxt01:Tween = new Tween(txt01_mc, "_alpha", Strong.easeInOut, 0, 100, fadeIntxtSpeed, true);
tweenTxt01.onMotionFinished = function():Void {
var tweenTxtDone_Bool:Boolean = true;
trace("Line 42 - the value of tweenTxtDone_Bool is "+tweenTxtDone_Bool);
tweenTxt01.continueTo(0, fadeOutTxtSpeed);
tweenTxt01.Tween.stop();
//kick off txt02 tween sequence//
if (tweenTxtDone_Bool) {
var tweenTxt02:Tween = new Tween(txt02_mc, "_alpha", Strong.easeInOut, 0, 100, fadeIntxtSpeed, true);
tweenTxt02.onMotionFinished = function():Void {
tweenTxt02.continueTo(0, fadeOutTxtSpeed);
tweenTxt02.Tween.stop();
stop();
};
}
};
stop();
Originally I did not include the if condition expecting that if I nested the tweenTxt02:Tween within the first tween (following the onMotionFinishd event handler) everything would work. It did not and even with the if statement the actionScript loops on the first tween. (I keep getting "Line 42 - the value of tweenTxtDone_Bool is true") in my output window when I run it.
Visually the first tween appears to work perfectly. I get a nice fade-up and then a fade back and the second movie clip(txt02_mc) pops in and out at different alpha values, none of which make sense to me.
So any help would be appreciated. I hope I've included enough information,
Oh I'm using Flash Professional 8 on a MAC (intel - under rosetta) and my publish settings are set to Flash Player 6 with ActionScript 2.0
Thanks!
Rich Text Text