开发者

Setting stage to allow for any stage width or height

开发者 https://www.devze.com 2023-03-30 17:24 出处:网络
I am developing a web application for a web firm, it is an \"engine\" that loads external swf files and presents them in a slideshow fashion much like what is presented a lot these days for website fr

I am developing a web application for a web firm, it is an "engine" that loads external swf files and presents them in a slideshow fashion much like what is presented a lot these days for website frontend header content areas

The thing is almost ready but I've hit a bit of a design roadblock. While i've been developing happily along with a stage width and height of 930x270, the truth is that not every single site is going to be using those dimensions. Everything that runs uses the stage.stageWidth property (and same with stage.stageHeight) for this exact reason, however I cannot seem to dynamically set the width and height values, even with basic to advanced embedding techniques on the web pages themselves.

Using the Flex/FlashBuilder meta info

[SWF(frameRate=30, widthPercent=100, heightPercent=100)]

or even if i set a specific width and height or not. For example, if I dont set anything (just the framerate) and I embed the resulting swf on a page in an element thats 980x300, stage.stageWidth STILL reports back only 500, totally messing with how 开发者_高级运维my elements are getting displayed.

I tried setting the scaleMode too, right now its set to

stage.scaleMode = StageScaleMode.EXACT_FIT;

its the first thing set in my constructor.Still 500 (without any meta information set, or even with widthPercent and heightPercent).

I need the ability for the embedded flash to be almost any size without the requirement of recompiling, No need to worry about aspect ratio either, the loaded content will be manually created for that particular project, but the entire project relies on the width property of the engines stage.

Sorry for the long wall of text, but I'm running out of ideas here...

Is there anything in MXML or some property I can modify or some embed tactic that I'm missing to get the stages properties set to the width and height of its embedded object?


Try setting the following:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

Also use a method outside of the main constructor to get the stageHeight and stageWidth sometimes the stage is not 'ready' yet.

0

精彩评论

暂无评论...
验证码 换一张
取 消