Solved

Add hyperlink to entire flash banner

Posted on 2010-09-08
17
382 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
free flash maker 5 196
how can flash builder 4.X version make use of java 8 5 222
You Tube Videos not playing 9 106
Play RTMP without Flash 3 273
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 know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

707 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

17 Experts available now in Live!

Get 1:1 Help Now