Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Adding a hyperlink to a flash movie

Posted on 2005-03-09
6
Medium Priority
?
1,109 Views
Last Modified: 2008-02-01
I have created a flash movie (.swf) in Macromedia Flash MX.  It's just a few of our products that fade from one to another and is featured on our homepage.

However, I cannot work out how to add a hyperlink to this movie so that the user can click on it and be taken to the products page.  I do not wish to have multiple links for each item shown, just one link regardless of which item is shown.

The code I have used to include the movie is:

<script language=JavaScript1.1>
          <!--
          var MM_contentVersion = 6;
          var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
          if ( plugin ) {
                    var words = navigator.plugins["Shockwave Flash"].description.split(" ");
                   for (var i = 0; i < words.length; ++i)
                   {
                    if (isNaN(parseInt(words[i])))
                    continue;
                    var MM_PluginVersion = words[i];
                   }
               var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
          }
          else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
             && (navigator.appVersion.indexOf("Win") != -1)) {
               document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
               document.write('on error resume next \n');
               document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
               document.write('</SCR' + 'IPT\> \n');
          }
          if ( MM_FlashCanPlay ) {
               document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
               document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ');
               document.write(' width="330" height="380">');
               document.write(' <param name="WMode" value="Transparent">  ');
               document.write(' <param name="movie" value="flash/fadingallbrands.swf">  ');
               document.write(' <param name="quality" value="high">  ');
               document.write(' <embed src="flash/fadingallbrands.swf" width="350" height="406" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">');
               document.write(' </embed>');
               document.write(' </object>');
          } else{
               document.write('<div align="center"><img src="Images/noflash.png" width="315" height="200" border="0" usemap="#flash">');
          }
          //-->
                              </script>

Please can anyone point me in the right direction.

Thanks.
0
Comment
Question by:rvr_1
6 Comments
 
LVL 18

Assisted Solution

by:Billystyx
Billystyx earned 800 total points
ID: 13501499
Inside the swf movie, in your .fla, write some text. Then convert it to a button (right-click then choose convert to symbol, and choose button).
Then click on the button you have created, open the action script editor and type this:
on(release){
getURL("www.mywebsite.com");
}
save your swf and use that in your page, it will then open the page you want, like a hyperlink(obviously change the address).
If you want it to change colour when mouse floats over, edit the button by rightclick on it and choose edit,
you should see 1 keyframe. rightclick in the space next to the first keyframe and choose insert keyframe.
In frame 2 change the colour of the text to a hyperlinky colour.
Is this what you are looking for?
another alternative is to add an actual hyperlink insde flash - it is possible.
Just can't remember how ... if you're still having trouble tomorrow I will look it up for you.
Billystyx
0
 
LVL 16

Accepted Solution

by:
sam85281 earned 1200 total points
ID: 13502154
You can make the whole movie a hyperlink like this:

1. Open your fla
2. draw a rectangle over your entir movie
3. Make sure that rectangle is highlighted(selected)
4. press F8
5. Click the button radio circle, name it anything
6. Right click the rectangle and choose edit from the menu.
7. On the timeline, selct frame 1 and then drag it to frame 4.  Frames 1-3 should be empty
8. Go back to the main timeline
9. Your new button will look like a transparent blue rectangle over the entire movie.
10. Select the button
11. In the action panel put:
on (release) {
getURL("YourLinkGoesHere");
}

Now if they click anywhere on the movie it will go to the link.

-Sam
0
 
LVL 11

Expert Comment

by:Buffon
ID: 13503776
you can also do it with html text:

this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160, 22);
my_txt.html = true;
my_txt.htmlText = "<a href='www.google.com'>here</a>";

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Assisted Solution

by:Billystyx
Billystyx earned 800 total points
ID: 13503982
That's the other way - thanks Buffon:)
Billystyx

0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13503985
...and the more accurate method too (in terms of the fact that it is actually a hyperlink).

Billystyx
0
 

Author Comment

by:rvr_1
ID: 13536234
Got it working now - thanks for your help!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to how to record live broadcast.
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.

578 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