Last active
December 19, 2015 08:19
-
-
Save RealyUniqueName/5924751 to your computer and use it in GitHub Desktop.
Simple StablexUI project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flash.display.StageAlign; | |
import flash.display.StageScaleMode; | |
import flash.Lib; | |
import ru.stablex.ui.UIBuilder; | |
import ru.stablex.ui.widgets.Bmp; | |
import ru.stablex.ui.widgets.Widget; | |
import ru.stablex.ui.widgets.HBox; | |
/** | |
* Simple demo project for StablexUI | |
*/ | |
class Main extends flash.display.Sprite{ | |
static public var view1 : ?Dynamic->Bmp; | |
static public var view2 : ?Dynamic->Widget; | |
static public var view3 : ?Dynamic->HBox; | |
/** | |
* Enrty point | |
* | |
*/ | |
static public function main () : Void{ | |
//make Main class available in xml | |
UIBuilder.regClass("Main"); | |
//initialize StablexUI | |
UIBuilder.init(); | |
//build functions for creation of views | |
Main.view1 = UIBuilder.buildFn("ui/view1.xml"); | |
Main.view2 = UIBuilder.buildFn("ui/view2.xml"); | |
Main.view3 = UIBuilder.buildFn("ui/view3.xml"); | |
//Show main ui | |
Lib.current.addChild( UIBuilder.buildFn('ui/main.xml')() ); | |
}//function main() | |
}//class Main | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<VBox id="'root'" w="640" h="480"> | |
<Button text="'Create view1'" on-click="#root.addChild( $Main.view1() );"/> | |
<Button text="'Create view2'" on-click="#root.addChild( $Main.view2() );"/> | |
<Button text="'Create view3'" on-click="#root.addChild( $Main.view3() );"/> | |
</VBox> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Bmp src="'assets/img/somePic.png'" name="'pictureView'"> | |
<Button text="'Destroy view'" on-click="$this.getParent('pictureView').free();"/> | |
</Bmp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Widget w="200" h="100" name="'secondView'" skin:Paint-color="0x00FF00"> | |
<Button text="'Destroy view'" on-click="$this.getParent('secondView').free();"/> | |
</Widget> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<HBox width="200" h="100" name="'hboxView'" skin:Paint-color="0x0000FF"> | |
<Button text="'Create another one'" on-click="#root.addChild( $Main.view3() );"/> | |
<Button text="'Destroy view'" on-click="$this.getParent('hboxView').free();"/> | |
</Widget> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment