Skip to main content
November 28, 2014
Question

Whats wrong with this ActionScript 3?

  • November 28, 2014
  • 2 replies
  • 500 views

I cant see whats wrong with this piece of ActionScript 3, its probably something really obvious...

function fl_SubmitConsoleButton(event:MouseEvent):void

  {

  var Command:String = consolecommand_txt.text;

  switch (Command){

  case "one" :

  gotoAndStop(1);

  break;

  case "two" :

  trace("Two has been executed");

  break;

  case "three" :

  trace("Three has been executed");

  break;

  }

}

Thanks

This topic has been closed for replies.

2 replies

November 28, 2014

Any Ideas?

Ned Murphy
Legend
November 28, 2014

Does the function execute at all?  If not, do you have a button with an event listener assigned to it that calls that function?

November 28, 2014

Not sure whats happening but yes there is an event listener linked to the button: submitconsole_btn.addEventListener(MouseEvent.CLICK, fl_SubmitConsoleButton);

Ned Murphy
Legend
November 28, 2014

For the code shown there is nothing wrong.  What problem are you having?  Do you get any errors?  Have you traced the Command value to see if it is what you expect?

November 28, 2014

I have just put a trace in and nothing is showing up in the output, I'm getting no errors at all.