View Single Post
  #1 (permalink)  
Old Jan 26th, 2006, 00:04
victorpantet victorpantet is offline
New Member
Join Date: Jan 2006
Age: 28
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with iframe & Javascript - Trying to communicate with a flash movie

So I have an embedded flash movie in my page, I also have an IFRAME called "content" loading a page that contains this hyperlink:

<a href="#" target="_top" onClick="playmovie()">Play</a>

I'm basically trying to call that javascript function to play my flash movie... of course I can't figure out how to target that function once my link loads into the iframe within the page that contains the javascript and the flash move... Please someone tell me what I'm doing wrong...

Below is the script I have on the main page, along with the embedded flash movie:


<SCRIPT LANGUAGE="JavaScript">
<!--
var movieName = "testcommand";

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 playmovie() {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).Play();
}
}

//-->

</SCRIPT>


<object
classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="336"
height="57"
id=testcommand>

<param name="movie" value="flashfiles/mp3.swf">
<param name="quality" value="high">

<embed
NAME="testcommand"
src="flashfiles/mp3.swf"
quality="high"
swLiveConnect="true"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="336" height="57">
</embed>

</object>
Reply With Quote