Peter Hansen is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

microcode / playbook-air http://microcode.ca/playbook-air

Example code for PlayBook development using the Tablet OS SDK for Adobe AIR.

Clone this repository (size: 26.9 KB): HTTPS / SSH
hg clone https://bitbucket.org/microcode/playbook-air
hg clone ssh://hg@bitbucket.org/microcode/playbook-air

playbook-air / studies / MenuTest.as

Branch
default
//--------------------------------------------------------------
// PlayBook top-swipe menu demo

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import qnx.ui.text.Label;
    import qnx.ui.buttons.LabelButton;
    import ca.microcode.menu.TopSwipeMenu;

    [SWF(width="1024", height="600", frameRate="30", backgroundColor="#448822")]
    public class MenuTest extends Sprite {

        public function MenuTest() {
            var label:Label = new Label();
            label.height = 400;
            label.width = 600;
            label.multiline = true;
            label.text = "Top-Swipe Menu Demo\n\n"
                + "Swipe from top and play around.\n"
                + "Note you can close the menu by clicking above or below it.";
            addChild(label);

            const MENU_HEIGHT:int = 100;
            var menu:TopSwipeMenu = new TopSwipeMenu(stage.stageWidth, MENU_HEIGHT);
            //~ menu.swipe_region = 50;
            //~ menu.slide_time = 1.0;
            addChild(menu);

            var menu_title:Label = new Label();
            menu_title.text = 'Nice menu, eh?';
            menu_title.width = 200;
            menu.addChild(menu_title);

            var done:LabelButton = new LabelButton();
            done.label = 'Done';
            done.y = menu_title.height + 5;
            menu.addChild(done);
            function onClick(e:MouseEvent):void {
                menu.close();
            }
            done.addEventListener(MouseEvent.CLICK, onClick);
        }
    }
}