5 Replies Latest reply on Dec 26, 2008 1:04 PM by Newsgroup_User

    Tedious embedding

    korvskal
      For flex games I typically need to embed a lot of images and every time I must use something like the attached code. This indeed gets very tedious and what I would like is something like the later code construct. But I still need the images to be embedded in the flash application file. Is it possible to simplify the code in any way?
        • 1. Re: Tedious embedding
          korvskal Level 1
          Also on some systems the enterFrame fuction is called before creationComplete. Is there anything that can be done to prevent this?
          • 2. Re: Tedious embedding
            Level 7

            "korvskal" <webforumsuser@macromedia.com> wrote in message
            news:gitjcr$c98$1@forums.macromedia.com...
            > For flex games I typically need to embed a lot of images and every time I
            > must
            > use something like the attached code. This indeed gets very tedious and
            > what I
            > would like is something like the later code construct. But I still need
            > the
            > images to be embedded in the flash application file. Is it possible to
            > simplify
            > the code in any way?
            >
            > What I use:
            >
            > [Embed(source="/image.png")]
            > private var image : Class;
            > private var asset : BitmapAsset = new image() as BitmapAsset;
            > private var sprite : MySprite = new MySprite(asset);
            >
            > What I would like:
            >
            > private var sprite : MySprite = new MySprite("/image.png");

            You could probably write your own class that does this.


            • 3. Re: Tedious embedding
              Level 7

              "korvskal" <webforumsuser@macromedia.com> wrote in message
              news:givtci$7te$1@forums.macromedia.com...
              > Also on some systems the enterFrame fuction is called before
              > creationComplete. Is there anything that can be done to prevent this?

              I would think it would always be called first, since I imagine the super()
              version of it runs through all of the validation functions in order.



              • 4. Re: Tedious embedding
                korvskal Level 1
                quote:

                You could probably write your own class that does this.


                Probably is good, but how can I write this? Seems like I need some pre-processing stuff to make it work.
                • 5. Re: Tedious embedding
                  Level 7

                  "korvskal" <webforumsuser@macromedia.com> wrote in message
                  news:gj3f17$k42$1@forums.macromedia.com...
                  >
                  quote:

                  You could probably write your own class that does this.

                  >
                  > Probably is good, but how can I write this? Seems like I need some
                  > pre-processing stuff to make it work.

                  This is not exactly the same as what you're looking to do, but it might give
                  you some ideas:

                  http://blog.benstucki.net/?p=42
                  http://blog.xsive.co.nz/archives/233