AS Reference  :  Notes Index  :  Resources  :  About/Contact  :  Downloads

Browser Display Options


When you publish a Flash movie, you can choose to publish it at a fixed size (the same as the movie dimensions, or another size), or at some percent of the screen, with different options that determine what cropping and stretching will happen to make the content fit the user's browser window. The most common publish option for movies containing bitmap images, as our sample movie does, is as a fixed size movie, the same size as the stage dimensions. This is also the default if no changes are made in the Flash tab of the Publish Settings dialog box. Once the movie has been published, producing both a swf and an html file, the html file can be opened in Dreamweaver or another HTML editor and altered. Below are some examples:

Put the movie where you want it in the browser window

If you publish a movie with the default Publish settings, you'll get a swf and an html page that embeds that swf and displays it in the upper left corner of the browser window, at a size equal to the stage size of the movie. Because no margin or other formatting tags are included in the html, there will be a small margin at the top and left of the swf content in Mozilla-based browsers, which assign a default margin.

You can edit the html page that Flash produces from Dreamweaver or any other html editor. For example, to get rid of extra margins, open the page and replace the body tag with this (changing ffffff to whatever your background color should be):

Or you can include the Flash movie in a table cell or div by editing the html page accordingly. For example, to center your movie horizontally and vertically within the browser window, open the html page and delete the DOCTYPE tag that Flash puts at the top of the page (it will cause the vertical centering to fail). Find the <object> tag in the html file and put this code before it:

Then find the </object> tag and put this code after it:

Display in a fixed sized window opened with Javascript

If you want visitors to open your Flash movie in a fixed size window from a link on an html page, here is a javascript link to do that (in this case, opening page flashmovie.html (presumably with a swf embedded in it) in a directory named flashfolder under the current one, in a window that's 800 x 500, and giving focus to the new window):

If you want to open the new window of fixed size from within Flash instead, put this code on the button that will open the new window (setting the pagename, width and height to whatever you want):

on (release) {
   getURL("javascript:NewWindow=window.open('flashfolder/flashmovie.html','newWin','width=800,height=500,left=0,top=0,toolbar=yes,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');NewWindow.focus();void(0);");
}

Intro
Flash: What & How
Example Sites
Create
Draw, Edit Shapes
Gradients
More Drawing Tips
Import
A Sample
Animate
Frames, Keyframes
Motion Tweens
More Motion Tweens
Shape Tweens
Masks
Control
Stop/Replay
Movieclips Intro
Movieclip Reference
Site Structure 1
Slideshow Movieclip
Contact Form
Scroll Resume
Preloader
Site Structure 2
Publish
Display Options
Player Detection
Optimize
AS 2.0 Basics
Intro to Syntax
Playhead Commands
Playhead Cmds 2
Coded Tween
onEnterFrame
Intro to Classes
Declare/Assign
Comments, Trace
Simple Data Types
Arrays & Objects
Code Blocks
Operators
Beyond Buttons
Code Structure
Toggle Controls
Group of Buttons
Drag and Hit
Distort Magnifier
Scroll Text
Bee Game
Dart Shooter
Sound Control
Easing Slider
Easing Slider 2
Components Intro
Timers & Delays
Dynamic Content
Intro
Drawing API
Create Text
Attach Movieclips
Easing Slider 3
Easing Slider 4
Load jpg/swf
Sliding Viewer
Preload swf
XML
Easing Slider 5
Server Comm
LoadVars (w/ PHP)
AS - PHP Lookup
Text File
Database 1:LoadVars
Database 2:Remoting
Read from directory
AS 2.0 Classes
Intro
Math
Key
Date
Color
EventDispatcher
New Samples
Pie Chart
Event-model Emailer
Tween Sequence
Fuse Sequence
SVG in Flash
Bitmap Topo
SWF as Data Holder
Two-level Menu
Yahoo! Flash Maps
Class-based Game
ASTB Samples
Disclaimer
3D Outlines
Bounce Collide
Address Book
Save Drawings
Home  :  Notes Index  :  Resources  :  About/Contact  :  Downloads