12 Replies Latest reply on Aug 31, 2012 8:31 AM by cdsvvxv

    Bug in FlexGlobals.topLevelApplication?


      I am having a problem with the FlexGlobals.topLevelApplication. I have five situations:


      1) Running in the prjector;

      2) Firefox, running the swf directly in the browser;

      3) Firefox, running with the swf embedded in a HTML page;

      4) IE, running the swf directly in the browser;

      5) IE, running with the swf embedded in a HTML page.


      The following are the returns of the FlexGlobals.topLevelApplication command:


      1) Main0;

      2) Main0;

      3) Main0;

      4) Main0;

      5) flexglobals.


      The last one looks very, very wrong to me, and it means that I can't get the topLevelApplication in IE when the SWF is embedded in a HTML page (the most common scenerio!). Instead I get either:


      1) The value of attributes.id;

      2) or if that is not specified, the id of the HTML div that the SWF is enclosed in, which in this case is 'altContent'.


      I have tried on 3 different machines all running Windows 7 with the following player versions:






      As Application.application is now depreciated and I can't even compile with that at the moment, is there another reliable way to get the topLevelApplication? My application is failing in IE and it seems to be due to the FlexGlobals.topLevelApplication.


      The code is using SWFObject which I haven't included.


      -- Main.mxml ---


      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"







                  import mx.controls.Alert;

                  import mx.core.FlexGlobals;


                  private function onCreationComplete():void {

                      Alert.show("FlexGlobals.topLevelApplication [" + FlexGlobals.topLevelApplication + "]");







      --- index.html ---


      <!DOCTYPE html>

      <html lang="en">


          <meta charset="utf-8"/>


          <meta name="description" content="" />


          <script src="js/swfobject.js"></script>


              var flashvars = {


              var params = {

                  menu: "false",

                  scale: "noScale",

                  allowFullscreen: "true",

                  allowScriptAccess: "always",

                  bgcolor: "",

                  wmode: "direct" // can cause issues with FP settings & webcam


              var attributes = {





                  "altContent", "100%", "100%", "10.0.0",


                  flashvars, params, attributes);



              html, body { height:100%; overflow:hidden; }

              body { margin:0; }




          <div id="altContent">


              <p><a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a></p>