A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: So if you duplicate a movieclip...

  1. #1
    Senior Member
    Join Date
    Apr 2002
    Posts
    174

    So if you duplicate a movieclip...

    Hey All,

    If you duplicate a movieclip as such....


    for(a=0; a < photoThemes.length; a++){
    _root.dupClip.duplicateMovieClip("dupClip" + a, a);
    _root["dupClip" + a]._x = _root["dupClip" + a]._x + a*13;
    }

    You'll get instance names as such......
    dupClip1
    dupClip2
    dupClip3
    dupClip4
    dupClip5

    correct?

    Within those clips how do you reference their own value of "a"?
    this[a]?


    -jub-

  2. #2
    Senior Member corky§urprise's Avatar
    Join Date
    Jun 2005
    Posts
    346
    You would have to use something like

    depth=0
    for(a=0; a < photoThemes.length; a++){
    var a="dupClip"+depth
    _root.dupClip.duplicateMovieClip(a, depth);
    // usage is _root[a]
    _root[a]._x = _root[a]._x + a*13;
    }

    Just a guess, but try something like that.

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Posts
    174
    Hey Corky,

    My for loop seems to be functioning fine, as the clips are displayed as I had hoped. But within each duplicated clip I would like to use it's unique value [1,2,3,4,5,etc] as a variable to target back at the root.

    How would you reference the instance name I guess is the question?

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    174
    Hey Corky,

    My for loop seems to be functioning fine, as the clips are displayed as I had hoped. But within each duplicated clip I would like to use it's unique value [1,2,3,4,5,etc] as a variable to target back at the root.

    How would you reference the instance name [within that instance] I guess is the question?

  5. #5
    Senior Member
    Join Date
    Apr 2002
    Posts
    174
    this._name!!!!!!

    Figured it out, Thanks All!!!

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