2 Replies Latest reply on May 27, 2008 11:55 AM by ctzn99

    How to set vertical/horizontal gap in as3

    f_l_e_x
      Hi,

      I have this problem where in mxml i can set vertical gap
      However, I am having difficulties setting the gap when i extend a vbox/hbox in as3

      var mainBox:VBox = new VBox();
      //mainBox.gap?

      but the below works

      <mx:VBox id="mainBox" verticalGap="0">
      </mx:VBox>

      Thanks heaps
        • 1. How to set vertical/horizontal gap in as3
          laurent_pinson Level 1
          try something like mainBox.setStyle("vertical-gap",0);

          edit:
          If you look here: http://livedocs.adobe.com/flex/3/langref/mx/containers/Box.html , you can see verticalGap is part of Box styles. So you can use the setStyles(style:String,value:Object) method to modify it.

          Often (perhaps always), when a style is called alphaBetaGamma (like an instance: first word with low caps and others with high caps) then it's "String value" will be hyphen separated-word: "alpha-beta-gamma".

          Remember this ;)

          Laurent
          • 2. Re: How to set vertical/horizontal gap in as3
            ctzn99
            quote:

            Originally posted by: laurent pinson

            Often (perhaps always), when a style is called alphaBetaGamma (like an instance: first word with low caps and others with high caps) then it's "String value" will be hyphen separated-word: "alpha-beta-gamma".

            Laurent


            No. Unlike dealing with javascript and css you NEVER need to (or want to as it won't work) hyphenate the names of styles.

            You're right that it is a style and that you use the setStyle method of the vbox to set the vertical gap but it's just:

            mainBox.setStyle("verticalGap", 0);

            where "0" is of course whatever you want the vertical gap to be.