2010-03-24 2 views

답변

1

나는 해결책을 발견했습니다.

해피 해킹.

package 
{ 
import flash.display.DisplayObject; 

import mx.controls.Image; 
import mx.controls.TextInput; 
import mx.core.mx_internal; 

use namespace mx_internal; 

public class MyTextInput extends TextInput 
{ 
    private var _image:Image; 

    public function MyTextInput() 
    { 
     super(); 
    } 

    override protected function createChildren():void 
    { 
     super.createChildren(); 

     _image = new Image(); 
     _image.source = "http://sstatic.net/so/img/replies-off.png", 

     addChild(DisplayObject(_image)); 
    } 

    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
    { 
     super.updateDisplayList(unscaledWidth, unscaledHeight); 

     this._image.width = 16; 
     this._image.height = 16; 

     this._image.x = this.width - this._image.width - 5; 
     this._image.y = this.height - this._image.height; 

     this.textField.width = this.width - this._image.width - 5; 
    } 
} 
} 
1

에서

덕분에 원하는 텍스트 입력과 같은 MXML 컴퍼넌트를 작성하는 것이 작업을 수행하는 쉬운 방법. Mac OSX 검색 상자는 본 적이 없지만 캔버스를 흰색 배경으로 구성한 구성 요소를 바탕으로 적절한 경계선은 경계선없이 이미지와 텍스트 입력을 포함 할 수 있습니다. 이것은 당신이 내가 생각하는 모양을 줄 것입니다. 여기서 D는 트릭이가 updateDisplayList을 무시했다 코드

입니다 :

+0

우리는 텍스트 입력을위한 스타일을 변경하면 내가 그 구성 요소로 이동하여 스타일을 다시 캔버스에 적절한 모양을 제공하기 위해 노력하고 시간을 보내고 싶어하지 않기 때문에 내가 그 해결 방법을 피하기 위해 노력하고있어 & 느낌. 그러나 팁에 감사드립니다. – Felipe

+0

나는 그것을 이해할 수 있지만 이것이 해결책이 아님을 이해한다; 이것은 flex가하도록 설계된 것입니다. 사실이 경우 한 번만 수행하면 flex build의 GUI 디자인 모드를 사용하면 업데이트하고 변경하기가 더 쉬워집니다. – invertedSpear