6 Replies Latest reply: Mar 16, 2011 9:22 AM by kglad RSS

    Missing info in manuals

    barpos Community Member

      Hi,

       

      The programming/developer manuals tell us this:

       

      >In order to have a display object appear in the display list, you must add it to a display object container that is on the display list.<

       

      But, they (intentially or not) fail to tell us how to add a display object container to the display list.

       

      The following code renders a blank screen (nothing gets displayed):

       

      var tf1:TextField = new TextField();
      var tf2:TextField = new TextField();
      tf1.name = "text 1";
      tf2.name = "text 2";
      var container1:Sprite = new Sprite();
      var container2:Sprite = new Sprite();
      container1.addChild(tf1);
      container1.addChild(tf2);
      container2.addChild(tf1);

       

      I tried addChild(Container2), but to no avail.

       

      What gives?  Is this a hidden secret?

       

      Ronald

        • 1. Re: Missing info in manuals
          Ned Murphy CommunityMVP

          Aside from needing to add the two containers, you need to add some content that actually displays something you can see... your textfields are empty.

          • 2. Re: Missing info in manuals
            kglad CommunityMVP

            using addChild() adds displayobjects to the displaylist.

             

            your problem is not adding to the displaylist.  your problem is that your displayobjects have no content.

             

            if you assigned text to your textfields or even just enabled their border, you would see content.  they'll all be overlapping but that's another issue.

            • 3. Re: Missing info in manuals
              barpos Community Member

              Sorry!  I didn't realized that.  I copied and pasted the code from the manual.

               

              The following does work, just not sure it is the RIGHT way though:

               

              var mySquare_mc:MovieClip = new Square();
              mySquare_mc.x = 300;
              mySquare_mc.y = 300;
              var myContainer:Sprite = new Sprite();
              myContainer.addChild(mySquare_mc);
              addChild(myContainer);

               

              Thanks!

               

              Ron

              • 4. Re: Missing info in manuals
                kglad CommunityMVP

                is there any purpose served by using myContainer?  if not, remove that part of your code:

                 

                addChild(mySquare);

                • 5. Re: Missing info in manuals
                  barpos Community Member

                  Yes, there is.  I don't want the tweens (and their associated symbol objects) I create dynamically to mix with my stage objects.  Reason, I'll be making a FOR structure routine soon that'll automatically resize display objects on the stage (dragged on in Flash).  As I've realized, tweens cannot be resized the same way as other display objects, therefore one has to execute the tween code separately and alter its property arrays accordingly to reflect needed changes.

                   

                  Anyhow, this thread is somewhat related to my other thread.  As you suggested, I'll be moving my loaded images into a movieclip container.  Actually, I won't need to make the container visible after all.  addTarget() seems to act like addChild(), displaying the symbol passed to it. <s>

                   

                  Ron

                  • 6. Re: Missing info in manuals
                    kglad CommunityMVP

                    ok.

                     

                    p.s.  please mark helpful/correct responses.