Hi everyone.
I have fully working preloader (tested), but I can’t start my swf file. It says:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at GameClass$iinit()
I can’t figure out what is wrong. I have these files:
- Game.fla
- GameClass.as (this is Document Class)
- Varijable.as (just another as for my Game)
and of course Game.swf
Also in GameClass.as I have including external sound loop for my file.
My swf file runs normally with music and stuff.
For preloader I have:
- Igra.fla
- Preloader.as
When I start my preloader, I get this error, but weird thing is that I hear my sound loop but don’t see my swf.
Here is preloader code:
package
{
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.display.MovieClip;
public class Preloader extends MovieClip
{
var myLoader:Loader = new Loader();
var myRequest:URLRequest = new URLRequest("Game.swf");
public function Preloader()
{
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);
}
function showPreloader(event:Event):void
{
loadProgress_txt.visible = true;
}
function showProgress(event:ProgressEvent):void
{
loadProgress_txt.text = "Loading game: " + event.bytesLoaded;
}
function showLoadResult(event:Event):void
{
loadProgress_txt.visible = false;
addChild(myLoader);
}
}
}
PS. I tried working with preloading in my Game.swf, tried external preloader, tried with component preloader, and nothing works.
Any idea anyone?