我已经创建了使用Flash专业版CC我一直在做研究的一个按钮,但无法找到为什么一个类型错误说明 类型错误:错误#1009:无法访问空对象的属性或方法reference.at PD3Subscribenow_fla :: MainTimeline /帧1() 我已经把我的code上的动作层的帧1:
进口flash.events.MouseEvent;
sub_btn.addEventListener(MouseEvent.CLICK,myButtonFunction);
功能myButtonFunction(事件:MouseEvent)方法{
VAR要求:的URLRequest =新的URLRequest(HTTP //:www.google.com);
navigateToURL(请求_blank);
}
和给我的按钮sub_btn的实例名称。
你能告诉我,我已经错了。
解决方案您的问题是,code执行,其中在框架上, sub_btn
不存在(当你在你的评论指出,这是在后面的帧)。
您要么需要:
将按钮的第一帧,或
将code引用它与按钮框。I have created a button using flash Pro cc I've been doing research but was unable to find why a TypeError stating "TypeError: Error #1009: Cannot access a property or method of a null object reference.at PD3Subscribenow_fla::MainTimeline/frame1()" I have placed my code on a action layer on frame 1:
import flash.events.MouseEvent;
sub_btn.addEventListener(MouseEvent.CLICK, myButtonFunction);
function myButtonFunction(event: MouseEvent) {
var request:URLRequest = new URLRequest("http//:www.google.com");
navigateToURL(request, "_blank");
}
and gave the instance name of my button "sub_btn".
Can you tell me where I have gone wrong.
解决方案You issue is that on the frame where the code executes, sub_btn
does not yet exist (as you state in your comments that it is on a later frame).
You either need to:
Move the button to the first frame,or
Move the code that references it to the frame with the button.相关推荐
最新文章