1 Reply Latest reply on May 16, 2006 8:18 AM by gadgetdonkey

    Variable Definitions - weird results

      Using Flash8 I am getting some weird results when defining variables.

      In my Actionscripts I am trying to define and assign variables on the same line and then trace it as below :

      var light_critical_colour:String = "#FF0000";
      trace ("light_critical_colour = " + light_critical_colour);

      If I create an new blank fla file and place this in the first frame, scene 1, it works as you would expect and opens a trace window and returns "light_critical_colour = #FF0000". Also if I remove the first line then the result is "light_critical_colour = undefined" again as expected.

      My issue is that I have another fla file which i have created from scratch as per the example above. I have 2 scenes, scene 1 is the preloader and scene 2 is the main user screen. It does not matter where I place the code even in the the first frame of scene 1, the var definition seems to be ignored and if I remove the var definition line and just have "trace ("light_critical_colour = " + light_critical_colour);" I get "light_critical_colour =" rather than "light_critical_colour = undefined" as expected.

      Does anyone have any idea's ?