Hi Attila,

I get your point but,even if i change the code to read

_root.attachMovie("butt_btn", "butt"+i, this.getNextHighestDepth());
will not produce the result of having the buttons placed ontop of the labels 
where i want them.

You say that I only produce an array reference to the butt+i. But I use the 
same code to produce a number of textFields using the same code and I get the 
results I want,why is this not working with my buttons?

If I want to use the array to give me the appropriate iterations and create the relevant buttons then, how would I go about it?

Thanks
JohnT


PS
With the last line of code I was attempting at creating interaction with the 
various butt[i]



Rákos Attila wrote:

You are using square brackets a little bit confusing and in chaotic
manner :)

JT> _root.createTextField("mytext"+[i], this.getNextHighestDepth(), myX, 0, 
100, 30);

Why do you refer to i as [i]? Well, accidentally the actual result
will be mytext0, mytext1, mytext2, etc. but a simple "mytext" + i
gives the same result. If you type "mytext" + [i], then with your
square brackets first you create an array with single element of i,
and since the first operand of + operator is a string, this array will
be converted to string (which actually results i as a string), and
appended to "mytext". So you rely on a side effect of the array to
string conversion.

JT> myId = _root["mytext"+[i]];

the same

JT> _root.attachMovie("butt_btn", "butt"+[i], this.getNextHighestDepth());

and here too

JT> btn = ["butt"+[i]];

and this line is causing troubles, probably you wanted to write
btn = _root["butt" + i];
Your original code doesn't refer to the button instance, but creates
an array (square brackets!) with a single element of a string which
consists of a string literal "butt" and a string representation of an
array (square brackets again!) having i as its single element. So
after all btn refers to an Array instance (not the button) and you set
_x, _y properties of this array (well, there are no such built-in
properties, but you create them).

 Attila



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to