1 Reply Latest reply on Apr 27, 2007 4:03 AM by Newsgroup_User

    Can anyone help me out with DirectImage


      Can anyone help me out.
      i need to export the animation on the stage to a GIF file for which i am using DirectImage xtra. But for some reason i am able to export the stage into a JPEG file and if i try to export to a GIF then it is creating a junk image which shows the animation but a stilled image.

      So can anyone help me out how to export the stage animation to a GIF file.

      Thanks for the help in advance.
        • 1. Re: Can anyone help me out with DirectImage
          Level 7
          I just wrote up a little behaviour a few weeks ago to make animated gifs
          using DirectImage. Make this a movie script in your project. You will
          need to change the new() call to use your serial number(s). You use it
          like this:

          theTimeList=[40,30,100,120] makeAnimGif(theList,the

          That will take the member named member("BuddyIcon1") and it will be
          displayed for 40 ms followed by member("BuddyIcon2") which will be
          displayed for 30 ms, etc... The time list is in the same order as the
          list of member names, and shows how long that frame is displayed.

          These members should be 16 bit graphics or less. The messed up images
          you are seeing is most likely due to using 32 bit images which the gif
          format does not support. Since most animated gifs are made for quick
          downloading, you will find that a lot of the time they are 8 bit
          graphics. If you use 8 bit graphics, you can really squeeze a lot of
          frames into a small file size. There is a cost to image quality of course...


          --@vImageList - Linear list of members, strings (member names), sprite
          references, or .images (or any combination thereof)
          --@vFilename - String - full path and filename of the final outputted gif
          --@vTimeList - List - same order as the ImageList- how much time (in
          ms) before the next frame
          on makeAnimGIF vImageList, vFileName, vTimeList

          if voidP(vTimeList) then vTimeList=[]

          --instantiate DirectImage
          if the platform contains "win" then
          myAnimGif = xtra("DirectImage").new(000000000)
          myAnimGif = xtra("DirectImage").new(000000000)
          end if

          repeat with iImage = 1 to vImageList.count

          if iImage>1 then --number one already has a frame
          end if

          --move the pointer into the next frame
          imageSetCurrentFrame(myAnimGif, iImage)

          --put this image into that frame
          case vImageList[iImage].ilk of
          imageLoadFromMember(myAnimGif,member vImageList[iImage])
          end case

          --how long until the next frame appears
          if vTimeList.count<iImage then
          end if


          imageSetFrameDelay(myAnimGif, theDelay) --in ms

          end repeat

          --save out the final output

          --save memory