참조

http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001003.html
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001004.html

HTML 소스

<object
    classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
    codebase='http://download.macromedia.com/pub/shockwave/cabs/flash
        /swflash.cab#version=9,0,0,0'
    width='100%'
    height='100%'
    id='myMovie'>
    <param name='flashvars' value='fname=Nick&lname=Danger'>
    <param name='src' value='myApp.swf?myName=Nick&myHometown=San%20Francisco'>
    <embed pluginspage='http://www.macromedia.com/go/getflashplayer'
        width='300'
        height='100'
        flashvars='fname=Nick&lname=Danger'
        src='TitleTest.mxml.swf'
        name='myMovie'
        SWLIVECONNECT='true'
    />
</object>

mxml 소스
파라미터 이름으로 값 추출

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initVars()">
    <mx:Script><![CDATA[
        // Declare bindable properties in Application scope.
        [Bindable]
        public var myName:String;
        [Bindable]
        public var myHometown:String;
       
        // Assign values to new properties.
        private function initVars():void {
            myName = Application.application.parameters.myName;
            myHometown = Application.application.parameters.myHometown;
        }
    ]]></mx:Script>
   
    <mx:VBox>
    <mx:HBox>
        <mx:Label text="Name: "/>
        <mx:Label text="{myName}" fontWeight="bold"/>
    </mx:HBox>
    <mx:HBox>
        <mx:Label text="Hometown: "/>
        <mx:Label text="{myHometown}" fontWeight="bold"/>
    </mx:HBox>
    </mx:VBox>
</mx:Application>

파라미터 순서로 값 추출

for (var i:String in Application.application.parameters) {
    ta1.text += i + ":" + Application.application.parameters[i] + "\n";
}

신고

DataGrid 동적으로 데이타 바인딩 - 1

Programming/Flex 2007.08.07 16:25 Posted by 파란크리스마스

xmldata.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<root>
  <msg>ok</msg>
  <pagemax>20</pagemax>
  <pageinx>1</pageinx>
  <data>
    <row>
      <aaa>1</aaa>
      <bbb>a</bbb>
    </row>
    <row>
      <aaa>2</aaa>
      <bbb>b</bbb>
    </row>
    <row>
      <aaa>3</aaa>
      <bbb>b</bbb>
    </row>
  </data>
</root>

borad2.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
 creationComplete="xmlData1.send()">

 <mx:HTTPService id="xmlData1" url="http://localhost:8080/examples/xmldata.xml"/>

 <mx:DataGrid x="233" y="177" dataProvider="{xmlData1.lastResult.root.data.row}" width="457">
  <mx:columns>
   <mx:DataGridColumn headerText="Column 2" dataField="bbb"/>  
   <mx:DataGridColumn headerText="Column 1" dataField="aaa"/>
  </mx:columns>
 </mx:DataGrid>
 
</mx:Application>

신고

Flex DataGrid 동적으로 Column 생성하기 - 3

Programming/Flex 2007.08.03 17:47 Posted by 파란크리스마스

출처
http://blog.jidolstar.com/17

columninfo.xml


<?xml version="1.0" encoding="iso-8859-1"?>
<root>
  <msg>ok</msg>
  <columninfo>
    <column>
    <name>aaa</name>
   </column>
    <column>
    <name>bbb</name>
   </column>
  </columninfo>
</root>

test.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="448"
 creationComplete="init()">
 
  <mx:HTTPService id="httpdata" url="http://localhost:8080/examples/columninfo.xml" />
 
 <mx:Script>
  <![CDATA[
   import mx.collections.*;
   import mx.controls.dataGridClasses.DataGridColumn;
   import mx.rpc.events.FaultEvent;
   import mx.rpc.events.ResultEvent;

   
   public var httpServ:HTTPService;

   [Bindable]
   public var xlcData:XMLListCollection;
   
   public function init():void
   {
    httpServ = new HTTPService();
    request("http://localhost:8080/examples/columninfo.xml");
   }  
   
   public function request(url:String, params:Object=null):void
   {
    this.httpServ.url = url;
    this.httpServ.method = "GET";
    this.httpServ.resultFormat="e4x";
    this.httpServ.addEventListener("result", resultHandler);
    this.httpServ.addEventListener("fault", faultHandler);
    this.httpServ.send(params);
   }
   
   public function resultHandler(e:ResultEvent):void
   {
    var xlData:XMLList = new XMLList(e.result);
    if(xlData.elements("msg").toString()!="ok") {
     mx.controls.Alert.show(xlData.elements("msg").toString(),"Error");
    } else {
     xlcData = new XMLListCollection(xlData.elements("columninfo"));
    }
   
    var columns : Array = grid1.columns;
    var tmpCol : DataGridColumn;
   
//    mx.controls.Alert.show(xlcData.toXMLString());
   
    var item:XML;
       for each(item in xlcData.children()) {
        tmpCol =  new DataGridColumn();
        tmpCol.headerText = item.children().text();
        columns.push(tmpCol);
       }
     
       grid1.columns = columns;      
   }
   
   public function faultHandler(e:FaultEvent):void
   {
    mx.controls.Alert.show("데이타를 읽는 중 에러\n"+e.fault.faultString);
   }
   ]]>
  </mx:Script>  
 
  <mx:DataGrid id="grid1" x="54" y="106" width="280" height="139"/>
  <mx:Button x="54" y="60" label="Button"/>
 
</mx:Application>

신고

Flex DataGrid 동적으로 Column 생성하기 - 2

Programming/Flex 2007.08.03 14:15 Posted by 파란크리스마스

출처
http://flexdocs.kr/docs/flex2/langref/XMLList.html

http://www.ihelpers.co.kr/programming/tipntech.php?CMD=view&TYPE=8&KEY=&SC=S&&CC=&PAGE=1&IDX=547


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="448">
 
  <mx:XMLList id="testlist">
    <column>
    <name>aaa</name>
   </column>
    <column>
    <name>bbb</name>
   </column>   
  </mx:XMLList>

  <mx:Script>
   <![CDATA[
    import mx.controls.dataGridClasses.DataGridColumn;
   
     private function createColumn():void
     {
      var columns : Array = grid1.columns;
      var tmpCol : DataGridColumn;
     
        var item:XML;
//        for (var i:uint=1; i<=testlist.length(); i++) {
        for each(item in testlist) {
         tmpCol =  new DataGridColumn();
        tmpCol.headerText = item.children().text();
        columns.push(tmpCol);  
        }
        
      grid1.columns = columns;
     }
    ]]>
  </mx:Script>
 
  <mx:DataGrid id="grid1" x="54" y="106" width="280" height="139"/>
 
  <mx:Button x="54" y="60" label="Button" click="{createColumn()}"/>

 
</mx:Application>

신고

Flex DataGrid 동적으로 Column 생성하기

Programming/Flex 2007.08.03 10:29 Posted by 파란크리스마스

출처
http://www.ihelpers.co.kr/programming/tipntech.php?CMD=view&TYPE=8&KEY=&SC=S&&CC=&PAGE=1&IDX=547

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="448">
  <mx:Script>
   import mx.controls.dataGridClasses.DataGridColumn;

    private function createColumn():void
    {
     var columns : Array = grid1.columns;
     var tmpCol :DataGridColumn =  new DataGridColumn();
     tmpCol.headerText = "Test";
     columns.push(tmpCol);
     
     grid1.columns = columns;
    }
  </mx:Script>
 
  <mx:DataGrid id="grid1" x="54" y="106" width="280" height="139"/>
 
  <mx:Button x="310" y="41" label="Button" click="{createColumn()}"/>
 
</mx:Application>

신고


 

티스토리 툴바