Alright then, updating to Actionscript 3 the example linked in the previous post which was Actionscript 2, we get something that works, like this...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp(event)">
<mx:Script>
<![CDATA[
import flash.events.Event;
import flash.events.MouseEvent;
import mx.containers.Panel;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.Label;
import mx.controls.TextInput;
public var submit_button:Button = null;
public var first_text:TextInput = null;
public function initApp(event:Event):void {
var panel:Panel = new Panel();
panel.title = "Hello World";
addChild(panel);
var label:Label = new Label();
label.text = "First Name";
panel.addChild(label);
first_text = new TextInput();
first_text.text = "Patrick";
panel.addChild(first_text);
submit_button = new Button();
submit_button.label = "Submit";
panel.addChild(submit_button);
submit_button.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
public function onMouseUp(event:MouseEvent):void {
Alert.show("Hello " + first_text.text + "!", "Message");
}
]]>
</mx:Script>
</mx:Application>
If you have the free Flex 2 SDK you can compile and run it like this...
$ mxmlc something_else.mxml
Loading configuration file /home/patrick/flex2/frameworks/flex-config.xml
/home/patrick/dev/patrick.logan/flashstuff/formstuff/something_else.swf (143036 bytes)
$ flashplayer something_else.swf
2 comments:
Next step: get rid of the mxml entirely; not doubt it'll be fun to figure out the 'application' goop that's required ...
Yeah, well. :-)
That was my original aim when I set out yesterday afternoon on this journey.
But there is a lot of goop in there. I don't mind at least for now the small mxml boiler as long as I can do everything else at runtime.
Post a Comment