Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
deniss

About TweenMax, Listeneres and AS2 [SOLVED]

Recommended Posts

Hello ppl,

 

First of all please excuse my bad English and sorry if I am asking stupid question, which answer is published on this forum or online help/examples. I have tried to find the answer, also tried a lot of variants but unfortunately without any success :(

 

So, I am not so good with coding (still working with AS2, AS3 looks like Mission Impossible 4 to me :) ) ...

 

My question is can I use TweenMax with listeners in AS2 - for example something like that

 

myTween=TweenMax.to(ball, 10, {_x:700, onUpdateListener:myFun});

 

In help I saw that - onUpdateListener is described as Function, and it is similar as: "myTween.addEventListener(TweenEvent.UPDATE, myFunction);" correct me if I am wrong but the last one is for AS3 correct!?

 

 

I have tried a lot of variants to change in AS2 but nothing:

 

 

var list = {};
list.UPDATE = function(){
   trace('hop');
}
var tw = TweenMax.to(ball, 10, {_x:700});
tw.addListener(list);

//_________________________________________

var list = {};
list.onUpdate = function(){
   trace('hop');
}
var tw = TweenMax.to(ball, 10, {_x:700});
tw.addListener(list);

//_________________________________________

var list = {};
list.Update = function(){
   trace('hop');
}
var tw = TweenMax.to(ball, 10, {_x:700});
tw.addListener(list);

//_________________________________________

var list = {};
list.Update = function(){
   trace('hop');
}
var tw = TweenMax.to(ball, 10, {_x:700, onUpdateListener: list});

 

 

All these examples above + many others do not work. I know, I can use onUpdate instead of onUpdateListener - but will be better if I can use listener

 

 

Thanks in advance and once again sorry if I am an idiot :)

Link to comment
Share on other sites

Event Listeners are AS3-only. Why would you want to use them in AS2? I'm just curious. You should be using an onUpdate in AS2.

Link to comment
Share on other sites

Hello greensock,

 

Thank you for your quick reply. So, I want to use onUpdate and listener because during the tween I will execute some procedures after consecutive tween step, but not after each step and not every time. My idea was when I need to execute something onUpdate to use addListener and when I do not need to removeListener. I hope you will understand me even with my horrible english. Of course I can make it with onUpdate and function instead of listener. In this case I can use some sort of boolean flag or to clear my function something like myFunction=null or something else ... Just I was thinking that using listeners is more clever and elegant :)

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×