달력

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

'플렉스'에 해당되는 글 2

  1. 2011.11.11 [Flex] TextInput 한글 일본어 짤림현상.
  2. 2011.09.19 [Flex] Application에 Scroller 넣기. 1
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. 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 알 수 없는 사용자