Jump to content

adding eventlistener to TweenMax.fromTo [SOLVED]

- - - - -

2 replies to this topic
adding eventlistener to TweenMax.fromTo [SOLVED]
i had to make a EventListener for TweenMax.fromTo but i am getting error

var myTween:TweenMax  = new TweenMax.fromTo(my_mc, 1, {x:0, y:0}, {x:300, y:200,ease:Expo.easeOut});

myTween.addEventListener(Event.COMPLETE,playIntro);

function playIntro (e:TweenEvent):void {
	trace("MyTween Finished");
}

1048: Method cannot be used as a constructor.
var myTween:TweenMax = new TweenMax.fromTo(my_mc, 1, {x:0, y:0}, {x:300, y:200,ease:Expo.easeOut});


Another Method Same Error

import com.greensock.*; 
import com.greensock.easing.*;
import fl.transitions.TweenEvent;

var myTween:TweenMax  = new TweenMax.fromTo(my_mc, 1, {x:0, y:0}, {x:300, y:200,ease:Expo.easeOut,onComplete:myFunction});

function myFunction (onComplete):void {
	trace("MyTween Finished");
}

1048: Method cannot be used as a constructor.
var myTween:TweenMax = new TweenMax.fromTo(my_mc, 1, {x:0, y:0}, {x:300, y:200,ease:Expo.easeOut});


Please put on some Suggestion

  • LocationChicago Area
adding eventlistener to TweenMax.fromTo [SOLVED]
You're mixing a static method and a constructor.

GOOD: TweenMax.fromTo(...);
GOOD: new TweenMax(...);
BAD: new TweenMax.fromTo(...);

adding eventlistener to TweenMax.fromTo [SOLVED]
thanks for solving my problem here is example for it

TweenMax.fromTo(mc, 1, {x:0, y:0}, {x:300, y:200,ease:Expo.easeOut,onComplete:myFunction});

function myFunction ():void {
trace("Do it");
TweenMax.to(mc2, 1, {x:"65", y:"117", ease:Circ.easeInOut});
}





0 user(s) are reading this topic

members, guests, anonymous users