|
-
rotating banner with 2 outward links
Hi there,
Flash noob here using cs3/as3. I'm trying to create a simple banner which fades between 2 images, looped. (This I can do!). What I'd like is to have each image link to a different url.
I've tried changing the images to buttons with the following actionscript:
on (release) {
getURL('http://www.mysite.com', '_self');
}
but get the following error: Mouse events are permitted only for button instances even though they are buttons!
I thought this would be really simple, but obviously not! Any ideas are gratefully received.
Thanks for your help in advance
-
on (release) {
getURL('http://www.mysite.com', '_self');
}
Your code will not work with Actionscript 3.0. Take a look at this tutorial for Actionscript 3.0: http://www.ilike2flash.com/2009/06/open-url-in-as3.html
-
thanks. I'm getting the following error now:
Description:
'{' expected
Source:
function openurl(event:MouseEvent):void
Even though the '{' is there
Last edited by facio; 11-19-2009 at 01:00 PM.
-
 Originally Posted by facio
thanks. I'm getting the following error now:
Description:
'{' expected
This basically mean you have a '{' missing. You may have missed out the curly bracket.
-
It's there. I copied it directly from the site. This is what I have:
recruit.addEventListener(MouseEvent.CLICK, openurl);
function openurl(event:MouseEvent):void {
var url:URLRequest = new URLRequest("http://www.ilike2flash.com");
navigateToURL(url, "_blank");
}
Does it matter if there are single or double quotes?
-
What other code are you using?
-
that's it. I have one button with that code in and another with exactly the same except for the button name and it pointing to a different url.
with both buttons it gives me the same '{' error and although the cursor changes, nothing happens when it's clicked on
-
This is very odd. Can you upload your fla?
-
-
 Originally Posted by facio
Hi there,
Flash noob here using cs3/as3. I'm trying to create a simple banner which fades between 2 images, looped. (This I can do!). What I'd like is to have each image link to a different url.
The file you uploaded is using Actionscript 1.0, you are not using Actionscript 3.0. So, using Actionscript 3.0 code is giving your errors.
-
That's strange because I chose the document from the 468 x 60 template. i would have thought this would have defaulted to as3?
Is there any way of changing to as3 retroactively?
-
Just created a new file and started again. Now I'm getting the error:
1021: Duplicate function definition. function openurl(event:MouseEvent):void
I'm now assuming you can't have 2 openurl in the same scene?
-
You can't have two function with the same name.
Change one of the functions to
Code:
yourInstanceName.addEventListener(MouseEvent.CLICK, openurl2);
function openurl2(event:MouseEvent):void {
var url2:URLRequest = new URLRequest("http://www.ilike2flash.com");
navigateToURL(url2, "_blank");
}
-
Thnaks very much for your help.
I'm now getting:
ReferenceError: Error #1065: Variable recruit is not defined.
Eventhough (as you can see in the attached) it is defined... CercoFlashbanner1.fla
-
This is an obvious error, you have not given an instance name to the recruit button.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|