Flash help?
- Started
- Last post
- 11 Responses
- lnu
I can't remember how to do this or what it's called so searching for it won't help me, will you?
I've got a set of buttons, with instance names ending with a number ("btn1"," btn2" and so on) and I want to controll specific buttons with a for..to loop with "i" in it. I want to be able to tell the buttons to do stuff, like btn254.gotoAndPlay but instead of 254 I wan't the i number. Can someone please help me?
- lnu0
Anyone? I know this is really basic stuff, but I just can't remember it. How do I take that i number and put it in a name that I can use?
- uberdesigner0
some idiot named joe suggests a looping array
- lnu0
Yeah yeah I get that part, but what's the syntax? Thanks Joe.
- TrueHell0
It's called a for loop
for(i=0;i
- propa0
this.["btn"+i]gotoAndPlay("label...
That should work.
- lnu0
As I said, I get that part, but inside that loop, I want to use the i number... So far I've tried
var something = String("this._parent.btn"+i+"");
something.gotoAndPlay("dosomethi...and
this.parent.btn[i]gotoAndPlay("d...
but these are just shots in the dark :(
- TrueHell0
sorry, cut off my response
for(i=0;i
- TrueHell0
try again. in the loop this["btn"+i].gotoAndPlay("dosom...
- lnu0
Thank you all for your time.
I've tried this.parent_["btn"+].goto... but i get the message "Expected a field name after '.' operator.".?
- TrueHell0
this._parent["btn"+i].gotoAndPla...
make sure you include the i in the square brackets and the underscore is at the front of parent
- lnu0
ah, got it know. The trick was to NOT have a dot between "this" and ["btn"+i]. (Why not? Where's the sence in that?).
Thanks again.