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(Ev ent.COMPLE TE, 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
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(Ev
//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
ASKER
hi
yes it is external and i could not solve the problem.
so i`m in the dark:)
best regards
ron
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
is this an external script file yeah?