1 Reply Latest reply on Oct 27, 2010 5:29 AM by Ibarim

    change verticalGap based on component's height

    Ibarim Level 1




      I got a vBox inside some main Canvas component. I want to set this vBox's verticalGap property based on the Canvas height. Canvas height is set in % so it's changing on different computers.


      The problem is that I don't know where to set this property to make it override the default verticalGap value. I got mxml code like this:


      <mx:Canvas height="80%"  id="myCanvas">
           <mx:VBox verticalGap = "0" id="myVBox">


      and I want this script to execute:


      if (myCanvas.height > 500) myVBox.setStyle("verticalGap", 50)


      If above script executes on creationComplete event it has no effect (verticalGap property remains "0"). Doesn't matter if the event is on creaction complete of canvas or vbox, in both cases it doesn't work (in both cases canvas.height >500).


      What do I do wrong?