Interview Questions Answers.ORG
  
Interviewer And Interviewee Guide
      
      Interviews
      Quizzes
		
		
		
			
    
  	
				
				
				Home	
				Quizzes	
				Interviews	Scripting language Interviews:AngularJSAngularJS DeveloperChrome FrameDojoExpert Developer JavaScriptExpert JavaScript DeveloperExt CoreEXT-GWTExt-JSFront End Developer (AngularJS)JQuery DeveloperjQuery MobileJQuery ProgrammerJQuery UIMooToolsPrototype FrameworkQooxdooScriptingSencha TouchSizzle Selector EngineSWFObjectWeb Font LoaderXMLHttpRequest	  
				
				Copyright © 2018. All Rights Reserved
			
			
		SWFObject Interview Question:
Do you have any idea why do stage.stageWidth and stage.stageHeight return 0 in Firefox or Internet Explorer when using dynamic publishing?
Submitted by: AdministratorWhen using the dynamic publishing method in Internet Explorer or Firefox on Mac stage.stageWidth and stage.stageHeight might initially return 0 (note that for Internet Explorer the stage size will be available on first load, however when reloading or revisiting a page it will initially be 0).
The solution is to define a resize handler in your ActionScript code. The Flash Player team was obviously aware of this issue and therefore the Flash Player will keep on triggering the stage.resize event until it receives its actual width and height.
An AS3 example:
stage.addEventListener(Event.RESIZE, resizeHandler);
stage.dispatchEvent(new Event(Event.RESIZE)); // force stage resize event for normal cases
function resizeHandler(event:Event):void {
if (stage.stageHeight > 0 && stage.stageWidth > 0) {
stage.removeEventListener(Event.RESIZE, resizeHandler); // only execute once
// your initialization code here
}
}
Submitted by: Administrator
The solution is to define a resize handler in your ActionScript code. The Flash Player team was obviously aware of this issue and therefore the Flash Player will keep on triggering the stage.resize event until it receives its actual width and height.
An AS3 example:
stage.addEventListener(Event.RESIZE, resizeHandler);
stage.dispatchEvent(new Event(Event.RESIZE)); // force stage resize event for normal cases
function resizeHandler(event:Event):void {
if (stage.stageHeight > 0 && stage.stageWidth > 0) {
stage.removeEventListener(Event.RESIZE, resizeHandler); // only execute once
// your initialization code here
}
}
Submitted by: Administrator
Copyright 2007-2025 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
 
https://InterviewQuestionsAnswers.ORG.