box-o-sand/flex-practice/03c7-mxml-vs-as3/WithAs3.mxml

34 lines
956 B
XML

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#FFFFFF"
backgroundAlpha="0"
initialize="addControls()">
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.controls.Label;
private function addControls():void {
createImage();
createPhotographer();
}
private function createImage():void {
var photo:Image = new Image();
photo.source = "assets/animals03.jpg";
boxetyBox.addChild(photo);
}
private function createPhotographer():void {
var photographer:Label = new Label();
photographer.text = "Photographed by Elsie Weil";
boxetyBox.addChild(photographer);
}
]]>
</mx:Script>
<mx:Box id="boxetyBox"/>
</mx:Application>