Copy link to clipboard
Copied
hi
im making a shop in my game and i have a button telling my ship to change its frame but i get this error:
Scene 1, Layer 'as', Frame 3, Line 7 1061: Call to a possibly undefined method gotoAndStop through a reference with static type Class.
and here is the code for it:
stop();
import flash.display.MovieClip;
import flash.events.MouseEvent;
alien3.addEventListener(MouseEvent.MOUSE_DOWN, mouse1);
function mouse1(e:MouseEvent):void {
Ship.gotoAndStop(2);
}
any help.
It appears you have a class you have named "Ship" and in your code you are trying to tell this class to act like a movieclip. WHat you probably really want to be doing is something more like...
var ship:Ship = new Ship();
addChild(ship);
function mouse1(e:MouseEvent):void {
ship.gotoAndStop(2);
}
Copy link to clipboard
Copied
It appears you have a class you have named "Ship" and in your code you are trying to tell this class to act like a movieclip. WHat you probably really want to be doing is something more like...
var ship:Ship = new Ship();
addChild(ship);
function mouse1(e:MouseEvent):void {
ship.gotoAndStop(2);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now