Highlighted

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

New Here ,
Aug 30, 2020

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.

TOPICS
ActionScript, Code

Views

53

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

New Here ,
Aug 30, 2020

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.

TOPICS
ActionScript, Code

Views

54

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 30, 2020 0
Adobe Community Professional ,
Aug 30, 2020

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)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 1
New Here ,
Sep 08, 2020

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!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 08, 2020 0
kglad LATEST
Adobe Community Professional ,
Sep 08, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 08, 2020 0