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) {
this.removeMovieClip();
} else {
this.drawStar();
}
};
};
MovieClip.prototype.drawStar = function() {
this.clear();
this.lineStyle(5-this.z/200, 0xffffff, 100);
perspectiveRatio = reference/(reference+this.z);
this.moveTo(this.xperspectiveRatio, this.y perspectiveRatio);
perspectiveRatio = reference/(reference+this.z+20);
this.lineTo(this.xperspectiveRatio, this.y perspectiveRatio);
};
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.
Thanks,
Kelly
system
January 31, 2003, 6:53pm
2
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.
system
January 31, 2003, 6:59pm
3
Beta,
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?
Thanks,
Kelly
system
January 31, 2003, 7:12pm
4
Bump the FPS up
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.
system
January 31, 2003, 7:25pm
5
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.
Thanks,
Kelly
system
January 31, 2003, 7:29pm
6
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.