How can I change the stage height (in Flash) of the main movieclip dynamically according to content?
I have a Flash widget (kind of player). I need to dynamically change height开发者_StackOverflow社区 of the widget according to the data I am loading in runtime via JSON. I want to do the resize in the ActionScript event handler.
The version of ActionScript is 3.0.
the size of the flash is determined by the embedding that you give it. inside of flash you can read the stage.stageHeight and stage.stageWidth properties to find what these are.
if you have your stage resize mode to "noscale" then you expand your flash area just by placing something off of screen (though obviously it wont be displayed) this can then be calculated by using the height and width properties of the main instance and then passing it to a javascript command via externalinterface, which can then update the size of your flash in the html view.
here are some links you might find useful: livedocs: scalemode, livedocs: align, browsercanvas: (js in actionscript), pure javascript example
How about trying stage.stageHeight
? But I think it is a read-only property. You need to try out.
精彩评论