Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get movie to stop

Status
Not open for further replies.

glg1

Programmer
Nov 19, 2005
65
US
Hi all,
I'm trying to control a flash movie that contains slides using javascript. I've tried both FF1.5 and IE. the flash was made with MX pro. The movie will start when I hit the play Flash button, but won't respond to the other buttons(stopmovie and go). Any Ideas?

The JS I have seen in several places and it works fine. I'm wondering if there is something in the swf that keeps it from responding once it is started. (maybe related to the goToNextSlide functions in the swf??)
Code:
var movieName = "FOSEMovie";
//replace this with your own movie ID
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();
}
}

function stopmovie() {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).TStopPlay();
}
}

function go(theFrame) {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).GotoFrame(theFrame);
}
}

function golabel(thelabel) {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).GotoLabel("_level0/",thelabel);
}
}


And the markup.

Code:
<form>
<input type = "button" onclick = "playmovie();" value = "Play Flash"></input>
<input type = "button" onclick = "stopmovie();" value = "Stop Flash"></input>
<input type = "button" onclick = "go(400);" value = "Frame400"></input>

</form>


<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"[/URL]
WIDTH="250" id="FOSEMovie">
<PARAM NAME= "movie" VALUE="FOSEDemo0.5.swf">
<PARAM NAME="quality" VALUE= "high">
<PARAM NAME= "bgcolor" VALUE="#FFFFFF">
<PARAM NAME = "Play" VALUE = "false">
<PARAM NAME = "LOOP" VALUE = "false">
<PARAM NAMW = "SCALE" VALUE = "SHOWALL">

<EMBED 
	src="FOSEDemo0.5.swf" 
	quality=high 
	bgcolor=#FFFFFF 
	WIDTH="250" 
	HEIGHT="200"
	NAME="FOSEMovie" 
	ALIGN="" 
	PLAY = "false"
	LOOP = "false"
SCALE = "SHOWALL"
swLiveConnect="true"
	TYPE="application/x-shockwave-flash"
	PLUGINSPAGE="[URL unfurl="true"]http://www.macromedia.com/go/flashplayer">[/URL]

</EMBED>
</OBJECT>

Thanks,
George
 
I'm not that familiar with the slide presentation bits, but all I can say, is that these things (as the components when they were introduced...) have their pro's but a lot of con's also, when not specificly used in the context they thought they would be used...
For instance you can't add a preloader to a slide presentation, you need to use a seperate preloader only movie...

My feeling is that if your above code works fine with a non-slide presentation .swf, then there's a great chance that something is going wrong, because of the slide presentation itself...

Furthermore, you don't mention anything about FireFox (used much more today than Netscrap will ever be again...), and in my experience, without a workaround, a lot of the Flash methods commands, simply won't work in FF.

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
Thanks Oldnewbie,
I'm afraid that the slides/screens may be the problem. I am running FF1.5, and the same thing happens in IE.

One of the things I'll try is removing the slides (transitioning to a single slided movie...) and see what happens.

George.
 
Yup, thats the problem. When I converted to a standard movie swf, code works fine. Good to know going forward. I'll write to Adobe and let them know - it would be nice to have the same functionality with the slide capabilities...

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top