Solved

Add hyperlink to entire flash banner

Posted on 2010-09-08
17
385 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
 

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 500 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Does Flash have a Firefox problem? 5 312
Stock Videos 17 326
Embedded Webpage Videos don't auto play on Windows 7 1 106
You Tube Videos not playing 9 116
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now