Skip navigation
Currently Being Moderated

change verticalGap based on component's height

Oct 27, 2010 5:11 AM




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?


More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points