StageResizer tutorial
Second tutorial to explain the StageResizer class from the as3toolbox package. With this one, you are going to manage some liquid layout in your flash projects.
In this sample, you can see the liquid layout behaviour on some displayobjects.
Public properties:
- stage : Stage
- useMinimumSize : Boolean
- updateOnAdding : Boolean
- roundPositions : Boolean
Public methods:
- addMember(…) : void
- removeMember(…) : void
- enableItem(…) : void
- defineMinimumSize(…) : void
- enable(…) : void
- refresh() : void
Source :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | package { //Imports import flash.display.Shape; import flash.display.Sprite; // import com.guitouxx.ui.StageResizer; /** * Tutorial to use the com.guitouxx.ui.StageResizer */ public class StageResizerExample extends Sprite { public var header : Shape; public var footer : Shape; public var square1 : Shape; public var square2 : Shape; public function StageResizerExample():void { StageResizer.stage = stage; StageResizer.defineMinimumSize(500, 500) //minimum size for resizing StageResizer.useMinimumSize = true; StageResizer.roundPositions = true; //positions are rounded during the resize StageResizer.updateOnAdding = true; //the resize process is executed after adding a child to the StageResizer _createObject(); _initStage(); } private function _createObject() : void { header = new Shape(); header.name = "header"; header.graphics.beginFill(0x0096ff); header.graphics.drawRect(0, 0, stage.stageWidth, 100); header.graphics.endFill(); addChild(header); footer = new Shape(); footer.name = "footer"; footer.graphics.beginFill(0xffae00); footer.graphics.drawRect(0, 0, stage.stageWidth, 50); footer.graphics.endFill(); addChild(footer); square1 = new Shape(); square1.name = "square1"; square1.graphics.beginFill(0x7e00ff); square1.graphics.drawRect(0, 0, 100, 100); square1.graphics.endFill(); addChild(square1); square2 = new Shape(); square2.name = "square2"; square2.graphics.beginFill(0xff002a); square2.graphics.drawRect(0, 0, 100, 100); square2.graphics.endFill(); addChild(square2); } private function _initStage() : void { StageResizer.addMember(header, 0, 0, 100, 0, 0, 0, StageResizer.PERCENT_MARGIN); StageResizer.addMember(footer, 0, 100, 100, 0, 0, 100, StageResizer.PERCENT_MARGIN); StageResizer.addMember(square1, 50, 50, 0, 0, 50, 50, StageResizer.PERCENT_MARGIN); StageResizer.addMember(square2, 100, 90, 0, 0, 120, 120, StageResizer.PIXEL_MARGIN); StageResizer.enable(true); } } } |





