Flasher Archive

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


Subject: Re: A Few Quick Questions
From: Colin Moock
Date: Tue, 10 Mar 1998 14:42:27 GMT

flasheratshocker [dot] com,Internet writes:
>Hi, Colin. I've been trying to accomplish this very thing for days, BUT:
> 1) my "movie 2" is in a different HTML frame, and
> 2) this HTML frame contains a completely different HTML file.

>How would I control the SWF frame movement in this situation?

Hi Mark,
Sorry for the delay in response, but I was really busy at work.

If you want a movie in one frame to control a movie in another frame,
you'd use an FSCommand in movie 1 to call a function in frame 1 which
calls a function in frame 2 which changes the movie in frame 2.
So, in essence, it would be the same as what I described below, with
the addition of a jump between frames in the function called by movie1.

Your function in frame 1 would call a function in frame 2 using this
syntax:
parent.frames['youframename'].yourfunction(yourparameters)

and then you'd have a function in frame two called "yourfunction" where
"yourparameters" is set to the frame you want the movie to change to.
Remember that you can set this dynamically using the "args" of an
FSCommand. The "yourfunction" in frame two would be pretty much exactly
what I gave as my example.

Now here's the rub: I actually tried to do this for real on the Levi's
site, but had to ditch it because of three problems (all on Netscape
3&4):
1) Netscape sometimes got stuck in the PercentLoaded while loop. It
seemed unable to access the information from the plugin once in the
loop. IE didn't have the problem. I wondered if it had an easier time
communicating with its activeX control.
2) Netscape crashed randomly.
3) Over a network connection, the first frame occasionally loaded
movie1 which tried to access the function in frame2 before the frame
had even loaded the page. This resulted in the appropriate "object not
found" javascript errors.

A bizarre clue to the problems was that if you put in javascript alerts
to display what was happening at each stage of the process, then
everything worked fine. Seemed to me that executing simultaneous
multiple functions in different frames while talking to the plugin made
Netscape die. I didn't have time on the job to continue investigating.
The alerts forced the functions to happen one at a time, in a linear
fashion.

Let me know if you have better luck!
Also, if anyone knows a way to have JavaScript ask the browser whether
or not a page in a frameset has loaded yet (including its children),
I'd appreciate hearing about it.

Thanks,
Colin



>Mark

>_______________________________________________________________________

>>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 Kerr

Replies
  A Few Quick Questions, Mark Kerr
  Re: A Few Quick Questions, Mark French

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