Solved

full width centered flash, fixed height

Posted on 2009-07-12
3
1,600 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

730 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