A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: dynamic movie attribute naming

  1. #1
    Senior Member
    Join Date
    Aug 2002
    Posts
    109

    dynamic movie attribute naming

    easy stuff yet brain malfunction here!

    assume that you create movies named x1, x2,x3..
    and they have a common variable attached to each named "id"

    thus a newbie will name them as:
    x1.id="2131"
    x2.id="2132"
    x3.id="2133"

    however, there must be a prof. way to name movieclip using for-next

    can you code me some plz?

    thnx for your time

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835
    how about this:

    Code:
    total = 3, values = ["2131","2132","2133"];
    for( j = 0; j < total; j++)
       _root["x" + j].id = values[j];
    or, if the value you are assigning is always "213" + the number, then you can also put:

    Code:
    total = 3;
    for(j=0; j < total;j++)
       _root["x" + j].id = "213" + j;
    hope that helps - n.

  3. #3
    Senior Member
    Join Date
    Aug 2002
    Posts
    109

    thnx

    _root["x" + j].id

    this simple coding..somehow i could not recall and find through literature..

    thnx for your time.

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835
    you are welcome!

    if the movie clip is in a different timeline, you can amend it, eg:

    - same timeline
    this["x" + j]

    - inside another movie clip on level 11
    _level11.other_mc["x" + j]

    etc. quite handy

    - n.

  5. #5
    Senior Member
    Join Date
    Aug 2002
    Posts
    109
    thnx for al replies...
    kann solves another problem and continues his journey through unkonwn Flash universe...

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