0
votes

Im developing a flash game based on the citrus engine for a uni project.

All of it is done and handed in but im trying to compile the entire project into a release for web.

In flahs builder ive gone file --> export --> release build and compiled the game.

the .swf file opens up fine and initiatze the spirte menu but when clicking the start game button it begins to initiate the game state but then hangs up on a solid colour, in flash debugger im getting these errors

SecurityError: Error #2000: No active security context.

Started TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.citrusengine.utils::ObjectMaker$/FromMovieClip() at GameState/initialize() at com.citrusengine.core::CitrusEngine/handleEnterFrame() SecurityError: Error #2000: No active security context.

Started TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.citrusengine.utils::ObjectMaker$/FromMovieClip() at GameState/initialize() at com.citrusengine.core::CitrusEngine/handleEnterFrame()

Any suggestion appreciated

2

2 Answers

0
votes

Error #2000 is usually a file not found error. You can get more info from running an IOErrorEvent like so:

myLoader.addEventListener(IOErrorEvent.IO_ERROR, IOError)

function IOError(e:IOErrorEvent):void {
    trace(e.text);
}

Likely an issue with pathing to the correct file.

Error #1009 is likely a domino effect of not being able to work on the asset that hasn't been loaded due to the IOError. It could also be an issue if you're loading other SWFs to the stage and those child SWFs attempt to utilize the stage before it's ready, in which case you'd want to only start your scripts until after the addedToStage event has fired. You can set that up like so:

if (this.parent is Stage) {
    stageReady();
} else {
    addEventListener("addedToStage", stageReady);
}

function stageReady(e:Event = null):void {
    // begin your setup code here.
}

The logic here being that if your swf is not encapsulated inside a loader, the parent object should be the stage, otherwise, you can safely add a listener to the loaded swf's timeline that listens for the addedToStage event.

0
votes

Maybe the following will resolve your problem:

Wrap all the init code to a custom function (lets say: initFunctionOfApplication). Set a delay timer before this init function is called. It's a issue I've had before, and got it fixed with a small delay... Maybe this will fix your problem.

setTimeout(function():void{initFunctionOfApplication();}, 3000);

Keep us posted!