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

Error #1009 - stumped on what to do

Community Beginner ,
Jul 26, 2014 Jul 26, 2014

I need major help here. I have a script with a movieclip with a two buttons inside. These work so that it would look like it stayed pushed down until you clicked it again to simulate a multiple choice. Pressing the buttons sends the array a push. If the array reaches 4 it should stop and all that stuff. Problem is that it works pretty fine if you press it, but wont stay pressed anymore and drops me with the 1009 error.

Anyways, here's the code:

script.jpg

Any kind of help would be greatly appreciated as this is basically for my finals.

TOPICS
ActionScript
392
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 , Jul 26, 2014 Jul 26, 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).

...
Translate
LEGEND ,
Jul 26, 2014 Jul 26, 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.

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
Community Beginner ,
Jul 26, 2014 Jul 26, 2014

Alright, I got the debugging on. It says:

"TypeError: Error #1009: Cannot access a property or method of a null object reference.

  at MagiTest_fla::MainTimeline/frame1()[MagiTest_fla.MainTimeline::frame1:27]"

frame1:27 is:

magibatClip.magiDown.addEventListener(c, unTake);

Most likely, it's the first mistake you pointed out (declared, but not instantiated). I read an older answer you gave to another user, and I speculated it is that, but I still don't understand that.

It went something like this from what I read:

var someMC:MovieClip = new MovieClip();

But I still don't seem to get it to work as I don't really understand it. (Sorry for my uselessness).

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
LEGEND ,
Jul 26, 2014 Jul 26, 2014

If those are objects that you manually placed on the stage then it will not be the first item in the list.

Before line 27 try adding a few traces and see where is comes up with a null (or errs again)

trace("magibatClip: ", magibatClip);

trace("magiDown: ", magibatClip.magiDown);

trace("c: ", c);

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
Community Beginner ,
Jul 26, 2014 Jul 26, 2014

magibatClip:  [object myMagiClip]

magiDown:  null

c:  click

So the null is "magiDown".

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
LEGEND ,
Jul 27, 2014 Jul 27, 2014

Make sure you assigned that instance name to whatever object is inside magibatClip that you intend to be magiDown.  Make sure that same object is not somewhere down the timeline of magibatClip when that code executes - it needs to be present.  If that object animates into place, make sure you assigned instance names to it in all keyframes.

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
Community Beginner ,
Jul 27, 2014 Jul 27, 2014

timelines.jpg

I've checked them and they all look like they have their instance name where they are supposed to be. Also this is all I have currently on the timeline (above) and inside the movie clip (below). Inside the clip are the buttons and there aren't any buttons or clips there.

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
LEGEND ,
Jul 27, 2014 Jul 27, 2014

Which frame is the button in that comes up null?

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
Community Beginner ,
Jul 27, 2014 Jul 27, 2014

The button is in frame #2 inside the movie clip.

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
LEGEND ,
Jul 27, 2014 Jul 27, 2014

That is likely the problem then - see item 3 of the list I provided.  If the code is executing while that movieclip is still in frame 1, which it most likely is when the file starts running, then it cannot target an object in frame 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
LEGEND ,
Jul 27, 2014 Jul 27, 2014

One way around this is to have that button in frame 1 but make it invisible in frame 1 and visible in frame 2.  YOu can use the visible property and set it to true or false as needed.

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
Community Beginner ,
Jul 28, 2014 Jul 28, 2014

I'm going to sound really dumb right now, and I'd like to apologize for it.. OK I made it invisible in frame 1, but that made it unclickable. Then I made it visible, but when clicked it turned invisible and went straight to frame 2, but the next button wouldn't appear. Sorry for being such a noob in flash.

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
LEGEND ,
Jul 28, 2014 Jul 28, 2014

Yes, an invisible object cannot be clicked.  If you only want it to be interactive in frame 2 then that should not be a problem.  It is when you get to frame 2 that you want to turn it visible.  You can do that either by making it visible in whatever function moves that movieclip to frame 2 or within the movieclip itself you can have commands in frames 1 and 2 that control its visibility.

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
Community Beginner ,
Jul 28, 2014 Jul 28, 2014

Aaaaaaaaaaaand I made it work. Thank you Ned. Greatly appreciate your help and patience. With that I even made it work with the array. Thanks again.

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
LEGEND ,
Jul 28, 2014 Jul 28, 2014
LATEST

You're welcome

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