HI All,

I apologize for my wordiness up front. There really is not a lot of info
available on this so I wanted to be as detailed as I could be.

I just had a similar experience and had been dealing with Flashers mailing
list and have to say many people did not have a solid answer on this. I
myself have four different (supposed) Flash manuals and only one of them
(Flash 4 Bible) even has the word javascript in its index.

My scenario was this:  I had a client who wanted a site where there was a
flash animated map. This map would contain country names which would link to
documents. There were six or seven different sections of the site all
needing the map, but each map needed to point to a different page. I thought
holy sh*t! Now I need to create seven of these maps and even worse maintain
them.

What I was able to do was create a single map and pass javascript variables
to create my various URLs. Now the same map is loaded in each section of the
site but my variable change the page these maps point to. I tried the txt
file routine but there are caching implications with flash that have to be
worked around. Javascript is the way to go...at least in my case.

Here is what I did...

1. You need make sure the "name" is set in your EMBED tag code and "id" is
set in your object code that is generated by flash. I went into the code and
just did this by hand. You also MUST have the attribute
'swliveconnect="true"' in your EMBED tag or netscape will fail to pick up
the variable (this is something I learned the hard way).

2. After your Flash code in your page place in a javascript like the one
that follows:

<script language="JavaScript">
<!--
var movie = window.document.flatmap;
movie.SetVariable("/Vars:link", "uwtools");
//-->
</script>

Line 1: What is happening is I first set a variable (var) with the name
movie which is my flash movie object which I called "flatmap" - this is
where javascript will need to read the name/id attribute I mentioned
earlier.

Line 2: The SetVariable Method of flash is initiated for the movie. The
required areguments for this funtion are the 'name' of the variable (I have
my variable called "link" which is in a movie clip called "Vars"). The
second argument is the value I want to pass to my varable - in my example
the name of the page I want all links to point to - 'uwtools'.

What I experience is that you need to place this after the flash code or
else your object won't yet exist and you will get javascript errors (object
does not exist). You can probably place the code in the head of your
document as a function but you would need something to then trigger the
function. I just avoided that. 

Within my Flash file my linked buttons have the following code:

On (Press)
      Get URL ("/cfaiuenv/"&/vars:link&".cfm")
End On

When you create your links in flash they must be set as expressions (not as
string literals). In my url the code "&/vars:link&" is where my page name is
passed in via the 'link' variable. The other junk is stuff I have coded in
for my particular site.

My experience with performance is that maybe once out of every 10-15 times I
click on a link the variable doesn't seem to pass. I have not isolated the
cause. I might need to add some code within Flash to grab/test for variable
info but I currently have no solution. It may be an abberation. Does anyone
have any ideas??

Try this link as well, it talks about Flash methods. Could be a little more
details though:

http://www.macromedia.com/support/flash/publishexport/scriptingwithflash/scr
iptingwithflash_03.html

Brian Kortland
AIU E-Business
AIU URL: http://aignetprod.aig.com/cfaiunet/
tel 212.770.7617, fax 212.968.1386
[EMAIL PROTECTED]


Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to