Mixing ActionScript Loops and Tweens
Hi,
The basic premise of the piece I'm working on.
We're looking at a phone, a message types itself in on the phone. Once the message has finished typing a piece of text fades in next to the phone. That's all.
It should be very simple but several things seem to go wrong. This is where I got my typing script from: http://www.youtube.com/watch?v=rjCo0w3u2cg
I tried to turn the text into a movie clip and have it tween within the movie clip. That did nothing, the text just appeared static from frame 1 (I assume as there was nothing to activate it? I don't know, I'm not very good at flash)
I tried to just tween the text on the timeline but that just looped the entire clip everytime the tween ended the clip looped and the text wouldn't even type out in full.
Is there a way I can somehow tell the script to work out when everythings finished (as it seems to do already because the clip stops when the message has ended) and then tell it to play the movie clip or from a certain frame onwards?
Here is my code:
Code:
var myString:String ="Hey Blah Blah Blah this is my text for typing";
var myArray:Array = myString.split("");
addEventListener(Event.ENTER_FRAME, framelooper);
function frameLooper (event:Event) :void {
if (myArray.length > 0 {
tf.appendText(myArray.shift());
} else {
removeEventListener(Event.ENTER_FRAME, frameLooper);
}
}
Am I supposed to put something in the 'else' section to point it somewhere? When I try that it seems to automatically jump to whatever frame I point it to before the text is done. As I've said I'd like them one after the other.
Have I explained this well enough? Sorry if I've been unclear.