[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

I am trying to get the tweens to execute one after the other.

Posted on 2011-10-13
2
Medium Priority
?
171 Views
Last Modified: 2012-05-12
Hello,

I am trying to get the tweens to execute one after the other. Only the first tween is executing, I can't figure out what I am doing wrong.Any ideas.

1) I have named the instance 'rectangle'
Thanks,

Ben

 
import fl.transitions.easing.*;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;

var twFade : Tween;
var twStretch : Tween;
var twEnlarge : Tween;
	
twFade = new Tween(rectangle,"alpha",Strong.easeOut,1,0,3,true);
twFade.addEventListener(TweenEvent.MOTION_FINISH,mynext1);

function mynext1(e : TweenEvent):void {


	twStretch = new Tween(rectangle,"x",None.easeOut,0,100,3,true);
	twStretch.addEventListener(TweenEvent.MOTION_FINISH,mynext2);
	twFade.removeEventListener(TweenEvent.MOTION_FINISH,mynext1);
}

function mynext2(e : TweenEvent):void{

	twEnlarge = new Tween(rectangle,"height",Strong.easeOut,rectangle.height,rectangle.height+100,3,true);
	twStretch.removeEventListener(TweenEvent.MOTION_FINISH,mynext2);
	
}

Open in new window

0
Comment
Question by:AivsCoder
2 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 36964086
Hey Ben.
Your code works - but you probably can't see it happening because in the first tween you've made your rectangle invisible.
:-)
to prove it just change the first alpha to

twFade = new Tween(rectangle,"alpha",Strong.easeOut,1,0.5,3,true);

instead of

twFade = new Tween(rectangle,"alpha",Strong.easeOut,1,0,3,true);

ie. change alpha from 1 to 0.5 instead of 1 to 0
0
 

Author Closing Comment

by:AivsCoder
ID: 36974955
thanks heaps
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question