Quote:
Originally Posted by tadster
The original code you posted, sure looks like a class. But the AS3ProjectPreloader class, as you have it posted in your original post, would not work at all. There's no _init method and the AppClass is never added to the display.
As for the error, just as in your original code, to use the private declaration, the code needs to be in a package and a member of a class, just like the startApp method or swfLoadedHandler method of your previous post.
Can you post the code as you have it now?
|
Posting code as I have now. (If I've used the wrong class it is due to my limited knowledge)
<code>
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.utils.getDefinitionByName;
[SWF(scriptRecursionLimit="5000",
scriptTimeLimit="30",
frameRate="24",
backgroundColor="0x606060",
pageTitle="Design")]
[Frame(factoryClass="com.preloader.CustomPreloader" )]
public class Main extends Sprite
{
public function Main() {
addEventListener(Event.ENTER_FRAME, doLoad);
}
private function doLoad(e:Event):void {
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal) {
removeEventListener(Event.ENTER_FRAME, doLoad);
var c:Class = getDefinitionByName("Card") as Class;
//Application should be the class that defined this preloader as the factory class at top.
var s:Sprite = new c();
addChild(s);
}
}
}
}
</code>
Flash Builder display no errors currently, however at run time I get:
An ActionScript error occurred
ReferenceError: Error #1065: Variable Card is not defined.
at global/flash.utils.get

efinitonByName()
at Main/doload()/user/"name"/Documents/ Adobe Flash Builder 4.5/Main/scr/Main.as:27