Closed Bug 441507 Opened 16 years ago Closed 14 years ago

flash animation doesn't play when I switch the element which embeds swf file to style-display property to "none" and reverting display property to "block"

Categories

(Firefox :: General, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: anilreddy.bachola, Unassigned)

Details

(Whiteboard: [CLOSEME 2010-11-01])

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

I built a application, in which there will be two sections. one will show a flash animation and other will show the static html content. To make things clear we will call these section as "animation section" and "static section". At any time in my application only one of these sections are visible. And initially when my application loads the "animation section" will be visible.The navigation between these will happen through a button . I am embedding the two section in to html '<div/>' tags and controling the visibility of these div's with elements style property.

to show a section : elm.style.display="block"
to hide a section : elm.style.display="none"

The navigation between these sections works great on internet explorer 6 and 7. But in firefox first initially application show the "animation section" and hides the "static section". Now animation plays without any problem. Now i switched to "Static section" by clicking on a button. With this "animation section is hidden and the static section is now the current section. Now if i switch to the animation section, this time the animation doesn't play. 
With my observation what i found that : I think firefox is trying to reload(re-construct) the animation ,when the element containing it coming to focus). Some thing failing to play the animation...

The second thing i did was : instead of changing the element's display property i tried to change the "opaque" property. This also giving the same results. I demonstrated the same in my code.

----------------------
About flash Animation: 
----------------------
The flash animation file is built using Adobe's Flex, in which i load the contents of an xml file and parse the xml file and plays the animation.(to get the xml data i use the flex's HTTPService, the xml file is deployed with swf file).

----------------------
source code:
----------------------
1. main file(index.html)
-------------------------------------------------------------------------------
<html>
<head>
<script type="text/javascript">
var section=1;
function swapSections(){
	alert(section);
	if(section == 1){
		alert('hi');
		section=2;
		//document.getElementById('one').style.display='none';
		//document.getElementById('two').style.display='block';
		removeClass(document.getElementById('two'),"hide");
		addClass(document.getElementById('two'),"show");
		addClass(document.getElementById('one'),"hide");
		
	}else{
		alert('cool');
		section=1;
		//document.getElementById('one').style.display='block';
		//document.getElementById('two').style.display='none';
		removeClass(document.getElementById('one'),"hide");
		addClass(document.getElementById('one'),"show");
		removeClass(document.getElementById('two'),"show");
		addClass(document.getElementById('two'),"hide");
		//document.getElementById('roverframe').src="Rover/Rover.html";
	}
}
function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}
</script>
<style type="text/css">
.hide {
	filter:alpha(opacity=0);
	-moz-opacity:0;
	-khtml-opacity: 0;
	opacity: 0;
}
.show{
	filter:alpha(opacity=100);
	-moz-opacity:1;
	-khtml-opacity: 1;
	opacity: 1;
}
</style>
</head>
<body>
<input type="button" title="swap" value="swap" onclick="swapSections();" style="position:absolute; left:200px;top:0px;"/>
	<div id="one" style="width:922px;height:426px; border:solid  2px" />
		<iframe id="roverframe" name="roverframe" width="922px" height="426px" src="Rover/Rover.html">
		</iframe>
	</div>
	<div id="two" style="width:922px;height:426px;border:solid  2px;" class="hide" />
		<h1>the other section</h1>
	</div>
</body>
</html>
-------------------------------------------------------------------------------
2. Rover.html (which embeds swf file)
------------------------------------
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="AC_OETags.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->
</script>
</head>

<body scroll="no">
<script language="JavaScript" type="text/javascript" src="history.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
if ( hasProductInstall && !hasRequestedVersion ) {
	// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

	AC_FL_RunContent(
		"src", "playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "100%",
		"height", "100%",
		"align", "middle",
		"id", "Rover",
		"wmode","Opaque",
		"quality", "high",
		"bgcolor", "#cce6ff",
		"name", "Rover",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
			"src", "Rover",
			"width", "100%",
			"height", "100%",
			"align", "middle",
			"id", "Rover",
			"wmode","Opaque",
			"quality", "high",
			"bgcolor", "#cce6ff",
			"name", "Rover",
			"flashvars",'historyUrl=history.htm%3F&lconid=' + lc_id + '',
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here. '
  	+ 'This content requires the Adobe Flash Player. '
   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
// -->
</script>
<noscript>
  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="Rover" width="100%" height="100%"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
			<param name="movie" value="Rover.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#cce6ff" />
			<param name="allowScriptAccess" value="sameDomain" />
			<embed src="Rover.swf" quality="high" bgcolor="#cce6ff"
				width="100%" height="100%" name="Rover" align="middle"
				play="true" 
				loop="false"
				wmode="Opaque"
				quality="high"
				allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
	</object>
</noscript>
<iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>
</body>
</html>
--------------------------------------------------------------------------------
3. there are some other files which will be produced by the flex builder when generating this Rover.html file.



Reproducible: Always

Steps to Reproduce:
1.click on the button to Navigate to static section
2.come back the animation section by clicking on swap button
Actual Results:  
animation is not playing(trying to reload .. but the animation is not being displayed..)

Expected Results:  
the animation should be shown as it was in a state when the user switches to the 'static section'

flash player version : 9.0.0
working fine Internet Explorer 6 and 7
This is a mass search for bugs that are in the Firefox General component, are
UNCO, and have not been changed for 800 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10, create a fresh profile,
http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you
still see the bug, please update this bug. If the issue is gone, please set the
resolution to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
No reply from reporter, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.