|
-
Problem with my buttons, please help
OK, I really need help here. I am creating a flash file with 6 steps of instruction with buttons such as "next" and "previous" in it to move along the steps. After designing my layout and doing my actionscript3, I click "test movie". and then i receive the error #1009: cannot access a property or method of a null object reference. But the thing is that, I am able to click the first button on my screen and move to the next step, after that my button don't work anymore. Hope you guys would understand this.
Here are my actionscript:
stop();
startBtn.addEventListener(MouseEvent.CLICK, clickHandler1);
nextBtn1.addEventListener(MouseEvent.CLICK, clickHandler2);
previousBtn2.addEventListener(MouseEvent.CLICK, clickHandler3);
nextBtn2.addEventListener(MouseEvent.CLICK, clickHandler4);
previousBtn3.addEventListener(MouseEvent.CLICK, clickHandler5);
nextBtn3.addEventListener(MouseEvent.CLICK, clickHandler6);
previousBtn4.addEventListener(MouseEvent.CLICK, clickHandler7);
nextBtn4.addEventListener(MouseEvent.CLICK, clickHandler8);
previousBtn5.addEventListener(MouseEvent.CLICK, clickHandler9);
nextBtn5.addEventListener(MouseEvent.CLICK, clickHandler10);
previousBtn6.addEventListener(MouseEvent.CLICK, clickHandler11);
function clickHandler1(event:MouseEvent):void{
gotoAndStop(5);
}
function clickHandler2(event:MouseEvent):void{
gotoAndStop(12);
}
function clickHandler3(event:MouseEvent):void{
gotoAndStop(5);
}
function clickHandler4(event:MouseEvent):void{
gotoAndStop(19);
}
function clickHandler5(event:MouseEvent):void{
gotoAndStop(12);
}
function clickHandler6(event:MouseEvent):void{
gotoAndStop(25);
}
function clickHandler7(event:MouseEvent):void{
gotoAndStop(19);
}
function clickHandler8(event:MouseEvent):void{
gotoAndStop(31);
}
function clickHandler9(event:MouseEvent):void{
gotoAndStop(25);
}
function clickHandler10(event:MouseEvent):void{
gotoAndStop(37);
}
function clickHandler11(event:MouseEvent):void{
gotoAndStop(31);
}
Please help me and thanks a lot.
-
Senior Member
Probably one or more of the buttons is not there and that is why you get null.
- The right of the People to create Flash movies shall not be infringed. -
-
When that code is run only startBtn and nextBtn1 are on stage so as far as the code knows, the other's dont even exist...You need to make it so the other buttons are on stage at that time or else initilialize the later buttons as the become available.
-
i don't really understand what you are trying to say, sorry about that, I am very new to Flash, can you kindly explain it in easier way? if possible.
-
Senior Member
Are all your buttons listed in the script in the frame where this script is located?
- The right of the People to create Flash movies shall not be infringed. -
-
ohh rightt.. i understand now. finally it is working. Thanks a lot for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|