A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Addressing movieclip with variable

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    104

    Addressing movieclip with variable

    Ok I have actually searched the forums and tried everything they said to get this to work and it doesn't work.

    on (release) {
    var laspos2 = _global.laspos;
    trace(laspos2);
    trace(_root.timeline.laspos2.timeline_hilite._curr entframe);
    _root.timeline.newscroll = -40;
    trace(_global.laspos);
    this.timeline_hilite.gotoAndPlay(2);
    }


    I am trying to get this working:

    I want to use a variable (laspos2) to dynamically address a movieclip.

    var laspos2 = _global.laspos;
    trace(laspos2);
    trace(_root.timeline.laspos2.timeline_hilite._curr entframe);

    It always gives me undefined for the path. (the laspos2 trace gives me the proper string value.) The mc's I am trying to address are named d1, d2, d3, etc.

    If I do this:
    trace(_root.timeline.d1.timeline_hilite._currentfr ame);

    It gives me the proper currentframe so I know my path to that movieclip is working.

    This is extremely frustrating and any help is greatly appreciated. I am on a tight time deadline so please don't hold back if you have any ideas. Thanks in advance.


  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You have to tell Flash that it is a variable and not a name...

    Try this....

    trace(_root.timeline[laspos2].timeline_hilite._currentframe);

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    104
    Thanks so much! I wasn't removing the dot between timeline and []. Awesome!

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