Jump to content

Codepen Notification

You didn't provide a codepen sample that illustrates the problem. It really helps us quickly identify problems. This isn't mandatory, but it will get you better/faster results. Would you like to add one?

adding eventlistener to TweenMax.fromTo [SOLVED]

Started by saki, Nov 30 2009 05:20 AM - - - - -

2 replies to this topic
saki

Post #1 by saki , 30 November 2009 - 05:20 AM

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
  • Back to top

GreenSock

Post #2 by GreenSock , 30 November 2009 - 05:15 PM

You're mixing a static method and a constructor.

GOOD: TweenMax.fromTo(...);
GOOD: new TweenMax(...);
BAD: new TweenMax.fromTo(...);
  • Back to top

saki

Post #3 by saki , 02 December 2009 - 05:17 AM

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});
}
  • Back to top




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

3rd Party Advertisement