4,328
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="onInit()">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
/**
* 主要显示对象,继承至displayobject类
*/
private var shape:Shape;
private var simpleBtn:SimpleButton;
private var textField:TextField;
private var sprite:Sprite;
/**
* 初始化显示对象
*/
private function onInit():void {
textField = new TextField();
textField.text = "123";
textField.x = 0;
textField.y = 0;
textField.width = 120;
textField.height = 30;
videoHolder.addChild(textField);
}
]]>
</fx:Script>
<s:SpriteVisualElement id="videoHolder" width="100%"
height="100%"/>
</s:Application>
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="onInit()">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
private var mainUi:UIComponent;
/**
* 主要显示对象,继承至displayobject类
*/
private var shape:Shape;
private var simpleBtn:SimpleButton;
private var textField:TextField;
private var sprite:Sprite;
/**
* 初始化显示对象
*/
private function onInit():void {
mainUi = new UIComponent();
mainUi.x = mainUi.y = 0;
mainUi.percentHeight = mainUi.percentWidth = 100;
this.addElement(mainUi);
shape = new Shape();
//shape.x = 310;
//shape.y = 0;
//shape.width = shape.height = 100;
shape.graphics.beginFill(0x00FF00);
shape.graphics.drawCircle(0, 0, 20);
shape.graphics.endFill();
mainUi.addChild(shape);
simpleBtn = new SimpleButton();
simpleBtn.x = 0;
simpleBtn.y = 100;
simpleBtn.width = 80;
simpleBtn.height = 30;
mainUi.addChild(simpleBtn);
textField = new TextField();
textField.text = "123";
textField.x = 200;
textField.y = 500;
textField.width = 120;
textField.height = 30;
mainUi.addChild(textField);
sprite = new Sprite();
//sprite.x = 200;
//sprite.y = 200;
//sprite.width = shape.height = 100;
sprite.graphics.beginFill(0x00FF00);
sprite.graphics.drawRect(0, 0, 50, 50);
sprite.graphics.endFill();
mainUi.addChild(sprite);
}
]]>
</fx:Script>
</s:Application>