A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8]Here is an easy one for you .

  1. #1
    Member
    Join Date
    May 2007
    Posts
    39

    [F8]Here is an easy one for you .

    Teachers
    I have utilized a "for" statement and attached a number of movie clips from an array to my movie. I have figured out how to locate these clips uniformly with the {_x...,_y....} parameter of the attachMovie() method.
    However I can't figure out how I can assign these clips individually to particular _x, _y,coordinates. I realize That I must assign the attached movie clips to a variable, after that and many , many,attempts,I can't figure out how to get these things located.
    Thanks
    Mango

  2. #2
    Member
    Join Date
    Jan 2008
    Posts
    53
    You can use the change in the variable you are using in the loop. In my example it will be "i".

    PHP Code:
    for(05++)
    {
        
    attachMovie("Something""Something"+ii, {_xi*10+20_y20});

    This will attach five MovieClips, starting at (20, 20) and placing each one ten pixels to the right of the last.

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    if the placement is not uniform, grab the
    coordinates from an associative array.

    arr = [{xx:10,yy:10},{xx:20,yy:120},{xx:30,yy:160},
    {xx:40,yy:220},{xx:50,yy:250}];

    for(var i = 0; i < arr.length; i ++){
    init = {_x:arr[i].xx, _y:arr[i].yy};
    attachMovie("Something", "Something"+i, i, init);
    }

  4. #4
    Member
    Join Date
    May 2007
    Posts
    39
    Thanks
    The "associative array" is the way for me to go.
    Mango

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