3 Replies Latest reply on Mar 3, 2010 5:24 PM by David_F57

    addChild flex 4

    mikedhart

      hello fellow flexers. having a bit of a problem migrating to flex 4 using addChild(); i dont get an error in eclipse but i get an error in the browser using the below code:

       

      import mx.controls.Image;

      import mx.effects.*;

       

      private var backgroundImage:Image;

      protected function init():void

      {

      backgroundImage = new Image;

      backgroundImage.width = 733;

      backgroundImage.height = 550;

      backgroundImage.setStyle("completeEffect",Fade);

      backgroundImage.load("images/homeScreen/image1.jpg");

      addChild(backgroundImage);

      }


      any ideas?

        • 1. Re: addChild flex 4
          David_F57 Level 5

          hi,

           

          have you tried addElement, this is the spark replacement for addChild, at the moment addChild is used for mx based parents and addElement is used for spark based containers.

           

           

          David.

          1 person found this helpful
          • 2. Re: addChild flex 4
            mikedhart Level 1

            that worked thankyou very much. i know it may sound daft but why are there currently two namespaces? will both of these be in the final release?

            • 3. Re: addChild flex 4
              David_F57 Level 5

              Hi,

               

              mx and spark co-exist nicely, Flex4 still relies heavily on mx and I suppose until such time as spark can do absolutely everything that mx can do and mx plays no part in connectivity between adobe products then we will have both.  The thing is most spark components are 'lighter' than mx so whenever possible spark is the way to go.

               

              David