A Flash Developer Resource Site

1. Clone Placing

Hey, does anyone know how I could clone an element then place each clone in a specific place? Like make 15 clones put one at (15,60) and another at (20, 65). I don't work a lot with clones so I wasn't really sure if this is possible. Thanks.

2. A cloned element is just like any other element you create the only difference is that it is a copy or clone of a pre-defined element. So you can use ANY of the element properties and methods available,

To place a cloned element just use the .x and .y properties.

For ex.

PHP Code:
``` var clone = element("test").clone(); clone.x = 15; clone.y = 60;  ```

3. yeh I figured someone would say this, I was more going for a
for (x=0,x<15,x++){
clone=element.clone
clone.x=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
clone.y=50
}

or something. So that there would be 15 clones and the first one would be at 1 x, second at 2 x, etc. Is something similar to this possible? I wanted to do this so I could keep all the collsions simple along with not making a bunch of elements.

4. Do it more like this..

PHP Code:
``` for (x=0,x<15,x++){ clone=element.clone clone.x=x+1 clone.y=50 }  ```
or you could store your X coordinates in an array if there is no pattern to them...

PHP Code:
``` coordX = new Array(1,4,25,6,90,100,15,73,34); for(var i=0;i<coordX.length;i++) { clone=element.clone clone.x=coordX[i] clone.y=50 }  ```
You could also do another array or loop for the Y coordinate if it isn't static.

5. ofcourse, x+1, haha. Havent tried it yet but its so simple! Thankyou.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap