Copy link to clipboard
Copied
Hi, I have an animation with 4 buttons leading to 4 different frames labelled a,b,c and d.
My buttons are named a_btn, b_btn, c_btn, d_btn
Of recent the first button is always giving me a a Error #1009 though it has been working for the last last year in the same animation.
the rest of the buttons work with no problem even though the code is same- help
Usha
Error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at hdbcThrombophilia_fla::_5_extrinsicpathway_birdseye_16/frame1()
at flash.display::MovieClip/gotoAndStop()
at hdbcThrombophilia_fla::_5_extrinsicpathway_birdseye_16/fl_ClickToGoToAndStopAtFrame_a()
my code is
a_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_a);
function fl_ClickToGoToAndStopAtFrame_a(event:MouseEvent):void
{
gotoAndStop("a");
}
b_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_b);
function fl_ClickToGoToAndStopAtFrame_b(event:MouseEvent):void
{
gotoAndStop("b");
}
c_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_c);
function fl_ClickToGoToAndStopAtFrame_c(event:MouseEvent):void
{
gotoAndStop("c");
}
d_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_d);
function fl_ClickToGoToAndStopAtFrame_d(event:MouseEvent):void
{
gotoAndStop("d");
}
Hi Usha!
I took a look at your file...very complicated.... first off... its a good idea to ALWAYS use different instance names for your buttons.... and different label names for your labels. Im actually surprised you do not have more errors.
This is a very simple fix.... if you look at your file you will see the your A label is the ONLY label that ALSO has a STOP ACTION ON IT....
so when in b or c... and you click A... a says go to and PLAY a... but on a is a STOP action....
so I just moved the A
...Copy link to clipboard
Copied
Not the exact solution to your issue, but have a look at this article https://code.tutsplus.com/tutorials/quick-tip-how-to-debug-an-as3-error-1009--active-9354 for insights
Copy link to clipboard
Copied
Hello,
check to see what frame the code is on... and in that same frame... make sure that ALL the instances of these buttons are also on the stage on that same frame, and of course make sure it has the correct instance name. But its letting you know that it is not able to find that instance....
hope that helps... let me know how it works out!
cheers,
mark
Copy link to clipboard
Copied
Mark
Thanks. The code is in the topmost frame.
All button instances are on the same frame and named properly.
It is quite frustrating because it works some times, however when I reopen the animation to fine tune something unrelated to buttons - I notice it does not work.
It seems like a glitch in the Animate itself.
thanks again
Usha
Copy link to clipboard
Copied
you can share the file and I can take a look at it you would like.
Copy link to clipboard
Copied
I would share the file ,except I do not know where to load it or send.
Usha
Copy link to clipboard
Copied
Make sure the buttons are availabe throughout the entire timeline or that you don't have keyframes duplicating your buttons or something like this.
And is there any other code running from inside some Movie Clip?
Anyway, if is not a problem, upload a picture of your timeline and code or upload the FLA itself.
Copy link to clipboard
Copied
send it to mark@headtrix.com (might want to zip it first)
Copy link to clipboard
Copied
Hi Usha!
I took a look at your file...very complicated.... first off... its a good idea to ALWAYS use different instance names for your buttons.... and different label names for your labels. Im actually surprised you do not have more errors.
This is a very simple fix.... if you look at your file you will see the your A label is the ONLY label that ALSO has a STOP ACTION ON IT....
so when in b or c... and you click A... a says go to and PLAY a... but on a is a STOP action....
so I just moved the A label in the MC named "5 extrinsic pathway_birdseye" over to frame 2.... and seems to work fine
let me know if that helps!
cheers,
mark