Здравствуйте! Пробежал по разным форумам в поисках решения этой проблемы - ошибка 1009. К сожалению ничего вразумительного не нашёл, кроме этого поста.
Вот мой код MainGame.as

Код AS3:
package
{
//import caurina.transitions.Tweener;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.xml.XMLDocument;
import flash.xml.XMLNode;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
public class MainGame extends MovieClip
{
private var sGame:DisplayObject; //бить
private var bGame:DisplayObject; //ловить
private var fGame:DisplayObject; //финал
public var tabl :DisplayObject; //таблица
//xml
var xmlData : XML = new XML();
var loader : URLLoader = new URLLoader();
public static var valuta : String;
public static var priz : String;
public static var note : String;
public static var congratulation_text : String;
public static var error : String;
public static var prize : String;
public static var congratulation : String;
public static var send : String;
public static var title : String;
public static var timer : String;
public static var confirm_txt : String;
public static var prizeimg : String;
public static var score : String;
public static var urlsave : String;
public static var coeff_one_point : String;
public static var help1 : String;
public static var help2 : String;
public static var operators_label : Array;
public static var operators_code : Array;
var loader_image : Loader;
public var prize_img : MovieClip;
public var prize2_text : MovieClip;
public var prev_game : int = 0;
public static var xml_loaded : Boolean = false;
public function MainGame()
{
stop();
stage.scaleMode = "noScale";
start_btn.visible = false;
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress, false, 0, true);
loaderInfo.addEventListener(Event.COMPLETE, onInit, false, 0, true);
}
private function hndlOnLoadXML(e:Event):void
{
e.target.removeEventListener(Event.COMPLETE, hndlOnLoadXML, false);
xmlData = new XML(e.target.data);
//trace(xmlData);
valuta = "" + xmlData.itm.attribute("valuta");
priz = "" + xmlData.itm.attribute("priz");
note = "" + xmlData.itm.attribute("note");
congratulation_text = "" + xmlData.itm.attribute("congratulation_text");
error = "" + xmlData.itm.attribute("error");
prize = "" + xmlData.itm.attribute("prize");
congratulation = "" + xmlData.itm.attribute("congratulation");
send = "" + xmlData.itm.attribute("send");
title = "" + xmlData.itm.attribute("title");
timer = "" + xmlData.itm.attribute("timer");
confirm_txt = "" + xmlData.itm.attribute("confirm_txt");
prizeimg = "" + xmlData.itm.attribute("prizeimg");
score = "" + xmlData.itm.attribute("score");
urlsave = "" + xmlData.itm.attribute("urlsave");
coeff_one_point = "" + xmlData.itm.attribute("coeff_one_point");
help1 = "" + String(xmlData.help1);
help2 = "" + String(xmlData.help2);
operators_label = new Array();
operators_code = new Array();
for each(var operator in xmlData.operators.operator)
{
operators_label.push(operator);
operators_code.push(operator.@code);
}
loader_image = new Loader();
//
loader_image.contentLoaderInfo.addEventListener(Event.COMPLETE, hndlOnLoadImage, false, 0, true);
try
{
loader_image.load( new URLRequest(prizeimg));
}
catch (error : Error)
{
trace("Unable to load prize image" + error);
}
xml_loaded = true;
}
private function hndlOnLoadImage(e:Event):void
{
loader_image.removeEventListener(Event.COMPLETE, hndlOnLoadImage);
prize_img.addChild(loader_image);
prize2_text.x = -2;
prize2_text.y = 15;
prize2_text.txt.text = "" + prize;
prize_img.addChild(prize2_text);
start_btn.visible = true;
//Tweener.addTween(bg, { alpha:0, time:0.5 } );
bg.visible = true;
start_btn.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
}
private function onProgress(e:ProgressEvent) : void
{
var loaded:Number = e.bytesLoaded / e.bytesTotal * 100;
preload.gotoAndStop(Math.round(loaded));
}
private function onInit(e:Event):void
{
if (contains(preload))
removeChild(preload);
//
prize_img = new MovieClip();
prize2_text = new prize2_txt();
loader.addEventListener(Event.COMPLETE, hndlOnLoadXML, false, 0, true);
try
{
loader.load(new URLRequest("parameters.xml"));
}
catch (error : Error)
{
trace("Unable to load xml: " + error);
}
}
private function onClick(e:MouseEvent):void
{
start_btn.removeEventListener(MouseEvent.CLICK, onClick);
gotoAndStop(3);
var blockGame:Class = loaderInfo.applicationDomain.getDefinition("BlockGame") as Class;
bGame = (new blockGame()) as DisplayObject;
var shotGame:Class = loaderInfo.applicationDomain.getDefinition("ShotGame") as Class;
sGame = (new shotGame()) as DisplayObject;
var finalGame:Class = loaderInfo.applicationDomain.getDefinition("FilnalScreen") as Class;
fGame = (new finalGame()) as DisplayObject;
var Tabl:Class = loaderInfo.applicationDomain.getDefinition("Tablo") as Class;
tabl = (new Tabl()) as DisplayObject;
switchToGame(1);
}
public function switchToGame(g:int):void
{
if (bGame != null && contains(bGame))
removeChild(bGame);
//
if (sGame != null && contains(sGame))
removeChild(sGame);
//
if (fGame != null && contains(fGame))
{
tablo.reset();
update();
removeChild(fGame);
}
//
Model.shots = 0;
tabl.visible = true;
var game:DisplayObject;
switch(g)
{
case 1: //удар
//
game = sGame;
tabl.scaleX = tabl.scaleY = 1.0;
tabl.x = 345;
tabl.y = 43;
tablo.keeperGame = false;
break;
//
case 2: //ловля
//
game = bGame;
tabl.scaleX = tabl.scaleY = 0.64;
tabl.x = 408;
tabl.y = 73;
tablo.keeperGame = true;
break;
//
case 3: //финал
//
Model.totalShots = 0;
game = fGame;
tabl.visible = false;
tablo.reset();
break;
//
}
if (g == prev_game + 1)
Model.is_read_help = true;
//
addChildAt(game, 0);
addChild(tabl);
prize_img.x = 1024 - 225;
prize_img.y = 15;
addChild(prize_img);
if (g == 3)
{
if(contains(prize_img))
removeChild(prize_img);
//
}
prev_game = g;
if (prev_game == 3)
prev_game = 0;
//
//update();
}
public function update():void
{
tablo.update();
}
public function get tablo() : Tablo
{
return tabl as Tablo;
}
}
}
При компиляции выводится сообщение об ошибке
TypeError: Error #1009: Не удается вызвать свойство или метод со ссылкой на объект "null".
at MainGame/hndlOnLoadImage()
А также не отображается кнопка start_btn.
Как я понял ошибка либо в функции hndlOnLoadImage() либо в соседней на несколько строк выше.
Подскажите, пожалуйста, решение проблемы!