• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Aug 30, 2020 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

479

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
community guidelines
Community Expert ,
Aug 30, 2020 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)

Votes

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
community guidelines
New Here ,
Sep 08, 2020 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!

Votes

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
community guidelines
Community Expert ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines