Onelong

分享知识,与你一起进步......
RSS icon Home icon
  • flex4动态添加控件

    post by onelong / 2010-3-27 20:42 Saturday [MXML/ActionScript3.0]

    <?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="init()">
     <fx:Script>
      <![CDATA[
       import spark.components.Button;
       private function init():void{
        var s:Button=new Button();
        s.label="你好!"
        var s1:Button=new Button();
        s1.label="你好?"
        //this.addElement(s);
        ss.addElement(s);
        ss.addElement(s1);
       }
      ]]>
     </fx:Script>
     <s:BorderContainer x="98" y="44" id="ss">
      <s:layout>
       <s:HorizontalLayout/>
      </s:layout>
      <s:Button label="onelong"/>
      <s:Button label="onelong"/>
     </s:BorderContainer>
    </s:Application>
    flex4已经不能使用addChild();而是addElement()添加元素的!!
    还有flex不能添加Sprite()。。。

    标签: MXML flex 4
    引用地址:
     

    我要评论