Solved

Add hyperlink to entire flash banner

Posted on 2010-09-08
17
387 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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
 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
SCCM 2012 - Deploy Flash 16 7,033
anti-download video publishing site? 6 617
File drag and drop 6 147
Cannot install Adove Flash player on Windows 2012R2 6 103
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
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…
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 what frame rate is, how to control it and what effect it has on the video.

828 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