A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to reference a nested object

  1. #1
    Junior Member
    Join Date
    Aug 2004
    Posts
    2

    How to reference a nested object

    Hello...
    I have the following code that attaches one movie into another

    Code:
    for(a = 0; a<= items.length-1; a++){ 
    	item = _root.attachMovie( "test", "item"+a, a);
    I have an MC "test" that has a button nested in it. In the MC test I gave the button a name of "b1". Within the button, I have a text field "nametxta" that I would like to change the text of through script. How do I go about referencing that name box?

    Thanks in advance!
    Andy

  2. #2
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    There's only one textfield right? Or do you need to have it for all the "test"+a mc's?
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  3. #3
    Senior Member
    Join Date
    Feb 2001
    Location
    On the fifth floor.
    Posts
    1,202
    Something like this.
    Attached Files Attached Files

  4. #4
    Junior Member
    Join Date
    Aug 2004
    Posts
    2
    You guys are awesome!

    I set the txt boxes with variables instead of names and refered to them as item.variable.

    Here is the code I used:
    Code:
    for(a = 0; a<= items.length-1; a++){ //loop from 0 to number of items in array "items"
    		iattrib = items[a].attributes;
                    item = _root.attachMovie( "test", "item"+a, a);
    		trace(iattrib.id);
    		item.nametxta = iattrib.id;
                    item.nametxtb = iattrib.id;
    Thanks for all your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center