Flasher Archive

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


Subject: Re: A Few Quick Questions
From: Colin Moock
Date: Thu, 5 Mar 1998 15:21:32 GMT

flasheratshocker [dot] com,Internet writes:
>1) Is there any way get one flash animation to trigger another
>animation on
>the same page?

You have to use JavaScript (and VBscript a bit). I'll give a specific
example below. You should probably sniff out Win3.1 and Mac68K before
using this technique though, because they don't support Flash
scripting...

Also, for anyone else listening...in using similar methods, do you
experience crashes in Netscape over network connections (but not
locally?). I had a reproducible crash in the while() loop when waiting
for PercentLoaded. No problems in IE though. I was also talking between
two frames though, and I wonder if Netscape died trying to check its
cache, or couldn't talk to the plugin for some reason (I'm guessing IE
would have better communication with the ActiveX version...). I'd love
to hear other experiences with Netscape stability in using these
techniques, especially with frames...

Here's the example:

***IN YOUR EMBED/OBJECT TAGS***
Set the name of your movies. Let's say like this:
<EMBED NAME="movie1" etc. etc.>
<OBJECT ID="movie1" etc. etc.>


***IN YOUR MOVIE***
1) In your movie1, set a keyframe frame where you want movie1 to change
the frame in movie2.
2) Set the Action to "GetURL"
3) In the Network Address box, enter "FScommand:changemovie"
("changemovie" is one of two arguments you can pass to JavaScript.
We'll look for it later in our function.)
4) In the Target box, enter the frame you want to change to, say "15".
(the target frame is always where you put the second argument. Our
"changemovie" function will catch it.)

So, now your movie is asking the browser to look for a function to
start. In your HTML, you write the function...


***IN YOUR HTML***
Use a function like this...I'll comment it and add alerts so you can
track the progress of your script. Just comment out the alerts to make
it work properly...

<SCRIPT LANGUAGE="JavaScript">
//First, catch the function coming out of movie1 with standard syntax.
Assign two variable names, command and args
function movie1_DoFSCommand(command, args){

//check to see if the movie is asking to execute this action:
if(command=="changemovie"){

alert('Movie1 has called change in Movie2');
//Refer to the embedded movie as "mov2", set using slightly
different syntax
//depending on the browser.

var InternetExplorer = navigator.appName.indexOf("Microsoft")
!= -1;
var mov2 = InternetExplorer ? window.movie2 :
window.document.movie2;

//Ask Flash for the amount of the movie already loaded. Just to
make sure we don't jump to a non-loaded frame.

var pl = mov2.PercentLoaded();
alert('Initial percent loaded is:' + pl);

//Wait until the appropriate portion of the movie is loaded.
We'll use 40%.
while(pl < 40){
alert('Waiting until 40% of movie loads. Current
percent loaded is only:' + pl);
pl = mov2.PercentLoaded();
}

//Now that enough of the movie is safely loaded,
//send it to the desired frame in the timeline.
alert('Required percentage loaded. Proceeding to frame 15.');

movie2.GotoFrame(15);

//now play the movie (if we want the movie to play).
movie2.Play();


</SCRIPT>

<!--The following bit is for Internet Explorer-->

<SCRIPT LANGUAGE="VBScript">
<!--
// Map VB script events to the JavaScript method - Netscape will
ignore this...
// Since FSCommand fires a VB event under ActiveX, we respond here
Sub hotspot_FSCommand(ByVal command, ByVal args)
call hotspot_DoFSCommand(command, args)
end sub
-->
</SCRIPT>

>2) Is there any way to specify different starting frames for a Flash
>animation, perhaps with some sort of HTML parameter?
You'd use the same set up as above, but just call the function from
frame 1 of movie1, and use the mov1.GotoFrame(x) to set the starting
frame.

Good luck!
Colin
******************************
colin_moockaticeinc [dot] com
This .sig, like all the others, was hand-typed.
******************************

------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-manageratshocker [dot] com. Problems to: owneratshocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-manageratshocker [dot] com


Replies
  Re: A Few Quick Questions, Mark French

Replies
  A Few Quick Questions, Mark Kerr

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