Solved

full width centered flash, fixed height

Posted on 2009-07-12
3
1,604 Views
Last Modified: 2013-11-11
i currently have Flash CS3 Pro. What I'm trying to do is create a flash movie that will scale 100% in width, but always remain at a fixed height, no matter what size the browser is set to, and without stretching or distorting my swf. Also, I'd like the center portion of the movie to show, not the left. I'm creating a flash movie with a width of 1600px. the larger the browser width, the more of the movie is viewable on either side (rather than showing more on just the right side.

if you're familiar with CSS then what I'm talking about is the equivalent of using a background image with the position set to "top center" (ex: {background-position:top center;})

I've looked everyone for an example or tutorial on this, but with no luck. I'm not great with AS, so this is my last resort before I hire a freelancer to set it up for me. Any help is appreciated greatly :)
0
Comment
Question by:xill2678
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
kishoregp earned 250 total points
ID: 24837610
if u edit ur html.. u shud see width and height parameters
and if u r publishing html from cs3, u shud find it in three places.. find and change it as below

width to "100%"
height to "300px" //change height to as you want

if you dont want the content to resize.. use the fscommand in the first frame of ur flash
fscommand("allowscale",false)
0
 
LVL 1

Author Comment

by:xill2678
ID: 24837670
but how do i show only the center of the movie at all times? i'm assuming i'll need to use an empty container which calls in an external swf, but only shows the center portion of the external file. how much it shows would depend on the width of the browser. not sure how to set this up
0
 
LVL 2

Assisted Solution

by:jockejocke
jockejocke earned 250 total points
ID: 24839111
I see your problem. There are mainly two ways of dealing with this:
1. Use HTML to set flash width and height and then use CSS to position the Flash DIV box.
2. Set the Flash container on the HTML page to 100% width and height, and then keep positions within flash (with AS)

Alternative 1:
Use SWFObject to place your Flash content inside a div on your HTML page, and then set width/height to what you want. Then CSS-position the div with absolute value to 'left: 50%'.

Alternative 2:
Use SWFObject to place your Flash content inside a div on your HTML page. Then set width/height to 100%. In Flash, set scaleMode to noScale and position document top-left. Add a listener function to when window is resized and position the movieclip where you want it to be. See as2/as3 example code below.

If you have for example a background image you want stretched instead of not visible, you can set width/height to the current stage width/height.

For more info on how to use SWFObejct, go to http://code.google.com/p/swfobject/ or search here at EE ;)

Hope this helps ;)
Cheers
----------
AS2:
 
Stage.scaleMode = "noScale";
Stage.align = "TL";
var resizer:Object = new Object();
resizer.onResize = function()
{
	myMc._x = Stage.width/2;
	myMc._y = 0;
}
Stage.addListener(resizer);
 
 
 
----------
AS3:
 
import flash.display.Stage;
import flash.events.Event;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;			
this.stage.addEventListener(Event.RESIZE, resizeHandler);
function resizeHandler(e:Event)
{
	myMc.x = stage.stageWidth/2;
	myMc.y = 0;
}

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question