Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! · Link to Us · Newsletter · Tell a Friend ·

      Add Tutorial |

 

Advertise here










 

Google

Search WWW   
FlashAdvisor.com

 Home > Tutorials  > ActionScript

"Starfield Simulation" effect using "duplicateMovieClip"

Author: Saumitra Karandikar | Email


Advertisement


In Step3, lets write it as a function to that we can easily loop it.


function createFlyingMC() {
_root.flying_mc.duplicateMovieClip("flying_mc"+mycount,_root.getNextHighestDepth());
mycount++;
}


We will further add condition for mycount to be less than 50 (0 to less than 50 makes 0 to 49 which is a total count of 50 as desired). We will also add a new function to iterate and invoke the function "createFlyingMC" every half a second. We do so by using the "setInterval" function whose syntax is as follows:


ID = SetInterval(functionName,interval,[parameters]);


(Note that setInterval works for only Flash Player ver 6 and above)

The parameters are optional and if present are passed to the function represented by "functionName". The interval is in milliseconds. Also the ID for this timer can be specified as "ID" or any logical name so that the "ID" can be cleared using the clearInterval function. This should be definitely be done to avoid memory leakage.
Thus, in our case the function becomes:-


ID = setInterval(createFlyingMC, 500);


No parameters are required in our case.

Download Source File

| 1 | 2 | 3 |

Rate This Tutorial :
We hope the information helped you. If you have any questions or comments, please don't hesitate to post them on the Forums section
Submit your Tutorial at Click Here
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

28 users online