PDA

View Full Version : Control flashObject with Javascript


philcrak
08-10-2001, 07:00 PM
The script below will allow an HTML link to control the flashObject. In otherwords, the 'link' will go to label 'labelName' in the flashObject timeline. My dilemma is making this work across frames. I need the 'link' in frameB to control the flashObject in frameA. I know that I am on the right path, but as the saying goes: so close but yet so far. Could someone please put me on the correct path?!


----------------------------------------------------
Frameset: frameA (contains flashObject)
frameB (contains HTML link)

Script:
<SCRIPT LANGUAGE="JavaScript">
<!--
var movieName = "topFrame.mgignav";

function thisMovie(movieName) {
// IE and Netscape refer to the movie object differently.
// This function returns the appropriate syntax depending on the browser.
if (navigator.appName.indexOf ("Microsoft") !=-1) {
return window[movieName]
} else {
return document[movieName]
}
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
if (typeof(theMovie) != "undefined") {
return theMovie.PercentLoaded() == 100;
} else {
return false;
}
}

function golabel() {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).TGotoLabel("_level1/","contact");
}
}



//-->
</SCRIPT>

HTML Link: <a href="#" onClick="golabel()">link</a>
----------------------------------------------------

"For once I wish someone would call me sir, without adding... you're making a scene." - Homer Simpson

barkers
08-13-2001, 01:51 PM
u need to put all the javascript functions into frameA where flash movie is.

then put

parent.frameA.goLabel();return false;


in the onclick.
you need the return false otherwise it will carry out the normal action of a link. in this case it would go to '#'.

philcrak
08-13-2001, 05:16 PM
Thanx a tonne barkers.

You have no idea how much that little bit helped. That puts me back on track and well on my way to finishing this website.
---------------------------------------

"The new phonebooks are here!!! The new phonebooks are here!!! I'm a somebody, now!" - Steve Martin in The Jerk