0
votes

Alright so I am using the stencyl engine to make a flash game, and I wanted to upload an Swf file. The problem is I keep getting an error

TypeError: Error #1009: Cannot access a property or method of a null object reference. at _247gamesonline_fla::bn0_Symbol1_2/frame1()

Now I went to that part of the fla file that had the error, and tried to see what was wrong, but could not figure it out. Here is the code:

stop();

var doMain:String = this.stage.loaderInfo.url;
        var doMainArray:Array = doMain.split("/");
        var domainname = doMainArray[2];
        var gamename = "nameofgame";

        var linktodjp = "http://www.247gamesonline.com/?        p=cat&order=2&tag=puzzle&utm_medium=partnergame&utm_campaign=" + gamename + "&utm_source=" + domainname + "&utm_content=partnergame";
var linktodjpfb = "http://www.facebook.com/connect/uiserver.php?app_id=201345053230176&next=http://www.3j.com/processfacebook.php%3Futm_source%3D" + domainname + "%26fgamet%3D76&display=page&cancel_url=http%3A%2F%2Fwww.3j.com%3F3Futm_source%3D" + domainname + "&locale=en_US&return_session=1&session_version=3&fbconnect=1&canvas=0&legacy_return=1&method=permissions.request&perms=publish_stream,offline_access,email,user_birthday,user_interests,read_friendlists";


buttonplay.addEventListener(MouseEvent.CLICK, playlogonow);
logo.addEventListener(MouseEvent.CLICK, gotowebsite);
logo.buttonMode = true;

stop();
function playlogonow(e:Event) {
logo.play();
gotoAndStop(2);
return;
}

function gotowebsite(e:Event) {
navigateToURL(new URLRequest(linktodjp));
return;
}

Also in another part of the code it simply says

on (release) {
_root.play();

}

Help anyone?

1
Run in debug mode put a breakpoint anywhere you have functions you expect might be called, step through the code, see which line throws the error, see what is being accessed on that line, by accessed I mean any variable that has a dot operator to access it's properties or methods. As suggested below trace variables from that line or view them using the debugger. - shaunhusain

1 Answers

0
votes

Difficult to say by having that code only. Whatever, I would recommend to put many trace statements there to figure out what variable actually equals null and leads to that exception. Then act accordingly.