本文介绍了Flash AS3:ReferenceError:错误 #1056:无法创建属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Flash/AS3 写一些东西,我遇到了这个问题:

I am writing something in Flash/ AS3, and I came across this problem:

ReferenceError:错误 #1056:无法在 package.name.DocumentClasss 上创建属性 txtInput

基本上我有一个文档类,我可以创建影片剪辑的实例并毫无问题地编译.但是当我在舞台上放置一个输入文本字段(调色板中的T"图标)时,它拒绝编译,出现上述错误.

Basically I have a document class, and I can create instances of movieclips clips and compile without issues. But when I put a input text field ("T" icon in the palette) on the stage, and it refuses to compile, with the above error.

我不确定这是否有所不同,但我正在 FlashDevelop 中编写我的 ActionScript,并在 Flash IDE 中完成编译.我还在 Publish Settings -> 下选择了 Strict ModeWarnings Mode闪光 ->脚本 ->设置... ->错误.

I am not sure if this makes a difference, but I am writing my ActionScript in FlashDevelop, with compilation done in the Flash IDE. I also have both Strict Mode and Warnings Mode selected under Publish Settings -> Flash -> Script -> Settings... -> Errors.

我已经在网上搜索了解决方案,唯一的建议似乎是不要在 Flash IDE 的 stag 上插入文本字段,而是在文档类中动态创建它们.

I have searched for solutions to this online, and the only suggestions out there seem to be to not insert the text field on the stag in Flash IDE, and instead dynamically create them in the document class.

有更好的解决方案吗?

谢谢

推荐答案

听起来您没有选中自动声明舞台实例",因此如果您想添加一个命名strong> 实例,你需要在你的类中声明它

It sounds like you have "Automatically declare stage instances" unchecked and thus if you want to add a named instances, you need to declare it in your class

import flash.text.TextField;
...
public var txtInput:TextField;
...

您可以在电影属性的 flash 选项卡中找到声明舞台实例设置,然后单击脚本:Actionscript 3 选择框旁边的设置".

You can find the declare stage instances setting in the flash tab in your movie properties and clicking on "settings" next to Script: Actionscript 3 selectbox.

就我个人而言,我总是取消选中它,因此它会强制您在类中声明实例,并且您可以更好地跟踪正在发生的事情.

Personally I always have this unchecked so it forces you to declare the instances in your class and you can better keep track on what's going on.

这篇关于Flash AS3:ReferenceError:错误 #1056:无法创建属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:56