views:

228

answers:

2

Hello, I created my own validation control.

something like this control.mxml:

<mx:states>
 <mx:State name="ExceptionState">
  <mx:AddChild relativeTo="{hbox1}">
   <mx:TextArea id="txtError"  
    styleName="errorMessage" 
    width="140" minHeight="26" 
    wordWrap="true" editable="false" 
    /> 
  </mx:AddChild>
  <mx:SetProperty name="height" value="56" /> 
  <mx:SetProperty target="{txtInput}" name="y" /> 
  <mx:SetProperty name="width" value="100%" />  
 </mx:State>
</mx:states>
<mx:HBox width="100%" x="0" y="0" id="hbox1" styleName="nopadding">
 <mx:TextInput id="txtInput" 
  text="{text}" 
  displayAsPassword="{displayAsPassword}" 
  maxChars="{maxLength}" 
  cornerRadius="0" 
  height="22" 
  styleName="{inputStyleName}" 
  width="{_inputWidth}" 
  /> 
</mx:HBox>

When I validate the txtinput and it's not valid, the textarea will appear with some information in it.

Now I have several textinput fields in a canvas

<custom:control id="eerstes" errormessage("message1");/> <custom:control id="tweeds"errormessage("message2");/>

etc. but when eerstes is not valid, the textarea appears and my custom control with id tweeds will shift a little.

Is it possible to let the textarea float but that is is still relative to hbox1?

Thank you,

JSMB

+1  A: 

If I were you, I would try using the PopUpManager.addPopUp to place the TextField into the box. Once you've done that, you can manually reposition the TextField without effecting the alignment of the box's children. You may even be able to get this to work using BindingUtils, so that you don't have to reposition this every time.

On the other hand, you could use Alert.show, which would simply put a pop-up over the entire SWF.

Christopher W. Allen-Poole
A: 

What is the base class for your component custom:control ? Does it extend Canvas?

Phil C
yes, it does ............