Google Answers Logo
View Question
 
Q: How to make a Flash Movie a link ( Answered,   0 Comments )
Question  
Subject: How to make a Flash Movie a link
Category: Computers > Programming
Asked by: g8z-ga
List Price: $30.00
Posted: 27 Apr 2003 15:31 PDT
Expires: 27 May 2003 15:31 PDT
Question ID: 196259
Hello,

I have a small (100 x 200 pixel) Macromedia Flash movie, and I want to turn it
into a link. I.e., if the user clicks anywhere in the frame of the
movie, it will take them to some URL.

E.g.

<a href=http://www.mysite.com>
<OBJECT classid="..." codebase="...">Flash Movie Params, etc.
</a>

However, I do NOT want to embed the link in the movie itself using
event handlers in combination with the Actionscript getURL method. I
know that this is the most obvious way to do what I want, but this
will not work for the particular application that I need because as of
yet I have not found a way to assign a mouse event to an externally
loaded movie in which the movie is a mere JPEG file.
(https://answers.google.com/answers/main?cmd=threadview&id=194991
relates to this problem)

I was thinking that there may be some way to assign a URL to the movie
by placing it into a <div> tag and assigning some Javascript to it. If
Javascript is used, then I need it to work in IE 5+ and Netscape 6+
for Mac and PC.

Thanks,
Darren

Request for Question Clarification by kyrie26-ga on 30 Apr 2003 22:26 PDT
Hi g8z-ga,

You mentioned in your other question that "for reasons not stated" you
do not want to load the image into a movie container. It will be very
difficult to control your loaded image otherwise (using your current
method). I have successfully found a way to enable your mouse-click
link (plus whatever mouse events you would like assigned), however the
image needs to be loaded into a movie container. This will be achieved
within the Flash file, no need for external Javascript. My experience
with Flash in particular and with Web Development in general tells me
that for many reasons, you want to be as object-based as possible, and
this means that you should use the movie container; however I'm not
sure what your limitations are, perhaps you might like to share them
and we could work around those instead.

I should also mention that I've worked with this problem before and
there is *NO* way absolutely to "link over" Flash in
HTML/DHTML/Javascript. Even with <div> tags and multiple (cascading)
layers, the Flash movie always appears on top, and there is no way to
assign "onClick" events to the OBJECT or EMBED tags. So your only
recourse is to enable the link within Flash.

What do you think? Thanks.

kyrie26-ga

Clarification of Question by g8z-ga on 01 May 2003 07:58 PDT
hi,

Thanks for looking at my question. The reason that (I think) I need to
have the JPG loaded into the _root layer is that when I try to set the
movie width and height via Javascript, the JPG no longer takes up the
entire width and height of the movie, or it gets distorted, if it's
placed into a movie clip container.

The site that this is for is:
http://www.michael.humphries.com/pages/gallery.html

Those thumnail images are being generated by passing in a JPG filename
to a movie, and each movie is having it's width and height set
uniquely. If you look at the Javascript code, you'll see:

	list[i++] = "A-Hero's-Garden.jpg,180,144";
	list[i++] = "Abandoned-Beauty.jpg,180,141";
	list[i++] = "Antique-Wagon.jpg,180,146";
	list[i++] = "Autumn-Breeze.jpg,180,135";
	list[i++] = "Easy-Does-It.jpg,180,140";
	list[i++] = "Easy-Rider.jpg,180,136";
	list[i++] = "Fresh-Picked.jpg,180,134";

I'm basically looping through the list[] array, and using these three
values as the image src, flash movie width, and flash movie height.

At the moment you can see that the image name is the link to the
larger page, but I really need to make the actual image the link to
the larger page.

Now, I would be totally willing to scrap Flash altogether for this
project and just make everything a stand-alone JPG image, but I tried
that and on some older Macintosh systems, the images appear very
'washed-out' - I.E. much brighter and with lower contrast than they
should. I have been saving the images from Photoshop using the Save
for Web feature, but I can't seem to make the images look consistent
across all the browsers and platforms that I normally test on (Mac OS
X, Mac OS 9, Windows XP/2000, Windows ME, Netscape 6 & IE 4.x). If
they look good on a Mac, they look too contrasty on a PC. If they look
good on a PC & Mac OS X, they look bad on OS 9, etc. For some reason,
when we passed the images through Flash, they looked ok on every
platform.

- Darren
Answer  
Subject: Re: How to make a Flash Movie a link
Answered By: kyrie26-ga on 01 May 2003 15:26 PDT
 
Hi there g8z-ga,

