5 Replies Latest reply on Nov 6, 2010 7:02 PM by Harry Kunz

    Funny Behavior

    Harry Kunz Level 4

      Flex/Flash/whatever is really amusing me with its unpredictable behaviors. I've got a very simple class with public static constants. It started with these constants a few days ago.

       

      public class LoadEvent extends Event{

             
              public static const INIT:String = "loadInit";
              public static const COMPLETE:String = "loadComplete";
              public static const PROGRESS:String = "loadProgress"

      }

       

      They all trace fine LoadEvent.INIT, LoadEvent.COMPLETE, LoadEvent.PROGRESS. Now i add another property and end up with:

       

      public class LoadEvent extends Event{
             
              public static const INIT:String = "loadInit";
              public static const COMPLETE:String = "loadComplete";
              public static const PROGRESS:String = "loadProgress";

       

              public static const CRAPPED_UP:String = "crappyConstant";

      }

       

      When i trace the value of LoadEvent.CRAPPED_UP it gives me undefined but compiles just fine. The rest return the right string values. It's really amusing how weird flash/flex sometimes behaves. I'm sure it will work someday maybe tomorrow. Can anyone explain why these weird behaviors happen?

        • 1. Re: Funny Behavior
          Harry Kunz Level 4

          I think it did not compile correctly or used old ASO cached files? I tried tracing LoadEvent.PROGRESS and it returns "loadProgress" but when i change the string like "helloProgress" and compile it, it still returned "loadProgres" instead of the new string "helloProgress". How do i force recompile everything from scratch? I'm using Flex 3.5. Is this a bug?

          • 2. Re: Funny Behavior
            JeffryHouser Level 4

            Are you using Flex/Flash Builder?  OR some other IDE?  Or the command line compiler?

             

            In Flex/Flash Builder, cleaning the project will often help.  I find I have lots of problems if I change code and re-compile while an active debugging session is in place.  So, be sure to stop all debugging sessions before recompiling.  In default settings of Flex/Flash Builder, just changing code and resaving a file will force a recompile.

            • 3. Re: Funny Behavior
              Harry Kunz Level 4

              Hello Jeffry, thank you for your response. I'm using the command line compiler (mxmlc). How do i compile from scratch without using cached object files or clean up? I tried removing the output SWF and used another name for the output SWF and deleting cache in ~/Library/Caches. I tried a test by adding a static public function helloFunc() and used it in the code. It compiles perfectly fine but at runtime gives me TypeError: Error #1006: helloFunc is not a function. Why is it not a function? It's driving me insane!:-( Where is mxmlc's cached AS object files?

              • 4. Re: Funny Behavior
                Harry Kunz Level 4

                I was able to get a clue to the problem. It had something to do with my SWF being loaded into a parent loader SWF. If i run the content directly in the HTML container, it works perfectly but not if i use the loader SWF to load the SWF. I tried clearing the browser cache but it continues to give me undefied values. Any ideas?

                • 5. Re: Funny Behavior
                  Harry Kunz Level 4

                  By the way i was able to figure out the problem. It was an ApplicationDomain issue. The new LoadEvent class clashed with the older version registered in the application domain of the loader SWF. I needed to create separate application domains for both SWF so they won't depend on the same object files in case they change.