Skip to content

Commit

Permalink
Add ContainerButton to demo project
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhengh committed May 4, 2016
1 parent 65c2761 commit 5c64abf
Show file tree
Hide file tree
Showing 6 changed files with 677 additions and 1 deletion.
51 changes: 51 additions & 0 deletions demo/src/starlingbuilder/demo/ContainerButtonPopup.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Starling Builder
* Copyright 2015 SGN Inc. All Rights Reserved.
*
* This program is free software. You can redistribute and/or modify it in
* accordance with the terms of the accompanying license agreement.
*/
package starlingbuilder.demo {
import feathers.core.PopUpManager;

import starling.display.Button;
import starling.display.Sprite;
import starling.events.Event;

import starlingbuilder.extensions.uicomponents.ContainerButton;

public class ContainerButtonPopup extends Sprite
{
//auto bind variables
public var _closeButton:Button;
public var _buyButton:ContainerButton;
public var _claimButton:ContainerButton;

public function ContainerButtonPopup()
{
super();

var sprite:Sprite = UIBuilderDemo.uiBuilder.create(ParsedLayouts.containerbutton_test, true, this) as Sprite;
addChild(sprite);

_closeButton.addEventListener(Event.TRIGGERED, onExit);
_buyButton.addEventListener(Event.TRIGGERED, onBuy);
_claimButton.addEventListener(Event.TRIGGERED, onClaim);
}

private function onExit(event:Event):void
{
PopUpManager.removePopUp(this, true);
}

private function onBuy(event:Event):void
{
trace("onBuy");
}

private function onClaim(event:Event):void
{
trace("onClaim");
}
}
}
3 changes: 3 additions & 0 deletions demo/src/starlingbuilder/demo/EmbeddedLayouts.as
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ package starlingbuilder.demo {

[Embed(source="layouts/anchorlayout_test.json", mimeType="application/octet-stream")]
public static const anchorlayout_test:Class;

[Embed(source="layouts/containerbutton_test.json", mimeType="application/octet-stream")]
public static const containerbutton_test:Class;
}
}
2 changes: 2 additions & 0 deletions demo/src/starlingbuilder/demo/ParsedLayouts.as
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ package starlingbuilder.demo {
public static var layout_test:Object;

public static var anchorlayout_test:Object;

public static var containerbutton_test:Object;
}
}
13 changes: 12 additions & 1 deletion demo/src/starlingbuilder/demo/UIBuilderDemo.as
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ package starlingbuilder.demo {
public static const SHOW_MOVIE_CLIP:String = "showMovieClip";
public static const SHOW_LAYOUT:String = "showLayout";
public static const SHOW_ANCHOR_LAYOUT:String = "showAnchorLayout";
public static const SHOW_CONTAINER_BUTTON:String = "showContainerButton";

public static const linkers:Array = [AnchorLayout, FlowLayout, HorizontalLayout, VerticalLayout, TiledRowsLayout, BlurFilter];

Expand Down Expand Up @@ -94,7 +95,8 @@ package starlingbuilder.demo {
{label:"external element", event:SHOW_EXTERNAL_ELEMENT},
{label:"movie clip", event:SHOW_MOVIE_CLIP},
{label:"layout", event:SHOW_LAYOUT},
{label:"anchor layout", event:SHOW_ANCHOR_LAYOUT}
{label:"anchor layout", event:SHOW_ANCHOR_LAYOUT},
{label:"container button", event:SHOW_CONTAINER_BUTTON}
]
}

Expand Down Expand Up @@ -132,6 +134,9 @@ package starlingbuilder.demo {
case SHOW_ANCHOR_LAYOUT:
createAnchorLayoutTest();
break;
case SHOW_CONTAINER_BUTTON:
createContainerButtonTest();
break;
}

list.selectedIndex = -1;
Expand Down Expand Up @@ -190,5 +195,11 @@ package starlingbuilder.demo {
var test:AnchorLayoutTest = new AnchorLayoutTest();
addChild(test);
}

private function createContainerButtonTest():void
{
var popup:ContainerButtonPopup = new ContainerButtonPopup();
PopUpManager.addPopUp(popup);
}
}
}
Loading

0 comments on commit 5c64abf

Please sign in to comment.