|
|
|
"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
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
|
|
|