As3,referenceerror:error #1056: Could not be created for XX
attribute xxx.
When the display object is associated with a script class, and the display object in the Display object is set to the name in the Properties panel, the Referenceerror:error #1056: Cannot create attribute xxx for XX. "Error. It is said on the web that defining a common attribute of the same name and type in a script class is not really necessary, just like this:
In Flash9, the File menu, publish settings, select the "Set ..." button after the ActionScript version selection, enter the ActionScript3.0 setting, and the "Stage: auto-Declare stage instance" check box is checked, and the export is OK.
Referenceerror:error #1056的处理
FLASH 2009-12-02 15:15:09 Read 407 comments 1 font size: Big Small
In Flash 9, you can associate a stage object to a script class (Actionscript Class). You can drag and drop an MovieClip extension object onto the stage, and then specify its properties in the Properties Panel (property pane). But when you try to use this new feature, you get an error report similar to the following:
Referenceerror:error #1056: Cannot create property test1_btn on test.at flash.display::sprite/ Flash.display:sprite::constructchildren () atFlash.display::sprite$iinit () at Flash.display:: MovieClip$iinit () at Test$iinit ()
In fact, this is because it is necessary to publicly (publicly) declare any objects that appear in your class (Buttons, MovieClips, Textfields, etc), including those that have been named on the stage.
For example, when you draw an object called "MYMC" on the stage, you should declare it as a public variable in the corresponding class:
package{ import flash.display. MovieClip; Public class extends MovieClip { publicvar mymc:MovieClip; Public function Test () { } }}
Write an example below:
First step: Create a Movie clip (Chengye_txt), draw a dynamic text box inside it, and name the dynamic text box (PSW), and then drag an instance from the library onto the stage after editing is complete.
Step Two: Create a chengye_txt.as file with the following input:
package{ import Flash.text.TextField; import flash.display. movieclip public class chengye_txt movieclip { public var Psw:textfield; public function Chengye_txt () {psw.text = "Welcome to the industry blog"
and associate it with the movie clip chengye_txt, test! You'll see the text in the TextBox turn into a welcome blog, where the public var Psw:textfield is implemented in the class, the dynamic text box PSW is associated with the inside of the class, and the value can also be modified by code. If you Psw:textfield public Var, the following error will appear if you comment out:
Referenceerror:error #1056: Could not create property PSW for Chengye_txt. At Flash.display::sprite/Flash.display:sprite::constructchildren () atflash.display::sprite$ Iinit () at Flash.display::MovieClip$iinit () at Chengye_txt$iinit () at Flash.display::sprite /Flash.display:sprite::constructchildren () atFlash.display::sprite$iinit () at Flash.display:: MovieClip
As3,referenceerror:error #1056: