Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

repositioning objects from array variable data

Status
Not open for further replies.

IGTbob

Programmer
Jul 11, 2002
12
US
I'm doing a "for" loop through an array and would like the objects identified in the array values to be re-positioned and change color.

I got the color change figured out, but am having trouble with the re-positioning.

I am using this method

var = "_root."+strObject;
var._x -= 5;
var = "_root."+strObject;
var._y -= 5;

With each loop through the array the value of "strObject" changes

"strObject" identifies different MovieClips placed on the main stage labeled with Instance Names that match the strObject value.

I can't figure out why it is not working. Is there something else I might use, like a "setPosition" method?

Thanks for any help...
-Robert
 
var is a reserved word so dont use that

however

_root[strobject]._x -=5;

might be closer to what you want
 
Is there a reason that same logic (above) wouldn't work on a text field?

sText = "Show this!"
vTextBox = "TextBox"
_root[vTextBox].text = sText

Where vTextBox is the instance name of a dynamic text field and sText is the string I want to display.

This works:
_root.TextBox.text = "Show this!"
but the above doesn't...

Any help is much appreciated - thanks.
-Robert
 
the above code does work. i just tested it to make sure.

put a dynamic text box on stage with instance name textbox and then run your code.
 
OK
I was actually tring to go to a MC several levels in...

i.e.
sText = "Show this!"
sLevel1 = "NextMC"
vTextBox = "TextBox"
vTextBoxPath = "Movie."+strLevel1+"."+vTextBox
_root[vTextBoxPath].text = sText

thinking it would translate to this:
_root.Movie.NextMC.TextBox.text = "Show this!"

and it wasn't working

so I tried this:

sText = "Show this!"
vTextBox = TextBox"
vPath = "Movie"
_root[vPath][strLevel1][vTextBox].text = sText

and it works...

Thanks for convincing me it would work...

-R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top