作者sploo (sploo)
看板Flash
标题[问题] Button连结出现错误 错误码#1009
时间Thu Jun 23 09:17:08 2011
我用button载入另外一个SWF档出现以下文字
"TypeError: Error #1009: 无法存取 Null 物件参考的属性或方法。
at portfolio_fla::MainTimeline/a()"
语法:
import flash.display.Loader;
import flash.net.URLRequest;
var myLoader:Loader=new Loader();
b1.addEventListener(MouseEvent.CLICK,show_pix6);
function show_pix6(event:MouseEvent):void
{
gotoAndPlay(20);
}
b2.addEventListener(MouseEvent.CLICK,show_pix1);
function show_pix1(event:MouseEvent):void
{
gotoAndPlay(36);
}
b3.addEventListener(MouseEvent.CLICK,show_pix2);
function show_pix2(event:MouseEvent):void
{
gotoAndPlay(52);
}
b4.addEventListener(MouseEvent.CLICK,show_pix3);
function show_pix3(event:MouseEvent):void
{
gotoAndPlay(68);
}
b5.addEventListener(MouseEvent.CLICK,show_pix4);
function show_pix4(event:MouseEvent):void
{
gotoAndPlay(84);
}
b6.addEventListener(MouseEvent.CLICK,show_pix5);
function show_pix5(event:MouseEvent):void
{
gotoAndPlay(100);
}
h.addEventListener(MouseEvent.CLICK,a);
function a(event:MouseEvent):void
{
var myURL:URLRequest = new URLRequest("home.swf");
loader.addChild(myLoader);
myLoader.load(myURL);
}
b1~b6,h为button的名称
我在另一个档案执行
h.addEventListener(MouseEvent.CLICK,a);
function a(event:MouseEvent):void
{
var myURL:URLRequest = new URLRequest("home.swf");
loader.addChild(myLoader);
myLoader.load(myURL);
}
不会有这个问题
有上网查些资料
是说stage没有载入资料所以为null会有错
请问哪里有写错 是不是跟b1~b6的button有冲到
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.32.9.209
1F:→ scars:你的"另一个档案"找的到loader跟myLoader吗..? 06/23 09:22
2F:→ sploo:有 写在AS里 var myLoader ; load_mc.addChild(myLoader); 06/23 09:29
3F:→ sploo:var myLoader:Loader=new Loader(); 06/23 09:30