assigning value to dynamic text box on stage via actionscript 3.0 class
Copy link to clipboard
Copied
on Adobe Animate canvas
there is a textbox name : myTextBox i.e. dynamic variable.
now in actionscript class
{
var cc:String = dropTarget.parent.name;
myTextBox.text = cc;
Access of possbily undefined property
}
package net.asit.aqua
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.text.Font;
import flash.text.StageText;
import flash.text.TextField;
import flash.display.Sprite;
import flash.text.*;
import flash.display.DisplayObjectContainer;
public class AquaScript extends MovieClip {
.
.
.
.
{
var cc:String = dropTarget.parent.name;
myTextBox.text = cc;
.....
}
Somehow I have to assign values in text box via actonscript class only.
Copy link to clipboard
Copied
is that your document class?
where's dropTarget defined?
which line of code is triggering the error (enable debugging to see that info, publish settings>tick enable debugging)
Copy link to clipboard
Copied
yeah, that true, it is all inside a document class.
and now, I need value to be assigned from class to stage in CCtxt.text dynamic variable.
error, only occurs wherever I tries to assign value in any dynamic textbox which is on stage:
eg: "1120: Access of undefined property" CCtxt.
where CCtxt is a dynamic text box on stage.
Actually, I am not getting how I can assign value in stage dynamic variable through ActionScript class.
Please help!
Copy link to clipboard
Copied
if you really have a textfield with instance name CCtxt, you're trying to reference it when it doesn't exist. eg, if CCtxt were on frame 2 and you tried to reference it in the document class constructor, you would see that error.
there are other ways to trigger that error. here's an excerpt from a book i wrote:
Flash Game Development: In a Social, Mobile and 3D World
1120:Access of undefined property error xxxx
You either have a typo, you have forgotten that ActionScript is case sensitive or you have defined the variable somewhere but your reference is out of scope of the defined variable. Typically, the later occurs when you make a variable local to a function and then try and reference the variable outside that function.

