a flex DividedBox in as3/Flash
Does anyone know of a simple way to implement a DividedBox layout similar to flex, but done through Flash/as3 ?开发者_如何学C
I would think there would be a library out there for that already, or some resources, but I'm having a hard time googling for it, as it;s either Flex or unrelated content I keep finding.
EDIT just came across yahoo's astra library (example) I'm going to have a look at it, any other suggestions are appreciated
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/containers/DividedBox.html
You can always use AS3 to create a dividedbox and use it like any other component.
Eg,
var myDivBox:DividedBox = new DividedBox();
parentContainer.addChild(myDivBox);
var panelLeft:Panel = new Panel();
//do some changes inside the panel e.g pick a color
var panelRight:Panel = new Pane();
//do some changes inside the panel e.g pick a different color
myDivBox.addChild(panelLeft);
myDivBox.addChild(panelRight);
The above code is equivalen to
<mx:DividedBox direction="horizontal" width="100%" height="100%">
<mx:Panel id="panelLeft" title="Panel 1" width="25%" height="100%" backgroundColor="0xCCCCCC">
</mx:Panel>
<mx:Panel id="PanelRight" title="Panel 2" width="25%" height="100%" backgroundColor="0xCCCCCC">
</mx:Panel>
</mx:DividedBox>
If you are using flash cs3 or greater, the above code should work like a charm.
Just came across SPAS at http://www.flashapi.org/ giving it a try. the implementation seems much easier than the astra library. The skinning seems easier than with the flex framework library.
精彩评论