I have created a Flash banner but need to add a link to another website.
I don't want to create a button to trigger the link but rather have the whole banner clickable.
How is this achieved? I am using Flash CS4.
Page 1 of 1
As3 Code For Url Link
#2
Posted 15 May 2009 - 02:36 AM
Hi gribble,
All you do is make sure the banner is a button symbol so
Right click the Banner/Header click Convert to Symbol and choose Button then click OK
Then give the Banner/Header an Instance name of what you like for example I gave mine banner_btn
Then create a new layer above all your other layers called actions and on frame 1 of the actions layer press f9 then
enter this CODE
banner_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.yourwebsiteurl.com/"));
}
The RED is what you can change but banner_btn needs to be the same as you gave the instance name of the banner
and the yourwebsiteurl.com which is in red too needs to be the URL you want to give it..
And thats it
If you get stuck send reply
Regards,
Aaron
All you do is make sure the banner is a button symbol so
Right click the Banner/Header click Convert to Symbol and choose Button then click OK
Then give the Banner/Header an Instance name of what you like for example I gave mine banner_btn
Then create a new layer above all your other layers called actions and on frame 1 of the actions layer press f9 then
enter this CODE
banner_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.yourwebsiteurl.com/"));
}
The RED is what you can change but banner_btn needs to be the same as you gave the instance name of the banner
and the yourwebsiteurl.com which is in red too needs to be the URL you want to give it..
And thats it
If you get stuck send reply
Regards,
Aaron
#3
Posted 19 May 2009 - 01:39 AM
Thanks Aaron. Works like a charm but how backward-compatible is the code?
I am dealing with people who are likely to still have Flash Player 7!
I am dealing with people who are likely to still have Flash Player 7!
Share this topic:
Page 1 of 1
Page 1 of 1
| Trackback URL | Trackback Date | Total Hits |
|---|---|---|
Page 1 of 1
| Topic | Started By | Stats | Last Post Info | |
|---|---|---|---|---|
![]() |
Posting Code
|
unitedcraig ![]() |
|
|
![]() |
Wordpress Is Too Helpful And Deleted My Blog Page Code :(
Can I disable all of its code helpers? |
cosmicbdog ![]() |
|
|
![]() |
Copy Code
|
welshstew ![]() |
|
|
![]() |
Flyouts Or Fold Outs What Are They And How Do You Code It
I don't mean the Eric Myers css hover thingy |
Sharron ![]() |
|
|
![]() |
Tutorial Link
|
thewal ![]() |
|
|
Sign In »
Register Now!
Help



















