При добавлении еще кнопок подобный способ неработает к сожалению, подскажите как исправить пожайлуста:
попробывал так

Код AS3:
var swHands:Loader;
swHands_btn.addEventListener(MouseEvent.CLICK,OnClickHands);
function OnClickHands(e:MouseEvent):void {
swHands = new Loader();
swHands.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swHands.load(new URLRequest("images/swHands.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swHands.removeEventListener(Event.COMPLETE, setSize);
swHands.content.width = 252;
swHands.content.height = 358;
swHands.content.x=377.7;
swHands.content.y=122.4;
addChild(swHands.content);
}
var swBear:Loader;
swBear_btn.addEventListener(MouseEvent.CLICK,OnClickBear);
function OnClickBear(e:MouseEvent):void {
swBear = new Loader();
swBear.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swBear.load(new URLRequest("images/swBear.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swBear.removeEventListener(Event.COMPLETE, setSize);
swBear.content.width = 252;
swBear.content.height = 358;
swBear.content.x=377.7;
swBear.content.y=122.4;
addChild(swBear.content);
}
var swNerpa:Loader;
swNerpa_btn.addEventListener(MouseEvent.CLICK,OnClickNerpa);
function OnClickNerpa(e:MouseEvent):void {
swNerpa = new Loader();
swNerpa.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swNerpa.load(new URLRequest("images/swNerpa.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swNerpa.removeEventListener(Event.COMPLETE, setSize);
swNerpa.content.width = 252;
swNerpa.content.height = 358;
swNerpa.content.x=377.7;
swNerpa.content.y=122.4;
addChild(swNerpa.content);
}
и так :

Код AS3:
var swHands:Loader;
swHands_btn.addEventListener(MouseEvent.CLICK,OnClickHands);
var swBear:Loader;
swBear_btn.addEventListener(MouseEvent.CLICK,OnClickBear);
var swNerpa:Loader;
swNerpa_btn.addEventListener(MouseEvent.CLICK,OnClickNerpa);
function OnClickHands(e:MouseEvent):void {
swHands = new Loader();
swHands.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swHands.load(new URLRequest("images/swHands.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swHands.removeEventListener(Event.COMPLETE, setSize);
swHands.content.width = 252;
swHands.content.height = 358;
swHands.content.x=377.7;
swHands.content.y=122.4;
addChild(swHands.content);
}
function OnClickBear(e:MouseEvent):void {
swBear = new Loader();
swBear.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swBear.load(new URLRequest("images/swBear.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swBear.removeEventListener(Event.COMPLETE, setSize);
swBear.content.width = 252;
swBear.content.height = 358;
swBear.content.x=377.7;
swBear.content.y=122.4;
addChild(swBear.content);
}
function OnClickNerpa(e:MouseEvent):void {
swNerpa = new Loader();
swNerpa.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swNerpa.load(new URLRequest("images/swNerpa.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swNerpa.removeEventListener(Event.COMPLETE, setSize);
swNerpa.content.width = 252;
swNerpa.content.height = 358;
swNerpa.content.x=377.7;
swNerpa.content.y=122.4;
addChild(swNerpa.content);
}
Добавлено через 15 часов 36 минут
Зделал вот так
вроде пока работает
но выдает ошибку паралельно: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at bro_fla::MainTimeline/setSize()
но работает, файлы загружаются и появляются на сцене

Код AS3:
var swHands:Loader;
var swBear:Loader;
var swNerpa:Loader;
swHands_btn.addEventListener(MouseEvent.CLICK,OnClickHands);
swBear_btn.addEventListener(MouseEvent.CLICK,OnClickBear);
swNerpa_btn.addEventListener(MouseEvent.CLICK,OnClickNerpa);
function OnClickHands(e:MouseEvent):void {
swHands = new Loader();
swHands.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swHands.load(new URLRequest("images/swHands.jpg"));
gotoAndPlay(2);
}
function OnClickBear(e:MouseEvent):void {
swBear = new Loader();
swBear.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swBear.load(new URLRequest("images/swBear.jpg"));
gotoAndPlay(2);
}
function OnClickNerpa(e:MouseEvent):void {
swNerpa = new Loader();
swNerpa.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
swNerpa.load(new URLRequest("images/swNerpa.jpg"));
gotoAndPlay(2);
}
function setSize(event:Event):void {
swHands.removeEventListener(Event.COMPLETE, setSize);
swHands.content.width = 252;
swHands.content.height = 358;
swHands.content.x=377.7;
swHands.content.y=122.4;
addChild(swHands.content);
swBear.removeEventListener(Event.COMPLETE, setSize);
swBear.content.width = 252;
swBear.content.height = 358;
swBear.content.x=377.7;
swBear.content.y=122.4;
addChild(swBear.content);
swNerpa.removeEventListener(Event.COMPLETE, setSize);
swNerpa.content.width = 252;
swNerpa.content.height = 358;
swNerpa.content.x=377.7;
swNerpa.content.y=122.4;
addChild(swNerpa.content);
}
подскажите, если еще кнопок добавлю с подобной пропиской, должно все работать? около 40 кнопок еще будет.
Спасибо
Добавлено через 20 часов 39 минут
к сожалению такой код неработает, выдает картинки как попало, а не те что закреплены за кнопками. или вообще невидно на сцене