3 Replies Latest reply on Aug 31, 2009 1:25 AM by RWillie6

    Flex 3 project, all visible content disappears


      This is a bit hard to describe.  It's a complex Flex app for a realtime multiplayer game using socket connections.  Previously, everything worked fine, but after some recent changes there is a point where all visible content disappears.


      What is REALLY odd is that this ONLY happens when the SWF is embedded in an HTML page.  If the SWF is loaded directly by the browser, either locally using file:/// or served by a webserver (i.e. http://localhost:8080/swfs/MySwf.swf) then the SWF works as expected and transitions to the next state without a problem.


      Also of note is that no error is thrown and, yes, I have the debug version of flash installed and can see popup errors by intentionally causing them to test.


      I'm at a loss for how to debug this.  I started by commenting out all sections of the code that had recently changed, but the problem persisted.  Since then, I'm shooting in the dark, commenting out sections and testing.  For a bit, I thought the problem might be with the embed code itself, but I'm using the default generated by Flex Builder and it has not changed in the past 10 months that the last version of this SWF was working.  I've tried using every alternate window mode, but that didn't change anything.


      I've been testing mainly in Safari 4 (OS X), but tried Firefox 3.5 to confirm that the problem wasn't mac-browser specific, and tried Firefox 3 (Ubuntu) to confirm it wasn't OS specific.


      Does anybody know, on a high level, what could cause this kind of problem?  Specifically...

      1)  What can cause the display to suddenly clear?

      2)  What differences are there between running the SWF directly (even loaded from a webserver, so it's not local content) that could affect rendering?

      3)  Any other advice on things to try?


      Attached are two images:

      (a) the one with content elements is the desired effect, and was the result of loading the swf directly, and

      (b) the one with just the plain background image is the result at the same step but embedded in an HTML page



        • 1. Re: Flex 3 project, all visible content disappears
          Barna Biro Level 3

          Throw some exceptions ( messages ) once some "ket points" are reached in the application. If the content is not being displayed, that means that somewhere, something fails to initialize/execute. These errors do not always appear, so using a try { } catch { } block to find the problem might help ( or simply throw some exceptions manually ).

          • 2. Re: Flex 3 project, all visible content disappears
            RWillie6 Level 1

            Thanks for the suggestion Barna.  I've been doing that, though, and discovered that the code continues to run in the background, not having hit any error.  I literally had logging statements between every line of code in the function where the content disappears, and every logging statement was output as it should be. 


            So, I tried executing a different function that does nothing but change the current state instead, and the problem still occurred.


            The keys points thus far are:

            (1) no error messages thrown

            (2) no errors in the AS3 code

            (3) but a call to currentState = "lobby" (which is the next desired state) causes the contents of the display to vanish

            (4) again, only happens when embedded


            If there is an error, it seems to be in the state change... which is MXML, so I can't log output there, but I'll see if commenting out particular element(s) or changes will shed some light on where an error might be...

            • 3. Re: Flex 3 project, all visible content disappears
              RWillie6 Level 1



              Apparently, negative bound positioning works when the SWF is loaded directly, but kills the display without throwing an error when the SWF is embedded.


              i.e., the culprit was


              <mx:VBox right="-10" ... />


              Which was a dirty hack to begin with, but didn't present a problem until embed time.  Damn...