i suck at flash
- Started
- Last post
- 6 Responses
- leftwave
... and can't find an easy way to do this online, but am pretty sure there is a way.
i'm making a flash movie in CS3 with a bunch of different movieclips. i want to be able to link a few of the movieclips to URL's. is there a way to do this without making them buttons and just somehow linking the whole movieclip??
thanks!
- feel0
you can always give an onRelease function to a movieclip. like this:
mc.onRelease = function () {
getURL("..");
};
- leftwave0
i tried exactly that, but it's not working. i just stuck the actionscript on a new layer in the movieclip in the first frame. is that correct?
- feel0
no
you should do this action on the timeline the movieclip is in, not inside it.otherwise the code should be:
this.onRelease = function () {
getURL("..");
}
- fyoucher10
1. Give movieclip an instance name. Go to the "Properties Inspector" (the same GUI panel where you change Alpha, Tint, etc). There's a text input field where you enter a movieclip "instance name".
2. On a separate layer in the same timeline AND on a frame that the movieclip (i.e. if your movieclip doesn't appear until frame 50, then your script should be on frame 51 or higher. If your movieclip appears in the very first frame, then you can add code in the very first frame.).
3. Then add feels code, replacing "movieclipInstanceName" with the name of your movieclip:
Actionscript 2.0 example:
movieClipInstanceName.onRelease = function ():Void {
getURL("www.google.com", "_blank");
}Actionscript 3.0 example:
myButton.addEventListener
(MouseEvent.CLICK, myButtonFunction);
function myButtonFunction (event: MouseEvent) {
var myUrl:URLRequest = new URLRequest ("http://www.google.com");
navigateToURL(mUrl);
}- *** FYI, I added extra line breaks and extra spaces so code wouldn't get cut off in herefyoucher1
- CyBrain0
Which language are you using? AS2 or the Devil's Bible?
- leftwave0
feel & fyoucher1, thank you so much for these very clear instructions. this makes perfect sense and works beautifully!!!