flex学习笔记(一)as3中添加组件
来源:互联网 发布:淘宝亲宝贝商家入口 编辑:程序博客网 时间:2024/05/18 02:22
1。添加属于 mx.controls的组件
<?xml version="1.0"?>
<!-- usingas/ASVisualComponent.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
import mx.controls.Button;
public var button2:Button;
public function createObject():void {
button2 = new Button();
button2.label = "Click Me";
hb1.addChild(button2);
}
]]></mx:Script>
<mx:HBox id="hb1">
<mx:Button label="Create Object" click="createObject()"/>
</mx:HBox>
</mx:Application>
2。添加不属于 mx.controls的组件
In other words, if you create a new object that is not a subclass of mx.core.UIComponent, you must
wrap it in a UIComponent before you can attach it to a container. The following example
creates a new Sprite object, which is not a subclass of UIComponent, and adds it as a child of
the UIComponent before adding it to the Panel container:
<?xml version="1.0"?>
<!-- usingas/AddingChildrenAsUIComponents.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
import flash.display.Sprite;
import mx.core.UIComponent;
private function addChildToPanel():void {
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFFCC00);
circle.graphics.drawCircle(0, 0, 20);
var c:UIComponent = new UIComponent();
c.addChild(circle);
panel1.addChild(c);
}
]]></mx:Script>
<mx:Panel id="panel1" height="100" width="100"/>
<mx:Button id="myButton" label="Click Me" click="addChildToPanel();"/>
</mx:Application>
- flex学习笔记(一)as3中添加组件
- Flex 学习笔记(十) AS3中给组件的color赋值
- Android学习笔记:(一)添加自定义组件(slideMenu)
- flex datagrid组件 中添加别的组件(上半部分)
- flex 学习笔记(一)
- Flex学习笔记(一)
- Flex学习笔记(一)
- Flex学习笔记(一)
- flex datagrid组件中添加别的组件
- Flex学习笔记(一)
- Flex学习笔记(一)
- flex as3开源组件
- flex as3开源组件
- FLEX中给组件添加自定义事件
- 向FLEX容器组件中添加sprite
- FLEX中给组件添加自定义事件
- FLEX中给组件添加自定义事件
- ActionScript3 学习笔记(一) as3语言基本要素
- DB2 基础: 日期和时间的使用
- com.opensymphony.workflow包研究
- hello
- 用JMail发送邮件的程序分享
- 带外数据详解
- flex学习笔记(一)as3中添加组件
- VC其它-如果将VC中的字体换成Verdana
- 多线程编程之二——MFC中的多线程开发
- Java语言中Timer类的简洁用法
- MEDC ANZ(MEDC Australia/New Zealand) 2007 PPT 官方提供下载
- 秘鲁前总统藤森欲参加日本议会选举
- 深入java的equals方法,怎么比较两个对象的内容是否相等?对象的内容指的是什么?
- Delphi的SOAP Header问题
- JAVA 向上转型 只能掉父类方法?