달력

5

« 2025/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2011. 11. 11. 11:32

[Flex] TextInput 한글 일본어 짤림현상. 공부/flex2011. 11. 11. 11:32


TextInput에서 "한글테스트입니다" 라고 입력했을때, 화면에서는 제대로 보이지만

textInput.text 해서 값을 가져왔을 경우는 "한글테스트입니" 라고 값이 짤려서 가져오는 데

아직 글을 작성중으로 인식해서 TextField에만 값이 있고 Text로넘어가지 않은 상태입니다.

mx:TextInput에서는 textfield에 직접 접해서 textField.text로해서 값을 가져옴..

public class CTextInput extends TextInput
 {
    public function CTextInput()
    {
        super();
    }
    override public function get stext():String{
               return textField.text;
    }
 }

s:TextInput에서는 RichEditableText 에 직접 접해서 값을 가져옴..


public class CTextInput extends TextInput
 {
    public function CTextInput()
    {
        super();
     }
     override public function set text(value:String):void{
        super.text = value;
    }
    override public function get text():String{
         var rich:RichEditableText = this.textDisplay as RichEditableText;
         var tflow:SpanElement = rich.textFlow.mxmlChildren[0].mxmlChildren[0];
         return tflow.text;
     }
 }
:
Posted by 알 수 없는 사용자
2011. 10. 11. 11:49

[Flex] spark DropDownList MultiSelect 공부/flex2011. 10. 11. 11:49





Application.mxml
<?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" xmlns:component="component.*"
     >
 <fx:Script>
  <![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable]
   public var acList:ArrayCollection = new ArrayCollection([
    {label:"JAVA",selected:false},
    {label:".NET",selected:false},
    {label:"C++",selected:false},
    {label:"FLEX",selected:false}]);
   public function getSelectionLabel():void{
      lbSelections.text = "";
      ddlMultiSelection.labelDisplay.text = "MultiSelected";
      for (var i:int = 0; i < acList.length; i++)
     {
         if(acList[i].selected){
            lbSelections.text += " " + acList[i].label;
          }
      }
   }
  ]]>
 </fx:Script>
 <s:HGroup width="100%" height="100" left="20" top="20" verticalAlign="middle">
      <s:DropDownList id="ddlMultiSelection"
              itemRenderer="renderers.MultiSelectItemRenderer"
              dataProvider="{acList}" close="getSelectionLabel()" />
       <s:Label id="lbSelections" text="Selected Items...."/>
 </s:HGroup>
</s:Application>



MutiSelectItemRenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    autoDrawBackground="true" width="100%">
 <fx:Script>
  <![CDATA[
   import mx.core.IFlexDisplayObject;
   private function evnetMouseEventControll(event:MouseEvent):void{
       event.stopImmediatePropagation();
   }
   private function eventChangeSelection():void{
       data.selected = checkbox.selected;
   }
  ]]>
 </fx:Script>
 <s:CheckBox id="checkbox"
    width="100%"
    selected="{data.selected}"
    label="{data.label}"
    mouseUp="evnetMouseEventControll(event)"
    mouseDown="evnetMouseEventControll(event)"
    change="eventChangeSelection()"/>
 
</s:ItemRenderer>



결과화면

:
Posted by 알 수 없는 사용자
2011. 10. 5. 14:49

[Flex] CursorManager && Graphic..path.. 공부/flex2011. 10. 5. 14:49


<?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"
      creationComplete="eventInit()">
 <fx:Script>
  <![CDATA[
   import component.CGraphicBase;
   
   import mx.managers.CursorManagerPriority;
   import mx.managers.CursorManager;

   [Bindable]
   [Embed(source="img/tag.png")]
   public var customCursor:Class;
   private function eventInit():void{
        var oItem:Object = new Object();
        oItem.name = "testGraphic";
        oItem.today = new Date();
        //make Graphic
         var oGraphic:CGraphicBase = new CGraphicBase();
        oGraphic.graphicInfo = oItem;
        oGraphic.width =200;
        oGraphic.height = 100;
        oGraphic.x = 100;
        oGraphic.y = 100;
        oGraphic.color = 0xF19232;
        oGraphic.toolTip = oItem.name + "-" + oItem.today.toString();
        oGraphic.reFreshImage();
        oGraphic.addEventListener(MouseEvent.MOUSE_OVER,eventMouseOver);
        oGraphic.addEventListener(MouseEvent.MOUSE_OUT,eventMouseOut);
        bc.addElement(oGraphic);
   }
   private function eventMouseOver(event:MouseEvent):void{
        var oTarget:CGraphicBase = event.currentTarget as CGraphicBase;
        CursorManager.setCursor(customCursor, CursorManagerPriority.HIGH, 3, 2);
   }
   private function eventMouseOut(event:MouseEvent):void{
        var oTarget:CGraphicBase = event.currentTarget as CGraphicBase;
        CursorManager.removeAllCursors();
   }
  ]]>
 </fx:Script>
 <s:BorderContainer id="bc" width="100%" height="100%">
  
 </s:BorderContainer>
</s:Application>
 





CGraphicBase

