|
metadata
I’m trying to make Shoot using the as2 tutorial, but actually implementing it in as3. It’s a lot of googling but so far it’s worked fine… but now I’ve just created my Explosion class (i’m not even trying to USE the explosion yet) and I keep getting the error:
Symbol ‘Explosion’, Layer ‘Layer 4’, Frame 15, Line 1 1061: Call to a possibly undefined method removeMovieClip through a reference with static type Explosion.
This is the code I have for the Explosion class:
package {
import flash.events.**;
import flash.display.** ;
public class Explosion extends MovieClip {
function Explosion(){
addEventListener(‘enterFrame’, onEnterFrame);
}
function onEnterFrame(e:Event):void{
if(this.currentFrame == this.totalFrames){
removeEventListener(‘enterFrame’, onEnterFrame);
if (stage.contains(this)){
stage.removeChild(this);
}
}
}
}
}
|
|
metadata
When posting codes in the forums here, use pre tags:
[http://www.kongregate.com/forums/4-game-programming/topics/39889-proper-forum-code-formatting-guide](http://www.kongregate.com/forums/4-game-programming/topics/39889-proper-forum-code-formatting-guide)
It messes with the code if you don’t do that :)
I’m new to Actionscript, but according to your error message, you’re trying to use the removeMovieClip method.
I believe removeMovieclip only exists in AS2, and not AS3.
|
|
metadata
Well actually I’m not if you’ll look at the code. That’s why I’m horribly confused by this error. It makes no sense. This code, except for the if(this.currentFrame == this.totalFrames){, is in other classes and works fine.
|
|
metadata
Okay I figured out the problem. Inside the movieclip which I had copied from the downloadable shoot code (in as2), frame 15 of the explosion include the action code “this.removeMovieClip();”. Removing that fixed it.
Only saying this because I really hate when I find someone has posted the same problem as me on a forum so I look for the solution and all they say is “nvm i fixed it”
|