Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > HTML and JavaScript

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-08-2006, 01:52 PM   #1
beau
Senior Member
 
Join Date: Jul 2004
Posts: 318
Default Firefox and MM_controlShockwave() - BROKEN

I'm trying to control a swf using the good old Dreamweaver/Macromedia functions:

Code:
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
  var obj=MM_findObj(objStr);
  if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
}
And here's the function call:
Code:
MM_controlShockwave('swf_ps','','StopPlay');
when the page loads, and then
Code:
MM_controlShockwave('swf_ps','','Play');
when I'm ready for it to start playing.

Which of course works great in IE, but Firefox is shooting the pooch.

The JS error is:
obj.StopPlay is not a function

I'm almost sure there's a solution out there, but I can't find anything.
- Yes, I need javascript to control the swf,
- no, I can't use FSCommand because I am not designing some of the swf files - only implementing them.

Here's the thing - I'm able to write the swf to the page and set the param "PLAY" to FALSE, so then, isn't there a way to go back and set it to true?

Last edited by beau; 03-08-2006 at 01:55 PM.
beau is offline   Reply With Quote
Old 03-08-2006, 09:57 PM   #2
beau
Senior Member
 
Join Date: Jul 2004
Posts: 318
Default

Hey I found a solution, here it is:

Code:
function MM_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
	f = getFlashMovieObject(objStr);
	if(f!=null && f!=undefined){
		if(cmdName=="Play"){
			eval('f.' + cmdName + '();');
		} else {	
			eval('f.' + cmdName);
		}
	}
}

function getFlashMovieObject(movieName){
	if (window.document[movieName]){
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (document.embeds && document.embeds[movieName]){
			return document.embeds[movieName];
		}
	}
	else{
		return document.getElementById(movieName);
	}
}
But this only controls Play and StopPlay.
beau is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox and SWF Caching issues astgtciv ActionScript 2.0 6 02-19-2010 04:39 AM
LoadVars and Mozilla Firefox - Problem guy_logical ActionScript 1.0 (and below) 1 05-20-2006 01:05 PM
Flash not working properly in Firefox laclef Other Flash General Questions 3 08-25-2005 03:23 AM
MovieClipLoader bug in FireFox djandrew ActionScript 2.0 0 08-10-2005 05:32 PM
Flash Remoting Broken in Firefox, Works in IE stuart888 Flash Remoting 3 03-30-2005 04:16 PM


All times are GMT. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2010 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.