Help With Error In Script

Hey everyone,

Sorry to bother everyone with what is probably a minor problem, however, I can’t seem to figure it out. I am hoping that someone here will be able to solve the problem which is occuring in the following script. The error seems to be occurring on line 26:

reference = 150;
MovieClip.prototype.asNewStar = function() {
this.x = random(Stage.width)-Stage.width/2;
this.y = random(Stage.height)-Stage.height/2;
this.z = 1000;
this.onEnterFrame = function() {
if ((this.z -= 20)<-100) {
} else {
MovieClip.prototype.drawStar = function() {
this.lineStyle(5-this.z/200, 0xffffff, 100);
perspectiveRatio = reference/(reference+this.z);
this.moveTo(this.xperspectiveRatio, this.yperspectiveRatio);
perspectiveRatio = reference/(reference+this.z+20);
this.lineTo(this.xperspectiveRatio, this.yperspectiveRatio);
this.createEmptyMovieClip(“galaxy”, 1);
galaxy._x = Stage.width/2;
galaxy._y = Stage.height/2;
galaxy.onEnterFrame = function() {
this.createEmptyMovieClip(“star”+++depth, depth).asNewStar();

If anyone can help me out with this I would appreciate it.


Kelly :wink:

this.createEmptyMovieClip(“star”+++depth, depth).asNewStar();

Should be…

this.createEmptyMovieClip(“star”+ ++depth, depth).asNewStar();

When you use the auto format button in Flash MX it compresses the ++depth so it becomes “star”+++depth, which produces the error.


Thanks once again for all your help. I really appreciate it. One more question though - can I speed up the stars to make the pass by faster?


Kelly :stuck_out_tongue:

Bump the FPS up :wink:

That is the easiest way, I tried myself but couldn’t get anything much.

Be careful though, effects like this are CPU intensive and are usually better at a slower pace so don’t bump it up too much.

Hey Beta,

Thanks again. I hope I’m not a pain - you seem to spend a ot of time helping me. I really appreciate it though.

However, there’s one more thing I need to ask. If I wanted this effect to happen full-screen, could I and how would I do it? I know full screen is a big no-no, but my client may or may not insist on it.

Once again for being there when I need help.


Kelly :wink:

Keep it the way it is.

The effect using relative positioning not static positioning.

The Stage.width and Stage.height allows the script to utilize all available space.