I sent an email to pom regarding a tutorial that he wrote, but the email was bounced and he hasn’t replied to my PM.
I have followed both of pom’s tutorials that involve experiments with perspective in Flash, but I have encountered a problem while attempting to duplicate a movie clip symbol in the second tutorial (http://www.kirupa.com/developer/mx/starfield_perspective.htm). I have a single instance of the “ball” movie clip symbol appearing at random positions. However, I cannot seem to successfully duplicate the symbol instance at random positions using the loop that pom provided:
nbClip=50;
for (i=0;i<nbClip;i++){
duplicateMovieClip(ball,“ball”+i,i);
mc=_root[“ball”+i];
mc.startx=Math.round(Math.random()*300)-50;
mc.starty=Math.round(Math.random()*300)-50;
}
Question: The tutorial states that the aforementioned loop construct should be entered “on the first frame of the _root.” This means that the loops should be entered in the first frame of the Flash movie’s main timeline, no?
Question: Does anyone know whether the properties “startx” and “starty” apply to Flash MX (and not Flash MX 2004)? The Actions panel does not seem to recognize these properties as no syntax coloring is applied and I cannot find any mention of these properties in the Reference panel.
I proceeded to complete the tutorial and everything except for the duplication of random “stars” (the “ball” movie clip instances) appears to work. I have included my code below. Can anyone see anything that I have done incorrectly?
I appreciate your help!!
Matt
Attached to the “ball” movie clip instance that is part of the Flash movie’s main timeline:
onClipEvent(load)
{
maxDepth = 1000;
z = Math.round(Math.random() * maxDepth);
fl = 300;
scale = fl / (fl + z);
_xscale = _yscale = 100 * scale;
_alpha = scale * scale * 100;
this.swapDepths(scale * 1000);
}
onClipEvent(enterFrame)
{
var xcenter = _root._xmouse;
var ycenter = _root._ymouse;
var offx = (startx - xcenter);
var offy = (starty - ycenter);
_x = xcenter + offx * scale;
_y = ycenter + offy * scale;
}
Attached to Frame 1 of the Flash movie’s main timeline:
bnClip = 50;
for (i = 0; i < nbClip; i++)
{
duplicateMovieClip(ball, “ball” + i, i);
mc = _root["ball" + i];
mc.startx = Math.round(Math.random() * 300) - 50;
mc.starty = Math.round(Math.random() * 300) - 50;
}