in my fla file i have 1 symbol in the library with the export name: “Box”
my document class:
package {
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
import testFolder.TestObject;
public class TestDoc extends MovieClip{
private var obj:TestObject;
public function TestDoc() {
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
obj = new TestObject();
addChild(obj);
}
}
}
my other class: (notice the package)
package testFolder{
import flash.display.MovieClip;
import flash.events.Event;
**import Box;**
public class TestObject extends MovieClip{
public function TestObject() {
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
var b:Box = new Box();
addChild(b);
}
}
}
this works as it it, BUT if i try to load my document class into another swf and strong type it like so:
var loader:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, onTestComplete);
function onTestComplete(e:Event):void {
mainSprite.addChild(loader);
var t:TestDoc = mainSprite.getChildAt(0) as TestDoc;
}
compiler complains:
1046: Type was not found or was not a compile-time constant: Box.
1180: Call to a possibly undefined method Box.
1172: Definition Box could not be found.
whats the problem?