Skip to main content
November 28, 2010
Answered

"TweenEvent.MOTION_START" Problem.!

  • November 28, 2010
  • 2 replies
  • 712 views

Hello ..

I am not familiar with AS3 (or any AS version). I just started reading about it fews days ago, & I like the idea that I can use it to minimize the number of frames of the swf file.

Anyway, I have some simple script that has 2 "movie clips". What I want to do is to start moving the second movie clip at the same time when the 1st starts moving. (both start moving at the same time)

I tried the following script but it never works:

import fl.transitions.Tween;

import fl.transitions.easing.*;

import fl.transitions.TweenEvent;

var myTween = new Tween(facey1, "x", Strong.easeInOut, 0,300, 3, true);

myTween.addEventListener(TweenEvent.MOTION_START, onAction);

myTween.start();

function onAction(e:TweenEvent):void {

var myTween2 = new Tween(my_mc, "x", Strong.easeInOut, 0,300, 3, true);

}

I tried to move the second movie clip just after the 1st finishes moving. and guess what .. it works.

import fl.transitions.Tween;

import fl.transitions.easing.*;

import fl.transitions.TweenEvent;

var myTween = new Tween(facey1, "x", Strong.easeInOut, 0,300, 3, true);

myTween.addEventListener(TweenEvent.MOTION_FINISH, onAction);

function onAction(e:TweenEvent):void {

var myTween2 = new Tween(my_mc, "x", Strong.easeInOut, 0,300, 3, true);

}

I'm very confused. Please give me a clue on how can I make the first script works.

This topic has been closed for replies.
Correct answer kglad

ok:

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

var myTween = new Tween(facey1, "x", Strong.easeInOut, 0,300, 3, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, onAction);
myTween.start();
var myTween2:Tween;

function onAction(e:TweenEvent):void {
myTween2 = new Tween(my_mc, "x", Strong.easeInOut, 0,300, 3, true);
}

2 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 29, 2010

ok:

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

var myTween = new Tween(facey1, "x", Strong.easeInOut, 0,300, 3, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, onAction);
myTween.start();
var myTween2:Tween;

function onAction(e:TweenEvent):void {
myTween2 = new Tween(my_mc, "x", Strong.easeInOut, 0,300, 3, true);
}
kglad
Community Expert
Community Expert
November 28, 2010

try:


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

var myTween = new Tween(facey1, "x", Strong.easeInOut, 0,300, 3, true);
var myTween2 = new Tween(my_mc, "x", Strong.easeInOut, 0,300, 3, true);

November 28, 2010

Thank you kglad .. but moving them together is not what I want .. my point is to make that happen using TweenEvent.MOTION_START

I would appreciate it if you can give me some link of an example using TweenEvent.MOTION_START