Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add hyperlink to entire flash banner

Posted on 2010-09-08
17
Medium Priority
?
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

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!

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

730 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