Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add hyperlink to entire flash banner

Posted on 2010-09-08
17
Medium Priority
?
391 Views
Last Modified: 2013-11-11
Now that I'm done making a banner in flash, how do you add a hyperlink to make the entire banner clickable to a certain website? Anyone know?
0
Comment
Question by:dvcrdu
  • 6
  • 6
  • 3
  • +1
17 Comments
 
LVL 4

Expert Comment

by:betopa
ID: 33633255
You can create an invisible button. Invisible buttons are useful when you want to make the entire banner clickable without obscuring your graphics. Yust make an invisible button that has the same size as the animation, put it on the top of it and put your getURL action on that button.
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33634345
or simply add an event listener for mouse click events.

myThing.addEventListener(MouseEvent.CLICK, clickHandler);

then you have to make flex open the link:
http://board.flashkit.com/board/showthread.php?t=320672
0
 
LVL 19

Expert Comment

by:quizengine
ID: 33638511
If you're not sure how to make an invisible button, have a look here - http://www.flashfridge.com/tutorial.asp?ID=2

(I like this tutorial particularly, because the critical step is shown not as a static picture, but as an animation, making it much easier to understand)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dvcrdu
ID: 33641017
Ok betopa: great idea but I don't know how to implement it. ChristoferDutz:Do I add the code as you have it displayed? If so, how? quizengine: Tried the tutorial but came up with many errors, I am using CS5 and that tutorial seems outdated. Sorry guys, I am really new to Flash and I need more direction.

Thank you!
0
 
LVL 19

Expert Comment

by:quizengine
ID: 33641145
Here's another tutorial - a video tutorial - http://www.republicofcode.com/tutorials/flash/video/invisible_buttons.php

It's written in Actionscript 2, so if you want to use this example when you create your file, you will need to create a new document, with actionscript 2, rather than (what will be the default doc type) actionscript 3
0
 
LVL 4

Accepted Solution

by:
betopa earned 2000 total points
ID: 33641173
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33647308
Have a look at this:
http://www.adobe.com/devnet/actionscript/articles/event_handling_as3_03.html

The following code should achieve what you are looking for (It's ActionScript 3 Code. If it doesn't work, just post the version of Flash you are using):


stage.addEventListener(MouseEvent.CLICK, stageClick);

function stageClick(event:Event):void {
    getUrl("http://www.google.com");
}
0
 

Author Comment

by:dvcrdu
ID: 33676487
Ok, why is everyone's code messing up my entire project? I've been experimenting and every time I add some code to the invisible button, I get errors and when I test the movie nothing is looking right... any thoughts?
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33680311
How about posting your code, then I think we will be able to help you a lot better.
0
 

Author Comment

by:dvcrdu
ID: 33686281
I  keep getting this error:

Scene 1, Layer 'button',Frame 1, Line 4 1120: Abscess of undefined property button.


Heres my code:

import flash.events.MouseEvent;
import flash.net.URLRequest;

button.addEventListener(MouseEvent.CLICK, linkHandler);

function linkHandler(event:MouseEvent):void
{
       navigateToxxx(new URLRequest("http://www.ncstatefair.org/2010/index.htm"));
}

Any ideas on how to correct this?
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33689150
Could you have meant "Access" instead ob "Abscess"?
Well it looks like there is no variable called "button".

Have you tried my code from post #33647308? If you simply attach the event listener to the state, you won't have that problem.
0
 

Author Comment

by:dvcrdu
ID: 33692730
Yeah lets go with Access lol! I also tried your code and had the same error, I must be missing something.
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33692916
If you had been using my code, it would be impossible to get the exact same error as that doesn't use "button" and "stage" is a pretty global variable that should allways be accessable. But would you be so kind to post your code, so we can finally fix this for you? ;-)
0
 
LVL 4

Expert Comment

by:betopa
ID: 33694115
I think the name of your button is not just "button". Try changing its name to "button" or the code to your button name, or else... please post your code...
0
 

Author Comment

by:dvcrdu
ID: 33696690
Here is the code:
import flash.events.MouseEvent;
import flash.net.URLRequest;

button.addEventListener(MouseEvent.CLICK, linkHandler);

function linkHandler(event:MouseEvent):void
{
       navigateToxxx(new URLRequest("http://www.ncstatefair.org/2010/index.htm"));
}

Open in new window

0
 

Author Closing Comment

by:dvcrdu
ID: 33697202
THANK YOU!!! Forgot to name my instance.
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33698892
:-( Well thaks for no points :-(
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question