Link to home
Start Free TrialLog in
Avatar of derrida
derrida

asked on

as3 error that i do not understand

hi
i am learning as3. i try to load  variables from a php file. i wrote this code according to some tutorial. what i test the movie i get the error message:

1037:packages cannot be nested.

i look at the code and i cannot see where is a nested package:

package {
      import flash.events.*;
      import flash.net.*;
      import flash.utils.trace;
      
      public class loadingas3 {
            public function loadingas3 () {
                  //create the URLLoader instance to be able to load data
                  var loader:URLLoader = new URLLoader();
                  
                  //define the event handler to perform once the loading is complete
                  loader.addEventListener(Event.COMPLETE, handleComplete);
                  
                  //tell the loader to load url-encoded variables: that is critical for this job
                  loader.dataFormat = DataFormat.VARIABLES;
                  
                  //now, load the data
                  loader.load(new URLRequest("loadingas3.php"));
            }
            
            private function  handleComplete (event:Event):void {
                  //cast the event target as a URLLoader instance, because that is what made the event to happen.
                   var loader:URLLoader = URLLoader(event.target);
                  
                   //trace the variables that was loaded by referencing the variable name from the data property of the URLLoader instance
                   trace("sometext=" + loader.data.sometext);
            }


            
      }
      
}

can anyone help?

best regards

ron
Avatar of blue-genie
blue-genie
Flag of South Africa image

hi, have you managed to come right on this?
is this an external script file yeah?
Avatar of derrida
derrida

ASKER

hi

yes it is external and i could not solve the problem.

so i`m in the dark:)

best regards

ron
ur file is loadingas3.as right?
what's your folder setup?
i'm not sure here, not working in as3 myself, but i'm thinking maybe (not that is answers the question why ) create a named package.
when does this error actually come up? when you compile or when you run, how are you calling these classes?
ASKER CERTIFIED SOLUTION
Avatar of rwmorey71
rwmorey71
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial