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
Solved

full width centered flash, fixed height

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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 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.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

839 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