A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Syntax question ( dynamically defining movie clip names )

  1. #1
    Senior Member
    Join Date
    Sep 2002
    Location
    Clogland
    Posts
    100

    [RESOLVED] Syntax question ( dynamically defining movie clip names )

    Howdy, I'd like to generate this dynamically...

    PHP Code:
    button0.num 0;
    button1.num 1
    I have got this far....
    PHP Code:
    for(i=0;i<2;i++){
        
    trace ("button" ".num = " );

    .....as in I can get the desired result in a trace statement, I just need it to magically get it out of the trace statement and turn it into usable code....

    Thanks in advance.

  2. #2
    foo to you foo2's Avatar
    Join Date
    Nov 2006
    Location
    Germany,Europe
    Posts
    180
    If the movies and the var exist you can use this syntax:

    PHP Code:
    for (i=0i<2i++) {
        
    _root["button"+i].num=i;

    Last edited by foo2; 03-20-2007 at 06:40 AM.
    Sorry for my bad english. Feel free to correct my mistakes

  3. #3
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    _root["button" + i]["num"] = i ;

    edit: looks like foo beat me to it
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  4. #4
    Senior Member
    Join Date
    Sep 2002
    Location
    Clogland
    Posts
    100
    Thank you both, worked like a treat.

    I've really got to get that concept into my head, that's the second time it's halted all progress for me this week ( and the second time you lot have helped me out )

    Thanks again.

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