?
Solved

full width centered flash, fixed height

Posted on 2009-07-12
3
Medium Priority
?
1,607 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 1000 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
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 how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses

777 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