Skip to main content
Trace_Log_Flash_Win_7
Participating Frequently
September 24, 2014
Question

TypeError: Error #1009

  • September 24, 2014
  • 1 reply
  • 813 views

Okay, so I know what TypeError: Error #1009 is, but I don't see what's wrong with my code.

My Code:

this.stop();

stage.addEventListener(KeyboardEvent.KEY_DOWN, groupNum);

function groupNum(event:KeyboardEvent):void

{

    if(event.keyCode != 49 && event.keyCode != 50 && event.keyCode != 51 &&

       event.keyCode != 52 && event.keyCode != 53 && event.keyCode != 54 &&

       event.keyCode != 55 && event.keyCode != 56 && event.keyCode != 57 &&

       event.keyCode != 97 && event.keyCode != 98 && event.keyCode != 99 &&

       event.keyCode != 100 && event.keyCode != 101 && event.keyCode != 102 &&

       event.keyCode != 103 && event.keyCode != 104 && event.keyCode != 105)

    {

        trace("Group #: " + GroupNum.text);

        gotoAndPlay(1, "Scene 2");

    }

}

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
September 24, 2014

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

 

- is declared but not instantiated

- doesn't have an instance name (or the instance name is mispelled)

- does not exist in the frame where that code is trying to talk to it

- is animated into place but is not assigned instance names in every keyframe for it

- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

 

If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

For all of the code that you show I see only one object that might be at issue, the textfield you call GroupNum.

Also, the conditional you wrote could be simplified since the values are two continuous sets of numbers... one >= 50 && <= 57 and the other >= 97 and <= 105

Trace_Log_Flash_Win_7
Participating Frequently
September 26, 2014

How do I make it so that I can trace the text from the textfield GroupNum?

Ned Murphy
Legend
September 26, 2014

trace(GroupNum.text);

Did you solve the 1009 error?