4 Replies Latest reply on Jul 12, 2006 7:04 AM by Shellgrip

    Loading sprites from files

    Shellgrip Level 1
      I'm sure this must crop up but I've been unable to find anything by searching...

      I am developing a catalogue browser - users scroll through thumbnails and click on them to view the product in a larger window. However, the catalogue changes frequently and ideally I'd like to load the items (sprites) at run time from a specified directory so that each 'release' of the catalogue only needs to have this directory replaced for it to be up to date.

      I'm thinking to use text files within the root of this product directory and subs to identify folder names and product names but I've been unable to find any advice on how to load sprites via lingo from a filepath.

      Can anyone help?

        • 1. Re: Loading sprites from files
          Shellgrip Level 1
          OK, within three nanoseconds of posting this message I found a post detailing how to generate a filelist from a directory so scratch that part from the requirements...

          All I need now is to make sprites from those files... how hard can it be...

          • 2. Re: Loading sprites from files
            a¿ex Level 1
            not much harder, than:
            sprite.member.filename = theFullPath

            you shouldn't bother to create the sprites on the fly. (there are some caveats and I don't see any advantage in this case)
            just make a "dummy" bitmap, preferable a linked png with alphachannel (which automatically preserves the alpha of the images you want to link, if any)
            and drag that member into the score.

            now, if you want to display file 1 of your list with full pathnames to the images set the filename of the member. this will load the image from disk and display it.

            sprite(x).member.filename = myListOfFilenames[1]
            • 3. Re: Loading sprites from files
              Level 7
              Hi Jon,

              Actually, you want to load in new members, not sprites. If this is an
              app that's on a CD or a hard drive then you can use downloadNetThing()
              to download the file to the user's hard drive. You can then import,
              open, or link that file to your movie. If this is a graphic, you can
              update a cast member using member.fileName(), if this is a text file
              then you can open the file and copy the contents into an existing, or
              new member.

              There are a number of data base Xtras that can pull in new content
              directly from a data base.

              Another option is keep, at least one, cast external and not protected.
              You can then update the cast and make it available for download. You can
              have this update done at runtime, or you could write another app to do
              the update.

              Rob Dillon
              Adobe Community Expert

              • 4. Re: Loading sprites from files
                Shellgrip Level 1
                Thanks guys, I'm pretty much there. As often happens some of the problems I was stumbling over were down to simply getting the path wrong to the image - Doh!

                Thanks for replying kindly when the answers were kind of obvious and there to find. I'll try not to be such an impatient idiot next time :)