Jump to content
Search Community

DynamicProps and AS2 [SOLVED]

tfranz test
Moderator Tag

Recommended Posts

Hi,

i'm trying to get the dynamicProps to work in AS2 – and yes, i'm a club-member ... ;)

But there's no dynamic tweening at all ...

 

import com.greensock.TweenLite;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.DynamicPropsPlugin;
TweenPlugin.activate([DynamicPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.

function getMouseX():Number { return this._xmouse;}
function getMouseY():Number { return this._ymouse;}

TweenLite.to(my_mc, 3, {dynamicProps:{_x:getMouseX, _y:getMouseY}});
//TweenLite.to(my_mc, 3, {_x:10, _y:10});

 

There is a movieclip "my_mc" on the stage. The plugin-file is inside the folder com/greensock/plugins/DynamicPropsPlugin.as (as it should be, i changed nothing inside the folders) and the FLA is beside the com-folder. The last line of code above works – so i think it's not a general problem with the Tweening.

 

What could be the problem?

 

Thanks for any help/ hint!

 

Tobias

Link to comment
Share on other sites

Sorry about any confusion the Plugin Explorer may have caused - it should use "_root._xmouse" and "_root._ymouse" instead of "this._xmouse" and "this._ymouse" - it's one of those wonderful scope issues that AS2 has (AS3 isn't plagued by scope stuff like AS2 is). So your code should look like:

 

import com.greensock.TweenLite;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.DynamicPropsPlugin;
TweenPlugin.activate([DynamicPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.

function getMouseX():Number { return _root._xmouse;}
function getMouseY():Number { return _root._ymouse;}

TweenLite.to(my_mc, 3, {dynamicProps:{_x:getMouseX, _y:getMouseY}});

 

I'll update the Plugin Explorer code shortly.

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.
×
×
  • Create New...