views:

675

answers:

1

I have a simple HelloWorld app done in FlexBuilder. It's just a simple class that extends Sprite. In the dedicated Flash player, the SWF shows up occupying the whole screen. In Firefox, however, both within HTML and alone, it shows up to the right. Is there a simple cure for this?

Code is just a constructor (in which the stage.stageWidth and stageHeight are read correctly, strangely) which adds a TextField to the Sprite and sets the size to stage.stageWidth and stage.stageHeight.

Edit: To no avail I've tried moving the constructor's contents to the Event.ADDED_TO_STAGE event handling, but I think that whole line of investigation is dead.

Edit: Now that I know that Theo's answer is right, I found this link. Nice!

+2  A: 

HTML Flash Embed

First make sure your embed tag is alright (width and height set to 100%, CSS, etc.). This shouldn't be the problem though as you say that the swf-only displayed in the browser also bugs.

Alignement

Check that you have set the stage alignement to top-left in your constructor :

stage.align = StageAlign.TOP_LEFT;

Scaling

Usually if you let flash scale up your whole application it may look ugly (fonts too big, etc.). The best uses to be to set the stage scaling to "no scale" and the listen to the stages RESIZE Event in order to scale and position the objects that requires it.

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResizeHandler);
stageResizeHandler();

And the something like (pseudo code) :

private function stageResizeHandler(event:Event=null):void
{
    backgroundShape.width = stage.stageWidth;
    backgroundShape.height = stage.stageHeight;

    footer.y = stage.stageHeight - footer.height;

}
Theo.T
+1 I'll give it a shot now...
Yar
Nice, this worked: stage.scaleMode = StageScaleMode.EXACT_FIT;Thanks for the help!
Yar
Sorry, change of heart: your Scaling bit was right. THANKS!
Yar