PDA

View Full Version : Null errors due to button changes. Please Help!



gl0tch
July 23rd, 2008, 12:07 AM
Hello -

I'm really stuck. Can someone please help me? I have a movieclip that needs to "dim" (change in alpha value) when you hover above it. Easy. However, while it's opacity decreases some text also needs to appear directly above the dimmed movie clip.

My solution was to place an invisible button over the movieclip. This button has the text on its Over state. So far so good.

However, when I click the button so I can go somewhere else in the timeline, I'm getting the following error:

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

Here's my code:



//Go to frame "Test" when the invisible button is clicked.
function clickFunction(evt:Event):void {
gotoAndPlay("Test");
}

invisibleButton.addEventListener(MouseEvent.CLICK, clickFunction);

//Dim the menu icon movieclip when you hover
function overFunction(evt:Event):void {
movieClip.alpha = 0.2;
}

invisibleButton.addEventListener(MouseEvent.MOUSE_ OVER, overFunction);

//Reset the movie clip opacity when you exit
function outFunction(evt:Event):void {
movieClip.alpha = 1.0;
}

globeButtonOne.addEventListener(MouseEvent.MOUSE_O UT, outFunction);

stop();


I think it has something to do with the alpha reset needing to happen before running the clickFunction. Please help!

gl0tch
July 23rd, 2008, 12:23 AM
Please let me know if you need the FLA file. I'll gladly upload it somewhere for you to check it out, if that helps!

Thanks again

gl0tch
July 23rd, 2008, 12:41 AM
FWIW, I guess I can do this just by converting each movieclip to its own button symbol (using alpha changes and text on layers in the Over state keyframe), but won't this increase the load?