开发者

Flex: Binding to the Height of the UITextField

I'm having problems binding the height of a UITextField to the y of a VBox and the height of the TitleWindow. I'm trying to adjust the height of the TitleWindow and the height of the VBox so, that the UITextField doesn't overlap the other content.

Alternatively, I've tried setting the height of the UITextField to an explicit height, but I haven't been able to get it to work.

I have to use a UITextField instead of Text, because I'm using Flash Eff2.

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" 
    layout="absolute" 
    width="520"  
    height="{tf.height + 380}">



<mx:Script>
    <![CDATA[
        import mx.core.UITextFormat;
        import mx.events.ItemClickEvent;

        import mx.controls.RadioButton;
        import mx.controls.RadioButtonGroup;
        import mx.core.UITextField;

        import mx.managers.PopUpManager;


        [Bindable]
        public var tf:UITextField = new UITextField;

        [Bindable]
        pub开发者_StackOverflow社区lic var myText:String;

        [Embed(source="../libs/arial.ttf", fontFamily="ArialEmbedded")]
            public const ArialEmbedded:Class;

        public function createEffect2():void{

                tf.autoSize = TextFieldAutoSize.LEFT;
                //tf.height=150;
                tf.embedFonts = true;
                tf.multiline = true;
                tf.text = myText;
                tf.width = 400;
                tf.wordWrap = true;

                var myFormat:TextFormat = new TextFormat;
                myFormat.size = 25;
                myFormat.blockIndent=50;

                this.addChild(tf);
                tf.validateNow();
                tf.setTextFormat(myFormat);
                } 

    ]]>
</mx:Script>



        <mx:VBox  x="180" y="{tf.height + 140}"  width="480"  >
            <mx:RadioButtonGroup id="choicesRadioButtonGroup" />
                <mx:RadioButton  groupName="choicesRadioButtonGroup" label="A" horizontalCenter="150"/>
                <mx:RadioButton  groupName="choicesRadioButtonGroup" label="B" horizontalCenter="150"/>
                <mx:RadioButton  groupName="choicesRadioButtonGroup" label="C" horizontalCenter="150"/>
        </mx:VBox>



</mx:TitleWindow>

I'm getting: Data Binding will not be able to detect assignments to "height".

Any suggestions?

Thank you.

-Laxmidi


If I had to guess, Binding is a Flex construct, not an "ActionScript' construct. Height is a made Bindable in UIComponent, but UITextField does not extend UIComponent. Instead it extends, FlexTextField, which extends TextField (A Closed source Flash class).

You can either extend UITextField and override height to make it Bindable or just use a Flex TextInput class, which does extend UIComponent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