Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <custom:ApplicationClass xmlns:custom="components.*"/>
- package components {
- import mx.core.Application;
- import mx.events.FlexEvent;
- import flash.events.MouseEvent;
- import mx.controls.Alert;
- import mx.controls.Button;
- public class ApplicationClass extends Application {
- public function ApplicationClass () {
- addEventListener (FlexEvent.CREATION_COMPLETE, handleComplete);
- }
- private function handleComplete( event : FlexEvent ) : void {
- var button : Button = new Button();
- button.label = "My favorite button";
- button.styleName="halo"
- button.addEventListener(MouseEvent.CLICK, handleClick);
- addChild( button );
- }
- private function handleClick(e:MouseEvent):void {
- Alert.show("You clicked on the button!", "Clickity");
- }
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <local:MyApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:local="components.*" />
- package components {
- import flash.events.MouseEvent;
- import mx.controls.Alert;
- import mx.events.FlexEvent;
- import spark.components.Application;
- import spark.components.Button;
- public class MyApplication extends Application {
- public function MyApplication() {
- addEventListener(FlexEvent.CREATION_COMPLETE, creationHandler);
- }
- private function creationHandler(e:FlexEvent):void {
- var button : Button = new Button();
- button.label = "My favorite button";
- button.styleName="halo"
- button.addEventListener(MouseEvent.CLICK, handleClick);
- addElement( button );
- }
- private function handleClick(e:MouseEvent):void {
- Alert.show("You clicked it!", "Clickity!");
- }
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
- <mx:Script source="Script.as" />
- </mx:Application>
- import mx.controls.Button;
- import flash.events.MouseEvent;
- import mx.controls.Alert;
- import mx.core.Application;
- private function onCreationComplete() : void {
- var button : Button = new Button();
- button.label = "Click me";
- button.addEventListener(MouseEvent.CLICK, function(e : MouseEvent) : void {
- Alert.show("Clicked");
- });
- Application.application.addChild(button);
- }
- package {
- import mx.core.Application;
- public class MyFancyApplication extends Application {
- // do whatever you want here
- }
- }
Add Comment
Please, Sign In to add comment