-
[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
-
You can use the change in the variable you are using in the loop. In my example it will be "i".
PHP Code:
for(i = 0; i < 5; i ++) { attachMovie("Something", "Something"+i, i, {_x: i*10+20, _y: 20}); }
This will attach five MovieClips, starting at (20, 20) and placing each one ten pixels to the right of the last.
-
FK'n_dog
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);
}
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|