9 Replies Latest reply on Jun 4, 2007 7:20 AM by Rothrock

    Video draw problem AS 3.0


      I am using the BitmapData.draw() method to draw a Sprite into a bitmap object. The Sprite contains a video with an flv playing in it, the FLV is paused. I then create a new Bitmap object and add the bitmapdata to it. Then I placed the bitmap on the display list. When the bitmap is displayed, the contents of the video disapear but everything else from jpg images to text remain. I then tried to use the DisplayObject,cacheAsBitmap to make sure the video was drawn on the bitmap level, but then the video only appears to be around 2 pixels tall.

      Is there a problem with the video class and rendering when it comes to bitmaps?

      Does anyone have any ideas?

        • 1. Re: Video draw problem AS 3.0
          Rothrock Level 5
          I just tested this out using AS2 and it works fine, then I realized you are working in AS3. I don't have a system set up to quickly check this in AS3 since I've just started working with it. I did quite a bit with video under Flash 7 when it first came out and need to get back up to speed, so I'm quite interested in this.

          I've got to go to work soon, but I will test it in the next day or so as I can. Questions I would have are:

          Which codec are you using for the FLV?

          Is there even a component for this in AS3 or are you using NetStream or whatever has replaced that in AS3?

          Anything else that you can share?
          • 2. Re: Video draw problem AS 3.0
            MaxVT103 Level 1
            I am using NetStream, it works exactly the same as in AS 2.0 pretty much. But that is not the problem, the video display object seems to be the problem, it appears to call the video.clear() or something like that when it is drawn to the bitmap. There are components in AS 3.0 but I never use components, I prefer to write my own code.
            • 3. Re: Video draw problem AS 3.0
              Rothrock Level 5
              Given what you've told me, I will give it a shot as soon as I can.

              The one thing you didn't mention is which codec you're using. I'm guessing the newer/better one? There isn't any alpha transparency in the video, is there?
              • 4. Re: Video draw problem AS 3.0
                MaxVT103 Level 1
                As far as I know it is using the on2 codec from flash 8. So I don't know what the problem is, and yes the video has no alpha channel.
                • 5. Re: Video draw problem AS 3.0
                  Rothrock Level 5
                  I just gave it a try. I'm not sure I'm doing everything you're doing, but my (slightly messy) code is below. I am totally able to get video still from my video. I didn't have a On2 VP6 video to test, so that was the old codec. I will find some source to convert to the new codec and give it another try.

                  If you notice anything different in my code, let me know.
                  • 6. Re: Video draw problem AS 3.0
                    Rothrock Level 5
                    Okay. I just encoded a video with the new encoder and it worked as well. So I don't know what could be going on. I'm totally new in this as well, so I don't know what advice to offer. Other than start with a new document and add bits slowly to see where you can get things working and where it all goes pear shaped.

                    Good luck and if you figure it out, please post back!
                    • 7. Re: Video draw problem AS 3.0
                      Do you load the video from the same domain as your swf resides?
                      If not, that could be the problem. Flash won't allow the usage of BitmapData.draw if the video comes from a different domain.
                      • 8. Re: Video draw problem AS 3.0
                        MaxVT103 Level 1
                        rziller, that seems to be the problem. I never even thought about that. The project got changed at work so I'm not even using that anymore. Thanks everyone for all your help.

                        • 9. Re: Video draw problem AS 3.0
                          Rothrock Level 5
                          thanks rziller, that is good to know.