FORUMS: list search recent posts

Flash Photo Gallery problem

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
cynthia hokr
Flash Photo Gallery problem
on Dec 14, 2010 at 4:47:18 pm

I have created a gallery in Flash and I keep getting this error in the output tab:


TypeError: Error #1009: Cannot access a property or method of a null object reference.
at gallery_fla::MainTimeline/frame1()[gallery_fla.MainTimeline::frame1:2]
at flash.display::MovieClip/gotoAndStop()
at gallery_fla::MainTimeline/play1()[gallery_fla.MainTimeline::frame1:4]

The below is my code, please tell me what I am doing wrong here!!
Thank you,


stop();
btn1a.addEventListener(MouseEvent.CLICK,play1);
function play1(event:MouseEvent):void{
gotoAndStop ("image1a")
}
btn2a.addEventListener(MouseEvent.CLICK,play2);
function play2(event:MouseEvent):void{
gotoAndStop ("image2a")
}
btn3a.addEventListener(MouseEvent.CLICK,play3);
function play3(event:MouseEvent):void{
gotoAndStop ("image3a")
}
btn4a.addEventListener(MouseEvent.CLICK,play4);
function play4(event:MouseEvent):void{
gotoAndStop ("image4a")
}
btn5a.addEventListener(MouseEvent.CLICK,play5);
function play5(event:MouseEvent):void{
gotoAndStop ("image5a")
}


btn6a.addEventListener(MouseEvent.CLICK,play6);
function play6(event:MouseEvent):void{
gotoAndStop ("image6a")
}
btn7a.addEventListener(MouseEvent.CLICK,play7);
function play7(event:MouseEvent):void{
gotoAndStop ("image7a")
}
btn8a.addEventListener(MouseEvent.CLICK,play8);
function play8(event:MouseEvent):void{
gotoAndStop ("image8a")
}
btn9a.addEventListener(MouseEvent.CLICK,play9);
function play9(event:MouseEvent):void{
gotoAndStop ("image9a")
}
btn10a.addEventListener(MouseEvent.CLICK,play10);


Return to posts index

Brodd Nesset
Re: Flash Photo Gallery problem
on Dec 15, 2010 at 8:36:16 am

Apart from a missing chunk of code for btn10a :

Either: there is a typing error somewhere. Perhaps one button instance is called Btn10a (capital B), for instance.

Or: all of the buttons haven't appeared on the stage before the script tries to access them. The simple and crude solution to this is to move the script one frame later in the Timeline. I.e. place the buttons in frame 1 (and extend them to at least frame 2), then place the script in frame 2. Flash won't move it's playhead the frame 2 before all elements are drawn on Stage in frame 1. A simple insurance.



Not everything that can be counted counts, and not everything that counts can be counted.



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]