Thank you for your question. As a Flash and Web developer, I find this
an exciting challenge. I believe I may have the solution you are
looking for. I was unable to go to the link you provided, but I think
I understand your objective well enough.

My solution involves the use of a movie clip, called ContentLoadPoint,
which is only a pixel in size, and located on the top left hand
corner. The Actionscript in the first frame calls loadMovie
accordingly :

ContentLoadPoint.loadMovie (path, 0);

I've also added another layer above the image layer, called
trans_button, and created a rectanglular Button that matches the size
of the entire document. I made this a Symbol, and set its Alpha value
to 0 so that it is transparent. The Actionscript assigned to this
object is as follows :

on (release) {
	getURL("http://www.cnn.com", "_blank");
}

...where the URL is whatever you choose.

This in effect loads the JPG image into ContentLoadPoint, and then the
transparent button layer allows you to link to the URL.

Now I understand your problem when you try publishing it. Since the
loaded image size is variable, when you publish it, the movie will
retain the total document size of 360 X 360, or if you try modifying
this in your OBJECT and EMBED tags, then it will scale it down,
retaining the "whitespace" of the document and reducing (distorting)
the actual size of the image, which is not what you want.

The solution lies in your publishing properties. You want Javascript
(or, better yet, your server-side script) to dynamically set the
OBJECT and EMBED parameters to the image dimensions, AND you want to
set "scale=noscale" in the EMBED tag. This will prevent the image from
scaling. You will also want to align the movie to the left and top.
The complete OBJECT tag is as follows :


<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
 WIDTH="180" HEIGHT="138" id="loader" ALIGN="">
 <PARAM NAME=movie VALUE="loader.swf"> <PARAM NAME=loop VALUE=false>
<PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=noscale>
<PARAM NAME=salign VALUE=LT> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED
src="loader.swf" loop=false quality=high scale=noscale salign=LT
bgcolor=#FFFFFF  WIDTH="180" HEIGHT="138" NAME="loader" ALIGN=""
 TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>


I have modified your files accordingly, and a working version can be
downloaded from : www.jobsvolution.ca/flashtest.zip . Try it!

If this does not solve your problem please post a Request For
Clarification and we'll try to figure out some other avenue. However
I'm pretty sure this will do the trick for you. I wish you all the
best of luck! Thank you for using Google Answers.


Best regards,

kyrie26-ga

Request for Answer Clarification by g8z-ga on 01 May 2003 17:10 PDT
hi kyrie26-ga,

Thanks for the great answer! It appears to do what I want, except that
I can't seem to get it working in anything but Internet Explorer for
Win XP. I need to get it to work in Netscape 6.x, too.

I've implemented it at:

http://www.michael.humphries.com/pages/gallery.html

Since it works in IE, I would assume that there are no syntax errors,
but instead a Flash tag or Param, or perhaps a Javascript command,
that isn't supported in Netscape 6. I suspect that it's not my
Javascript, because I was able to get it working before (without the
getURL in the Flash movie), using the same Javascript that I have now.
So I'm thinking that there is some aspect to the Flash <object>
section that isn't supported.

Could you take quick peek at the code behind that page and let me know
if there's anything that I can do to make this work in Netscape 6?

Thanks,
Darren

Request for Answer Clarification by g8z-ga on 01 May 2003 18:37 PDT
hi kyrie26-ga,

As an experienced Flash developer, would you also be able to look at
this question that I posted:

http://answers.google.com/answers/main?cmd=threadview&id=197976

and let me know if it's:

a) doable and easy (I suspect not, but maybe I overlooked something
obvious?)
a) doable, but complex and may require that I offer more $ for a
solution, or
b) not doable, or at least no doable in a realistic amount of time or
$

- Darren

Clarification of Answer by kyrie26-ga on 01 May 2003 19:15 PDT
Hello Darren,

I am in the process of downloading and installing Netscape 6. In the
meantime, please have a look at this link :

http://www.htmlteacher.com/xhtml/elements/multimedia/elements/examples/object/objectexamples.shtml

It says "Netscape 4 & 6 and Opera 6 will ignore the <object> element
and read the <embed> element". That may be a possible clue.

Also, a quick look at current browser statistics (
://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=browser+statistics
) tells us that Netscape 6 is very much in the minority of browser
use, less than 1%. It may not be worth your time trying to make your
code compatible for it.

In any case, I will proceed with download, install and testing on
Netscape 6, and will let you know of my findings ASAP. Thanks for your
patience.


Regards,

kyrie26-ga