<?xml version="1.0" encoding="utf-8"?>
<s:Graphic xmlns:fx="http://ns.adobe.com/mxml/2009"
     xmlns:s="library://ns.adobe.com/flex/spark"
     xmlns:mx="library://ns.adobe.com/flex/mx"
     xmlns:common="common.*">
 <fx:Script>
  <![CDATA[
   private var oInfo:Object;
   public function set graphicInfo(value:Object):void{
    oInfo = value;
   }
   public function get graphicInfo():Object{
    return oInfo;
   }
   public function set color(value:uint):void{
    ge.color = value;
   }
   public function set fillAlpha(value:Number):void{
    ge.alpha = value;
   }
   public function get fillAlpha():Number{
    return ge.alpha;
   }
   public function reFreshImage():void{
    btnPath.data = "M 0 0 L "+this.width.toString()+" 0 L "+this.width.toString()+" "+this.height.toString()+" L 0 "+this.height.toString()+ " L 0 0 ";
   }
  ]]>
 </fx:Script>
 <s:Path id="btnPath">        
  <s:fill>
   <s:LinearGradient rotation="90">
    <s:GradientEntry id="ge" color="#F7CB3C" alpha=".6"/>
   </s:LinearGradient>
  </s:fill>       
  <s:stroke>            
   <s:SolidColorStroke id="outline" alpha="1" color="{ge.color}" weight="1" />       
  </s:stroke>    
 </s:Path>
</s:Graphic>



:
Posted by 알 수 없는 사용자
2011. 10. 5. 11:28

[Flex] Spark DataGrid ItemRenderer 공부/flex2011. 10. 5. 11:28



<s:DataGrid id="dg" width="100%" height="100%" dataProvider="{acDGData}">
         <s:columns>
          <s:ArrayList>
           <s:GridColumn headerText="no." dataField="no"/>
           <s:GridColumn headerText="社員名" dataField="name"/>
           <s:GridColumn headerText="お知らせ" dataField="news">
            <s:itemRenderer>
             <fx:Component>
              <s:GridItemRenderer>
               <s:TextArea text="{data.news}"/>
              </s:GridItemRenderer>
             </fx:Component>
            </s:itemRenderer>
           </s:GridColumn>
          </s:ArrayList>
         </s:columns>         
        </s:DataGrid>
:
Posted by 알 수 없는 사용자
2011. 9. 23. 22:20

[Flex] Date "YYYY/MM/DD" 공부/flex2011. 9. 23. 22:20


import mx.controls.Alert;
   import mx.controls.DateField;
   public var oDay:Array = new Array("日","月","火","水","木","金","土");
   private function eventInit():void{
    var today:Date = new Date();
    Alert.show(DateField.dateToString(today, "YYYY/MM/DD") + "("+oDay[today.day]+")");
   }
* HH:NN:SS 시간 포멧 부분
결과화면

:
Posted by 알 수 없는 사용자
2011. 9. 19. 12:26

[Flex] Application에 Scroller 넣기. 공부/flex2011. 9. 19. 12:26

flex3에서는 Application에 minHeight , minWidth를 정하면 자동으로 스크롤이 생겼는데
spark component로 되면서 스크롤을 따로 넣어주어야 스크롤이 생깁니다.
물론 Application에 width=1000 height=800 이렇게 넣어주면 브라우저가 이 사이즈보다 작아졌을 경우에는 브라우저 자체 스크롤이 생깁니다. 그렇지만 브라우저가 이 사이즈보다 커지면 흰여백으로 채워지기 때문에 width=100% height=100%를 해줘야합니다.

스크롤을 어떻게 써야될까
찾아보니, Application에 SkinClass를 생성해서 body부분이 될 Group컴포넌트를 Scroller로 감싸주면 된다는 것.
<Applicaiont 부분>



<skinClass부분>


  <!--- @copy spark.components.SkinnableContainer#contentGroup -->
  <s:Scroller  width="100%" height="100%">
         <s:Group id="contentGroup" width="100%" height="100%" minWidth="1200" minHeight="824" />
  </s:Scroller>

또는 Application 내부에 Scroller를 넣어 다른 객체들을 감싸는것.


<?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"
     width="100%" height="100%" >
 <fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
 </fx:Declarations>
 <s:Scroller id="sc" width="100%" height="100%">
  <s:Group id="gr" width="100%" height="100%" >
   <s:BorderContainer id="bc" width="100%" height="100%" minWidth="1200" minHeight="824">
    <s:backgroundFill>
     <s:LinearGradient rotation="90">
      <s:GradientEntry color="0x3D7ACF" alpha=".9" />
      <s:GradientEntry color="0x3D7ACF" alpha=".6" />
      <s:GradientEntry color="0x3D7ACF" alpha=".6" />
      <s:GradientEntry color="0x3D7ACF" alpha=".6" />
      <s:GradientEntry color="0x3D7ACF" alpha=".6" />
      <s:GradientEntry color="0x3D7ACF" alpha=".9" />
     </s:LinearGradient>
    </s:backgroundFill>
    <s:Label id="lb" text="FLEX TEST" color="0xFF0000" fontSize="50"
       top="{(bc.height - lb.height)*0.5 }"
       left="{(bc.width - lb.width)*0.5}"/>
   </s:BorderContainer>
  </s:Group>
 </s:Scroller>
</s:Application>


결과화면.


주의!!
Application과 Scroller에 minHeight또는 minWidth을 지정하지 않는다.
Application과 Scroller의 width height는 100%!!
Scroller안에 Group을 넣고 Group이나 내부컨테이너에 크기지정하기!!


Scroller가 빠져서 가벼워졌을진 모르겠지만 엄청 귀찮아졌네요..-_- 곰방 익숙해지겠지만....

reference: adobe flex 4.5 help
:
Posted by 알 수 없는 사용자