Search

'array'에 해당되는 글 2건

  1. 2007.08.14 Flex - Button
  2. 2007.08.10 Flex - 데이타타입(DataType)

Flex - Button

Programming/Flex 2007.08.14 15:22 Posted by 파란크리스마스

- Click Event

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

 <mx:Script>
  <![CDATA[

    private function on_ButtonClick(event:Event):void {
    mx.controls.Alert.show(
     event.type  // click
     + "\n" + event.currentTarget.name  // Button1
     + "\n" + Button(event.currentTarget).label  // ButtonLabel
     + "\n" + event.toString()  // [MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=63 localY=12 stageX=73 stageY=22 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]
    );  
    }  
   ]]>
  </mx:Script>

 <mx:Button x="10" y="10" label="ButtonLabel" click="on_ButtonClick(event)" id="Button1"/>
 
</mx:Application>

- Create Button


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

 <mx:Script>
  <![CDATA[

    private function on_ButtonClick(event:Event):void {
     
     var array_num:Array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#"];
     var base_x:int = 10;
     var base_y:int = 90;
     var button_width:int = 30;
     var button_height:int = 45;
     
     for (var i:int = 0; i<4; i++) {
      for (var j:int = 0; j<3; j++) {
           var button:Button = new Button();
           button.label = array_num[ (i * 3) + j ];
           button.x = base_x + (j * button_width);
            button.y = base_y + (i * button_height);
            button.width = button_width;
            button.height = button_height;
            button.setStyle("fontSize", 14);
            this.addChild(button);
            button.addEventListener(MouseEvent.CLICK, clickHandler);
      }     
     }
    }  
   
    private function clickHandler(event:MouseEvent):void{
     Text1.text = Text1.text + Button(event.currentTarget).label;
    }     
   ]]>
  </mx:Script>

 <mx:Button x="10" y="10" label="Create Button" click="on_ButtonClick(event)" id="Button1" />
 <mx:TextArea x="10" y="40" id="Text1" fontSize="14"/>
 
</mx:Application>

신고

Flex - 데이타타입(DataType)

Programming/Flex 2007.08.10 17:32 Posted by 파란크리스마스

츨처

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

단순 데이타 타입

int, uint, Number, Boolean, String, void, Null

var value:int = 123; // int.MAX_VALUE = 2,147,483,647 , int.MIN_VALUE  = -2,147,483,648
var value:unit = 4000000;
var value:uint = 0x336699FF;
var value:uint = new uint( 0x336699FF );
var value:Number = 123.45; // MAX_VALUE = 1.79769313486231e+308 , Number.MIN_VALUE = 4.940656458412467e-324
var value:Boolean = true;
var value:String = "Hello World!";

복합 데이타 타입

Arrays

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

 <mx:Script>
  <![CDATA[
   public function test():void
   {
    var value1:String = "a";
    var value2:String = "b";
    var value3:String = "c";

    var values1:Array = new Array( value1, value2, value3);
    var values2:Array = [value1, value2, value3];

    var values3:Array = new Array();
    values3[ 0 ] = value1;
    values3[ 1 ] = value2;
    values3[ 2 ] = value3;

    var values4:Array = new Array();
    values4.push( value1);
    values4.push( value2);
    values4.push( value3);
   
    trace("0 values4.length = " + values4.length);
   
    var value1_1:String = values4.pop();
    var value2_1:String = values4.pop();
    var value3_1:String = values4.pop();
   
    trace("1 values4.length = " + values4.length);
    trace("value3_1 = " + value3_1);
    trace("value2_1 = " + value2_1);
    trace("value3_1 = " + value3_1);
   
   }
   ]]>
  </mx:Script>
 
 <mx:Button x="33" y="172" label="Button" click="test()"/>

</mx:Application>


trace

0 values4.length = 3
1 values4.length = 0
value3_1 = a
value2_1 = b
value3_1 = a
신고


 

티스토리 툴바