I am trying to add the same button function to 2 different symbols in Flash. One is the logo and the other is text that I converted to a symbol that will show itself during the end scene.
I don't understand what I am doing wrong, but I am extremely new to Actionscript & Flash.
My code looks like this:
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.net.navigateToURL;
import flash.net.URLRequest;
myButton, txtButton.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
function onClick(e:MouseEvent):void{
navigateToURL(new URLRequest("http://www.true.land"), "_blank");
}
But I am getting this error:
Attempting to launch and connect to Player using URL C:\Users\Angela\Desktop\ASU\GIT 314\Assignment 7\AngelaRogers_Assignment7.swf [SWF] C:\Users\Angela\Desktop\ASU\GIT 314\Assignment 7\AngelaRogers_Assignment7.swf - 351066 bytes after decompression TypeError: Error #1009: Cannot access a property or method of a null object reference. at Button/frame1()[Button::frame1:7]
txtButton.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
thenmyButton.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
and you must have a myButton and txtButton elements available in the scene (make sure the movieclips are there and properly named) (otherwise you will have a null reference error (elements can't be found))) hth – George Profenzafunction onClick(e:MouseEvent)...
) (which you should, don't need to). you need to add the listener to different movie clips – George Profenza