Size Priority
If you downloaded any of our Flash Components, you already know we define the size in the HTML code, as well as in the XML code. Well, let me tell you we define the size in the ActionScript code as well, and if we don’t, we resize the component to take the entire Stage size.
I’ll briefly explain why we do this, and what are the advantages of doing it like this.
The way the Flash Component resizes, is by reading the componentWidth and componentHeight values, but the priority is:
- HTML.
- XML.
- Stage size (or ActionScript passed).
How to resize the component?
The reason for which we define the size in three places, is the functionality we built into our Flash Components, and that is, the ability for them to work in HTML pages as well as other Flash projects, depending on your needs:
- If you use the Flash Component inside an HTML page, than you define the size in HTML. If the Flash Component finds this size, it will ignore the other values (xml, AS).
- If you use it inside your Flash project, you will use your own embedding code for your SWF file, so there won’t be any HTML to pass the size to our Flash Component. This means you will have to pass the size in XML. Make sure that when you init the component, you pass NaN for the componentWidth and componentHeight. Otherwise, the values you pass to the init function will be used instead of the values read from XML.
- If you want to use the Flash Component, in your Flash project, at the size that’s used in the FLA, than don’t pass any size to the XML file, but pass it in the init function. Otherwise the Component will take the Flash Stage size.
Fill part of the swf size
If you use the component inside an HTML page, you will notice that we pass the componentWidth and componentHeight values like this:
flashvars.componentWidth = stageW; flashvars.componentHeight = stageH;
That’s because we have the stageW and stageH values (meaning the swf size) defined, and we want the component to take the entire swf size.
var stageW = "560"; var stageH = "422";
If for example you want the component to only fill half of the swf width, than you would pass that value to the componentWidth, in this case it would be:
flashvars.componentWidth = 280;
What this will do is it will leave an empty area on the right of the component, which you can use for adding your own content for example, if you edit the FLA.
Fill entire browser window
If you want to fill the entire browser window, what you should do is pass the stageW and stageH values like this:
var stageW = "100%"; var stageH = "100%";
You can either keep the componentWidth and componentHeight passed like this:
flashvars.componentWidth = stageW; flashvars.componentHeight = stageH;
Or you can delete them, and the component will fill the entire browser window.
Hope this clears things out. If you have any questions, please post them here, and I’ll do my best to explain things better.
This post has 8 comments | Post your comment
Is the maximum size 560px? Can’t have a size up to this? When I resize up to 560px I get a blank space. How can I fix it?
Thanks a lot!
I was trying to do it in XML Banner Rotator. When I set stageW and flashvars.componentWidth a size up do 560px I get a blank space.
I was using de XML Banner Rotator
hi
i cant resize the rotator … after i read all in ur artical i still finding a problem to resize
blog entries 

Products RSS Feed
Follow us on twitter
jon
February 15, 2010 at 10:51 am
Thanks for the tips. Regarding full screen display; i noticed that if i set stageW = 100%, The component does not automatically resize if the browser window resizes.
Is there a way around this?