AS3 linking URL
- Started
- Last post
- 6 Responses
- _niko0
sweet thanks everyone!
- kpl0
url = e.target.urlS;
navigateToURL(new URLRequest(url));MovieClip() part just mucks it up, we're using dynamic classes here so there's no need to type it.
- noiseisthis0
is but1 and but2 a movieclip, sprite, or button?
- has to be a movie clip, it wouldn't work with sprites or simpleButtons like that.kpl
- sixfngers0
yes this makes sense but carefull with the currentTarget.
that means if the but1 has a child in it for example a text field.
if you clicked on the button while the mouse is over the text field the MouseEvent.currentTarget would be the textfield not the button but the MouseEvent.target would still be but1 make sense
- _niko0
but1.urlS = "http://www.adobe.com";
but2.urlS = "http://www.google.com";
but1.addEventListener (MouseEvent.CLICK,f);
but2.addEventListener (MouseEvent.CLICK,f);function f(e:MouseEvent){
navigateToURL(new URLRequest (MovieClip(e.currentTarget) .urlS));
}
- _niko
does this make sense to anyone?
but1.urlS = "http://www.adobe.com";
but2.urlS = "http://www.google.com";
but1.addEventListener(MouseEvent...
but2.addEventListener(MouseEvent...function f(e:MouseEvent){
navigateToURL(new URLRequest(MovieClip(e.currentTa...
}
trying to put links on multiple buttons, should be pretty simple no?