Request for Answer Clarification by g8z-ga on 01 May 2003 19:24 PDT
hi,
I'm tinkering with the Flash tags right now, but so far no luck. I
completely agree that Netscape 6 is not worth the trouble, but
unfortunately I'm in the unlucky situation whereby the person I've
been hired by has been using Netscape for a long time and refuses to
use anything else. :(
- Darren

Clarification of Answer by kyrie26-ga on 04 May 2003 19:01 PDT
Hi there Darren,

In response to your question on the Flash chat problem - I took a
quick look at it, and yes, the quick answer is, it IS doable, however
I would need to have a better idea of how the application works before
I can prescribe how to display graphical "emoticons" in your text. As
for implementing such a solution, it would definitely be worth more
than $10 for information on how to accomplish this. Some questions
would be, how is the text currently being generated (I'm sure there's
lots of Actionscript involved), how does it scroll, what kind of
objects are in place, etc etc. So yes, it is doable but takes quite a
bit of figuring out.

I am still working on getting the Flash image loader to work in
Netscape 6. Thanks for your patience.


kyrie26-ga

Clarification of Answer by kyrie26-ga on 05 May 2003 18:40 PDT
Hello again Darren,

After much tinkering, I wasn't able to get the Flash loader to work on
Netscape 6 either. I did some research and found that Netscape 6 does
not support communication between the HTML page and Flash objects.
This is why we are unable to "tell" the Flash loader what dimensions
to set. Apparently this has been corrected for version 6.2 and above.

From my experience Netscape 6 is very problematic and deviates from
published standards. Netscape 7 seems to be a whole lot better in
displaying things "correctly" (almost identical to MS-IE).

Have a look at the documentation I found :

+-----------------------------------------------------------------------------------+

Macromedia - Flash TechNotes FSCommand problems in Netscape 6 and
Mozilla
http://www.macromedia.com/support/flash/ts/documents/mozilla_fscommand.htm

" Macromedia Flash Player's FSCommand and JavaScript methods allow for
communication between a Macromedia Flash movie and a Web browser. In
Netscape browsers, this communication has been facilitated by
Netscape's LiveConnect technology.

Netscape 6, the latest version of Netscape's browser (as of April
2001), did not implement LiveConnect, and did not support Macromedia
Flash's FSCommand or JavaScript methods (see Netscape 6 Developer
Release Notes for information on Netscape 6's architecture.)

Update: Netscape 6.2 adds LiveConnect support. FSCommand or JavaScript
methods can now be used with Netscape 6.2 if Macromedia Flash Player 6
r40 (or later) is installed. "

+-----------------------------------------------------------------------------------+

Macromedia - Flash TechNotes Macromedia Flash Player 6 Update (release
79)
http://sdc.shockwave.com/support/flash/ts/documents/flashplayer_r40.htm

"XPConnect for Netscape 6.2 
LiveConnect is a browser technology that allows Macromedia Flash
Player to communicate with the hosting HTML page. When the
architecture of LiveConnect changed with Netscape 6, this
functionality was lost in that browser. The new technology is called
XPConnect. Macromedia has modified the Macromedia Flash Player to
support XPConnect in both Netscape 6.2 and later and Mozilla 1.0 and
later, enabling use of features such as FSCommand and
javascript-to-Flash communication with these browsers."

+-----------------------------------------------------------------------------------+


For example, a visit to the official Flash site at
http://www.macromedia.com/software/flash/ will display a message "You
may not have everything you need to view certain sections of
macromedia.com". I've also seen other Flash sites (ie. www.moock.org)
where the Flash doesn't display properly using Netscape 6.

Clicking on the "recommended browsers" link from the Macromedia Flash
site will present several options, one of which is the latest Netscape
version (7.0). I have downloaded this and it runs your loader with no
problems at all.

Here is the link for Netscape 7.0 :

+-----------------------------------------------------------------------------------+

Netscape 7.0
http://channels.netscape.com/ns/browsers/download.jsp

+-----------------------------------------------------------------------------------+


My proposed solution is to put a browser sniffer in your code
(Javascript) and detect for Netscape 6 versions that do not support
LiveConnect (6.0, 6.1), and to provide a link to the Netscape download
page. There are plenty of Javascript browser sniffers out there :

+-----------------------------------------------------------------------------------+

Google Search : javascript detect browser version
://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=javascript+detect+browser+version

+-----------------------------------------------------------------------------------+

Alternatively you could use your current method (straight JPEGs) when
the detected browser is non-LiveConnect compliant. This should
represent only a very tiny minority of Web users, and I would not be
surprised if many Netscape 6 users have upgraded to 7 already.

Hope that helps! Let me know what you think.


Regards,

kyrie26-ga
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy