Jump to content
Search Community

Some simple syntax help please

Guest rhysyG
Moderator Tag

Recommended Posts

Hey Guys,

 

Just wondering what I'm doing wrong here with my syntax??

Basically got these variable at the top:

 

var tarPos1:Number = -291;

var tarPos2:Number = -582;

var tarPos3:Number = -873;

var tarPos4:Number = -1164;

var tarPos5:Number = -1455;

var tarPos6:Number = -1746;

var inc:Number = 0;

var inc2:Number = 1;

 

Then on my button:

mc_arrow_right.onPress = function():Void {

inc++;

inc2++;

TweenMax.fromTo(target, 1, {ease:Strong.easeIn}, {_x:tarPos[inc]}, {_x:tarPos[inc2]});

trace("tarPos"+inc);

trace("tarPos"+inc2);

}

 

so when I click the button I want it to be:

TweenMax.fromTo(target, 1, {ease:Strong.easeIn}, {_x:tarPos1}, {_x:tarPos2});

 

inc and inc2 trace correctly so what am I doing wrong?

 

Thanks!

Link to comment
Share on other sites

to dynamically get the VALUE of tarPos1 do

 

trace(_root["tarPos"+inc]);

 

 

to use this value in your tween

 

TweenMax.fromTo(target, 1, {ease:Strong.easeIn}, {_x:_root["tarPos"+inc]}, {_x:_root["tarPos"+inc2]});

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...