![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|||||
|
Регистрация: Mar 2012
Сообщений: 8
|
|
|
|||||
|
Не
а
__________________
http://www.chessmax.ru |
|
|||||
|
Регистрация: Mar 2012
Сообщений: 8
|
спасибо)
уже подправил swHands_btn.addEventListener(MouseEvent.CLICK,OnClickHands); function OnClickHands(e:MouseEvent):void { gotoAndPlay(2); var swHands:Loader = new Loader(); swHands.load(new URLRequest("images/swHands.jpg")); swHands.addEventListener(Event.COMPLETE, setSize); function setSize(event:Event):void { swHands.removeEventListener(Event.COMPLETE, setSize); swHands.width = 252; swHands.height = 358; } swHands.x=377.7; swHands.y=122.4; addChild(swHands); } тоесть если я уберу то что вставил: будет тоже самое Последний раз редактировалось brotherhood; 29.03.2012 в 15:25. |
|
|||||
private var swHands:Loader swHands_btn.addEventListener(MouseEvent.CLICK,OnClickHands); private function OnClickHands(e:MouseEvent):void { swHands = new Loader(); swHands.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize); swHands.load(new URLRequest("images/swHands.jpg")); } private function setSize(event:Event):void { swHands.contentLoaderInfo.removeEventListener(Event.COMPLETE, setSize); swHands.content.width = 500; swHands.content.height = 100; stage.addChild(swHands.content) } Последний раз редактировалось Sevak; 29.03.2012 в 15:31. |
|
|||||
|
Вместо:
Нужно: И отписывать нужно тоже от contentLoaderInfo.
__________________
http://www.chessmax.ru Последний раз редактировалось Inet_PC; 29.03.2012 в 15:28. |
|
|||||
|
Регистрация: Mar 2012
Сообщений: 8
|
При добавлении еще кнопок подобный способ неработает к сожалению, подскажите как исправить пожайлуста:
попробывал так 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); } и так : 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); } Зделал вот так вроде пока работает но выдает ошибку паралельно: TypeError: Error #1009: Cannot access a property or method of a null object reference. at bro_fla::MainTimeline/setSize() но работает, файлы загружаются и появляются на сцене 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); } Спасибо Добавлено через 20 часов 39 минут к сожалению такой код неработает, выдает картинки как попало, а не те что закреплены за кнопками. или вообще невидно на сцене Последний раз редактировалось brotherhood; 30.03.2012 в 07:40. |
![]() |
![]() |
Часовой пояс GMT +4, время: 03:33. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|