I have 2 .fla files and one of them is associated with a class file called DocumentMain, it is a game. and what I want is when I click "stat" on the first .fla file it takes me to the game swf file.
I did the myLoad function and it look like this :
btnstart.addEventListener(MouseEvent.CLICK,gamecontent);
function gamecontent(myevent:MouseEvent):void
{
var myLoader:Loader = new Loader ();
var myURL:URLRequest = new URLRequest("game.swf");
myLoader.load(myURL);
addChild(myLoader);
}
but I get an Error which is :
TypeError: Error #1009: Cannot access a property or method of a null object reference. at DocumentMain()
instead of
addChild(myLoader);
add :then create this function:
or add this inisde
DocumentMain()
class:Add following code to your
gameContent
function:The onComplete handler looks like this:
Could you try this? :) Although still possible that you are getting errors ... If so: compile the external
SWF
and run thisSWF
, does is run like it should? Or dus the externalSWF
create errors?If you're still getting the errors, please post the code you're using in the external
SWF
.