12 Replies Latest reply on Mar 5, 2009 8:54 PM by VanBcGunner

    Embedded SWF in HTML in AIR

    Kevin_Ashworth
      We're loading an HTML page inside an AIR window, and loading a SWF inside that. The SWF doesn't come up. Once upon a time in beta days this was the expected AIR behavior, but we thought it would now be possible with release 1.0. Can anybody confirm or deny this situation?
        • 1. Re: Embedded SWF in HTML in AIR
          bitwize3
          If you have transparency set to true in the xml descriptor file, try setting it to false. Let us know if that fixes it. It does in my case with flash 9 content.

          With older flash and transparency set to true, you will perhaps hear the flash (and get a right-click flashplayer dialog), but not see any flash display.

          And yes, apparently this bug made it into 1.0 (unconfirmed).
          • 2. Re: Embedded SWF in HTML in AIR
            Oliver Goldman Adobe Employee
            There are some limitations in 1.0 on the display of both SWF and PDF in HTML. See, for example, http://livedocs.adobe.com/air/1/devappsflash/help.html?content=ScriptingHTMLContainer_2.ht ml#1058666. Look for the heading "Considerations when loading SWF or PDF content in an HTML page".

            Oliver Goldman | Adobe AIR Engineering

            • 3. Re: Embedded SWF in HTML in AIR
              skinnyfish
              quote:

              ...heading "Considerations when loading SWF or PDF content in an HTML page".



              Where we read:

              quote:

              Note: The runtime cannot display SWF or PDF content in transparent windows.
              quote:



              Man, that bites. Transparent windows frees us to create custom chrome. What do I have to do to put this on top of the priority list? What are the odds of having this significant limitation removed in a (near) future release?

              • 4. Re: Embedded SWF in HTML in AIR
                Oliver Goldman Adobe Employee
                Submit your use cases for this feature at www.adobe.com/go/wish.

                Oliver Goldman | Adobe AIR Engineering

                • 5. Re: Embedded SWF in HTML in AIR
                  skinnyfish Level 1
                  Thank you, Oliver.

                  I filed a feature request. Seeing that it is in the doc's, I didn't think it would qualify as a bug...

                  • 6. Re: Embedded SWF in HTML in AIR
                    anemitoff12 Level 1
                    I have also submitted the above as a feature request. Although I really consider this a bug since it places an artificial constraint on application development and harms Adobe in the long run by discouraging FLASH use in HTML based AIR applications.

                    I have tried to work around this limitation by creating a floating window to overlay over my transparent window in which to host my FLASH applet.

                    But I have found no way to parent the floating window's NativeWindow to my transparent window ensuring the relationship between the 2 windows remains constant with respect to z-order and position.

                    I can get close by setting the floating window to 'alwaysInFront' and then listening to events from the transparent window in order to show/hide/move the floating window when needed but the illusion is not good enough.

                    • 7. Re: Embedded SWF in HTML in AIR
                      Admiral_Brodnack Level 1
                      anemitoff12,

                      You don't need to create a separate window. You can add the flash content as a peer of the HTMLLoader component that displays the HTML.To do this, load the SWF file using the Loader component, then use window.nativeWindow.stage.addChild(theLoader) to display the SWF over the HTML. (The HTMLLoader, which is added to the native window automatically in an HTML-based application, is just another Flash display object.)
                      • 8. Re: Embedded SWF in HTML in AIR
                        anemitoff12 Level 1
                        Thanks Admiral Brodnack!

                        I could have sworn that I tried this approach previously, but I tried it again and voila, it worked!

                        Here is a code snippet for anyone else that may be interested:

                        var swfLoader = new air.Loader();
                        swfLoader.load(new air.URLRequest("foo.swf"));
                        nativeWindow.stage.addChild(swfLoader);
                        • 9. Re: Embedded SWF in HTML in AIR
                          normyee
                          Hi folks,

                          I found this thread in the archives & rather than starting a new topic on this, I hope people reading/following this thread could chime in...

                          I have a html/js application that uses transparent windows, and have added a swf to the nativeWindow stage via the method that anemitoff12 posted above & positioned the swf to where I want it to appear in the AIR window. That said, I can see elements of the swf appearing outside of the SWFs stage -- I assume it's expanding to the stage size of the AIR stage (which is larger than the swf itself to account for the chrome & other elements)?

                          Is there a way to constrain the SWF that I've added to the nativeWindow stage to stay within a certain xy size (basically what you get when you specify the height/width attribute of the HTML embed tag within the context of a web page)?

                          thanks,
                          norm
                          • 10. Re: Embedded SWF in HTML in AIR
                            Admiral_Brodnack Level 1
                            I believe that to constrain the loaded SWF into a particular region of the window stage you can either create a clipping mask (see the mask property in http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/?flash/display/DisplayObject.htm l), or scale the content using the scaleX and scaleY properties.

                            • 11. Re: Embedded SWF in HTML in AIR
                              skinnyfish Level 1
                              I'm finding that in AIR 1.5 we still cannot display swf content embedded in html in transparent windows...I've filed it as a bug this time around, hoping that in doing so it may surface higher up than feature requests.

                              I would really, really like to see this significant limitation disappear in the near future.
                              • 12. Re: Embedded SWF in HTML in AIR
                                VanBcGunner
                                Ok, just asked the same question again... why transparency and HTMLLoader don't work together...

                                the reason I love HTMLLoader is that it gives you extra security as opposed to addChild(swf), because if swf has Flash components, it tries to access the stage and a security exception occurs.

                                It would really help if Adobe resolved this issue.