Skip to main content
Jinesh5FE2
Participant
August 30, 2020
Question

assigning value to dynamic text box on stage via actionscript 3.0 class

  • August 30, 2020
  • 1 reply
  • 751 views

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.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 30, 2020

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)

Jinesh5FE2
Participant
September 8, 2020

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!

kglad
Community Expert
Community Expert
September 8, 2020

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.