Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: Flash, layers and JavaScript (part II)
From: BJ Hoffpauir
Date: Thu, 1 Jun 2000 20:26:45 +0100

Jose,

I recently went through the exact same dilemma. If you go to
www.timetrendsg.com/redesign/, you will see a site I am working on that uses
flash movies for navigation, instead of boring old gifs. I wrote a script
that tells the flash movie on the left which frame to display when it loads
(which is dependent on what part of the site you are in)

To see an example, go to the Products section, and select the 'desktops'
link. When you view the source, you'll notice two javascripts at the end of
the <Head></Head> tags. Those control my two flash movies (top nav and left
nav). The point of this is that Netscape and Microsoft implement the
javascript language differently (surprise) so the script I have determines
which browser is viewing the page, then provides the correct information to
the javascript function that loads when the <body> tag is loaded.

Here is the basic function (put it in your head of your html page)


function jcleftnav(){
if (navigator.appName.indexOf ("Microsoft") !=-1)
{ return window['leftnav'] }
else { return document['leftnav'] }
}

The 'leftnav' part is the name of the movie that you set in your <object> or
<embed> tags. Change this to whatever you named your flash movie. Now,
when you want to change the frame of the movie, cal lthe function i nyour
html page. I wanted mine to change as soon as the page is loaded, so I
included the following in my <body> tag:

<body bgcolor="#FFFFFF" onLoad="jcleftnav().GotoFrame(7)">

Notice the 'GotoFrame' -- it is important that you use this EXACT case
inyour own code. Netscape kept telling me that 'gotoframe' was not a valid
method until I changed the case of the method call in my html code.

Also, remember that javascript begins counting from '0' - so if you have 20
frames in your flash movie, even though flash says your first frame is frame
1 - to reference it in javascript you will have to tell it to go to frame 0.
Likewise, to go to the last frame, you would write the command
'jcleftnav.GotoFrame(19)'

Hope this helped,

BJ Hoffauir
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
World Animation Celebration - Big Internet Animation Pow Wow Discount Offer

Register before May 25 mention flasher and save 25%!! www.wacfest.com

Be discovered, get a job or have your web series picked up. A big talent search for Shockwave
and Flash animators is happening May 30-June 4 in Hollywood. Featuring Rob Burgess, Matt
Groening, Brad Bird and more. www.wacfest.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: Flash, layers and JavaScript , Jose M. Rubio/DoubleYou

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]