Skip to main content
Known Participant
August 29, 2011
Question

Error 1009 when compile to Air 2.6

  • August 29, 2011
  • 1 reply
  • 702 views

I have three movieclips, imported as part of a FLA file  from inDesign.

There are 3 frames in the movie labeled, page_one, page_two, and page_three

There is one movieclip on each frame labeled as follows:

page_one had movieclip spread_one

page_two had movieclip spread_two

page_three had movieclip spread_three

there is actionscript on each frame:

on frame 1, (label page_one):
stop();

spread_one.addEventListener(MouseEvent.CLICK, moveme1);
function moveme1(e:MouseEvent):void{
   
         gotoAndStop("page_two");
       
}

on frame 2 (label page_two):

stop();

spread_two.addEventListener(MouseEvent.CLICK, moveme2);
function moveme2(e:MouseEvent):void{
    
          gotoAndStop("page_three");
        
}

on frame 3 (label page_three):

stop();

spread_three.addEventListener(MouseEvent.CLICK, moveme3);
function moveme3(e:MouseEvent):void{
    
          gotoAndStop("page_one");
        
}

when I compile in flash, it works.

when I compile in air 2.6 I get this error after I click on frame 3 (page_three), in spread_three:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at objecthood_fla::MainTimeline/frame1()[objecthood_fla.MainTimeline::frame1:5]
    at flash.display::MovieClip/gotoAndStop()
    at objecthood_fla::MainTimeline/moveme3()[objecthood_fla.MainTimeline::frame3:8]

frame1:5 is the line, which works the first time it is clicked on frame 1:

spread_one.addEventListener(MouseEvent.CLICK, moveme1);

frame3:8 is the line:

spread_three.addEventListener(MouseEvent.CLICK, moveme3);

I created another 3 page test spread in inDesign, with only a rectangle on each page and exported as FLA.

I used the same code as above and it compiled fine in both air and flash.

Does anyone have any clues?

thanks

e

This topic has been closed for replies.

1 reply

Inspiring
August 30, 2011

I don't know if this will help, but try moving stop(); to the end of the code. It might be only executing once and then not executing again so it can't find your variable when you need it.

em2744Author
Known Participant
August 30, 2011

thanks.

it didn't make a difference.

it is somethng odd, as it works with  the 3 rectangle pages.

and the error only occurs on page 3, on click.

it produced a redraw error before. at least now it is giving an actual numbered error. but I do not know what the source is. as the same code works when the movieclips are just rectangles.

e

em2744Author
Known Participant
August 30, 2011

I fixed it. it was not the code. it was the use of text. This time when exporting, I  turned the TLF text to pixels, and now it compiles fine. I isolated the problem by dismantling each item in the indesign spread, and seeing when the problem occured. once I removed the type, it had no issues. I was using hanging indents. Maybe that was the issue. All I know is once I turned off the TLF text option, there are no problems.It is sad to lose that feature. but at least it works, and I would rather have my type look well formatted with hanging intents, and correct kearning, even if i have to rasterize it first.

geez. that was fun.