Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

help with buttons

New Here ,
Mar 19, 2013 Mar 19, 2013

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.

TOPICS
ActionScript
270
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 19, 2013 Mar 19, 2013

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);

}

Translate
LEGEND ,
Mar 19, 2013 Mar 19, 2013
LATEST

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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines