8 Replies Latest reply on Jun 27, 2006 11:56 PM by a¿ex

    grab a image from flash sprite with flash8 xtra?

    _lw Level 1
      I have a little problem to grab the image of a flash sprite with the new flash 8 asset xtra. i thought i just could grab via this xtra the flash "stage" and use the image for generating textures in 3D world.

      for some reason i don't get it to work.

      Is it impossible, do i have to use slow "copypixels"?
      is it possible to look into the flash file to see what i can get out of it?

      i really do not have any idea about flash, but i need a way to enable flash contend to be viewed on textures in a fast way.

      Maybe it's possible when i know how the flash things inside are named?

      please let me know if you know any answere.
      thanks.
        • 1. Re: grab a image from flash sprite with flash8 xtra?
          Level 7
          Do you need a different image than that returned from member.image, even
          when you can alter member.posterFrame?
          • 2. Re: grab a image from flash sprite with flash8 xtra?
            _lw Level 1
            i have here a flash member that gives access to a webcam. the flashmember has a size of 128x128 pixels. I get only a black image out of it with "member.image". seems that in this way the image is not dynamically updated. What i get in this way seems to be the image of the flash member on a specific frame, but it is not updated.

            this way seems not to work with video or animations that take place in one frame.

            So, yes i need a different image than the one that i can get with "member.image", in need the actual image of the flash sprite. i think this is the reason why the common way for this is to use copypixels and grab the image from the stage.

            but thanks for your suggestion.



            • 3. Re: grab a image from flash sprite with flash8 xtra?
              Level 7
              While I haven't tried it for the exact usage you are attempting, I have
              had good luck with the free scrnxtra which you can get from:

              http://homepage.mac.com/klkersten/xtras/ScrnXtra/scrnxtra.htm

              I used the 'StageToMember' command to grab a portion of the screen and
              make a bitmap cast member out of it. (you can also copy that image to
              the clipboard or to a file on the hard drive). In my case, it was a DTS
              3D image that I was capturing, since getting a screenshot of it in other
              ways gave me that same black box you are talking about. It did not cause
              any slowdown of the 3d stuff- or the rest of the Director movie- that
              was happening in the scene while I was recording screenshots.

              I think it grabs the image straight from the screen buffer, so whatever
              image is actually showing should be captured. There are also a bunch of
              other commands that may be helpful in different situations.

              It is cross platform (but not Shockwave safe)
              • 4. Re: grab a image from flash sprite with flash8 xtra?
                _lw Level 1
                thanks for this answere, its not what i had in mind, because it will only capture what is visible on the stage. I think this way is very good for offline stuff when you want to capture the 3D scene that is directtostage.

                what i am after is the analogon to the image that i can get out of a realtime member. If you want to use for example the image of its video content, its not nessesary to put it onto the stage. you can just say "play" and use the image of it.

                I thought that the flash 8 asset xtra would give access in a similar way. I found in the docs this example where you can generate a bitmap from a Flash member.

                tBmpData = sprite("flash").getVariable("ImageData", false)
                tImageObj = sprite("flash").convert(#image, tBmpData)
                tTexture =member("3D").newTexture("Flashtexture",#fromImageObject,tImageObj)

                the problem is now, i have no idea how i could access the complete "stage" of the flash member in this way and turn it into image.

                but for now i think there is no way to make this work.

                thanks for your help! (good to know that this xtra is crossplattform)

                • 5. Re: grab a image from flash sprite with flash8 xtra?
                  the real POTMO Level 1
                  this is realy interesting.

                  I Want to use the image of a flashSprite and copy it to a 3d texture.
                  And i dont want the flashMembers image i want the flashSprites image.
                  Im no Flasher. Im a Directorer. :)
                  Is'nt there any way to copyPixels from the flash's stage and paste it into a director image using that convert thingy?

                  • 6. Re: grab a image from flash sprite with flash8 xtra?
                    the real POTMO Level 1
                    I got som help from a Flashy friend:

                    //in flash
                    import flash.display.BitmapData;
                    var mc:MovieClip; // movieclip on stage (in scene)
                    var snap:BitmapData;
                    snap = new BitmapData(mc._width, mc._height, true, 0x00FFFFFF);
                    snap.draw(mc);


                    --and then in shockwave
                    tBmpData = sprite("flash").getVariable("snap", false) -- search in the level you put the movieClip
                    tImageObj = sprite("flash").convert(#image, tBmpData)
                    tTexture =member("3D").newTexture("Flashtexture",#fromImageObject,tImageObj)


                    This should work :)
                    (I havent tested)
                    • 7. Re: grab a image from flash sprite with flash8 xtra?
                      _lw Level 1
                      hm, i got some info about the inside of the flash sprite too. it's a webcam image that i want to get onto a texture:

                      the flash part is:
                      // setup the camera
                      myCam=Camera.get();
                      myCam.setLoopback(true); // to get the activityLevel computed, you need to make flash the camera stream "loopBack"
                      myCam.setQuality(0,100);
                      myCam.setMode(128, 128, 25 ,true)

                      myVid.attachVideo(myCam); // to use the camera, you need to assign it to a video

                      i tried this in shockwave without success:

                      tBmpData = sprite("flash").getVariable("myCam", false) -- search in the level you put the movieClip
                      tImageObj = sprite("flash").convert(#image, tBmpData)
                      tTexture =member("3D").newTexture("Flashtexture",#fromImageObject,tImageObj)

                      and

                      tBmpData = sprite("flash").getVariable("myVid", false) -- search in the level you put the movieClip
                      tImageObj = sprite("flash").convert(#image, tBmpData)
                      tTexture =member("3D").newTexture("Flashtexture",#fromImageObject,tImageObj)

                      seems that i have to learn flash to do this thing with this xtra, i also would like to have a overview about all the commands like "blurX" or "blurY" ... that have to be taken out of the actionscript documentation. I thought everything to know would be written in the flash 8 asset xtra documentation. but it has to be extended on your own. if anyone made a list, it would be nice to see it here :)

                      cheers!
                      • 8. Re: grab a image from flash sprite with flash8 xtra?
                        a¿ex Level 1
                        I have made a parent script to use the flash bitmap filters.
                        In the demo movie, which you can download from my website ( http://www.farbflash.de/cgi-bin/blosxom.cgi/Dokumente/Director/Opensource/Imaging/blur.htm l) there is a #field with the name "infosForFlashBitmapFilters", which lists the infos I gathered from the website concerning the flash bitmap filters.