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 07-18-2012, 02:15 AM   #1
PATurmel
Senior Member
 
Join Date: Jan 2011
Posts: 122
Default Fit swf to screen

I made my swf fit the browser window with the following code

AS3

var sw:Number = new Number(stage.stageWidth);
var sh:Number = new Number(sw);
container.width = sw;
container.height = sh;
addChild(container);

HTML settings

scale: noscale
object width: 100% height 200%


the problem is I can't get a consistent height. ie. I have to set the height in the HTML to various percentages for different screen dimensions (a square screen appears with an extended 'long' swf).
PATurmel is offline   Reply With Quote
Old 07-27-2012, 12:27 PM   #2
johnmayor
Registered User
 
Join Date: Jul 2012
Posts: 1
Default

Hey check that on the callingbook
johnmayor is offline   Reply With Quote
Old 07-28-2012, 02:34 PM   #3
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,106
Default

I think you should just use 100% for both width and height.
Also make sure there is no margin or padding:
Code:
<html style="margin:0%;padding:0%">
<body style="margin:0%;padding:0%;width:100%;height:100%">
__________________
www.actiontad.com - ActionScript and JavaScript sitting in a tree...
tadster is offline   Reply With Quote
Old 09-07-2012, 12:12 AM   #4
PATurmel
Senior Member
 
Join Date: Jan 2011
Posts: 122
Default

The answer is to resize the swf in the HTML (probably javascript is the best way to go).

The height is set to 200% because the stage height is double the width.

What is callingbook?
PATurmel 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


All times are GMT. The time now is 10:16 AM.

///
Follow actionscriptorg on Twitter

 


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