1 Reply Latest reply on Jan 18, 2010 11:12 PM by Sophie_cordier

    Layout problem

    SiHoop Level 1

      The Text object named spellingExplanation which is a child of textContainer appears too far to the right of the scoreCard HBox-- what am I doing wrong? I want it to appear right next to the last Text object.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"   creationComplete="init()">
          <mx:Script>
              <![CDATA[
          import mx.core.UIComponent;
      private function init():void{
          var textContainer:UIComponent=new UIComponent;
          scoreCard.addChild(textContainer)
          textContainer.addChild(spellingExplanation)
      }
              ]]>
          </mx:Script>
          <mx:HBox id="scoreCard" >
              <mx:Text   text="Total Correct" />
              <mx:Text   text="Total Incorrect" />
              <mx:Text  id="spellingExplanation"  text="Possible  error" />
          </mx:HBox>
      </mx:Application>

        • 1. Re: Layout problem
          Sophie_cordier

          Hello,

           

          As it appears in your code, you add the 'spellingExplanation' Text object twice: first in the init() function and then in mxml part.


          The line :  <mx:Text  id="spellingExplanation"  text="Possible  error" /> is similar to textContainer.addChild(spellingExplanation).

           

          Try to remove the init() function and test it again. It should work just fine.

           

          Sophie