views:

33

answers:

1

Hi,

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]
        public 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

+1  A: 

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.

www.Flextras.com
Hi www.Flextras.com, Thank you for the message. I've also tried setting heights for the UITextField and the TitleWindow with explicit values, but the formatting gets screwed up. I get the UITextField running vertically down the left side of the TitleWindow one character wide. If I remove the heights, then it works okay. (Although, I have to set the verticalScrollPolicy to off). Kinda weird.
Laxmidi
Thanks for the upvote. Is your issue solved? If so, please mark my question as the answer. [Or post your alternate solution and mark that as the answer].
www.Flextras.com