Flash AS3: ReferenceError: Error #1056: Cannot create property

前端 未结 1 585
刺人心
刺人心 2020-12-11 01:12

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

ReferenceError: Error #1056: Cannot create property txtInput on package.name.DocumentClas

相关标签:
1条回答
  • 2020-12-11 01:31

    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;
    ...
    

    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.

    0 讨论(0)
提交回复
热议问题