Sign in to follow this  
saki

adding eventlistener to TweenMax.fromTo [SOLVED]

Recommended Posts

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

Share this post


Link to post
Share on other sites

You're mixing a static method and a constructor.

 

GOOD: TweenMax.fromTo(...);

GOOD: new TweenMax(...);

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

Share this post


Link to post
Share on other sites

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});

}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.