Problem with Dynamic Text fields

Explorer ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

Hello, I have problem and I think its simply but I cant do anything....

when I have this:

 

var container_:MovieClip = new MovieClip();
        this.addChild(container_);

 

var movie_clip:hello = new hello;

 

function add_my_text(){

     container_.addChild(movie_clip);

     movie_clip.my_text.text = "hello";

}

 

BUT IF I HAVE LIKE THIS:

 

var container_:MovieClip = new MovieClip();
        this.addChild(container_);

 

var movie_clip:hello;

 

function add_my_text(){

     movie_clip = new hello;

     container_.addChild(movie_clip);

     movie_clip.my_text.text = "hello";

}

 

I get the error.  TypeError: Error #1010: A term is undefined and has no properties. The same with EventListeners and etc. Why this hapening?

if I write my movieclips in frames like for example:

var movie_clip:movieclip = new movieclip;

My flash is going very slow becouse I have many movieclips in library.

 

Thanks.

TOPICS
ActionScript, Error

Views

97

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
community guidelines
Adobe Community Professional ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

Hi.

 

Both versions of your code are working here.

 

Can you provide more details?

 

Regards,

JC

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
community guidelines
New Here ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

hi not at al related to the topic but i need your help animat crashed before but there was a recovery from that point on i saved to the recovery but then this morning i had classes and it was taking up to much system resources so i saved then closed it but no in the after noon i am not finding it and it is due for today i have a swf file but it does not have everything and hen i checked adobe that recent file was no where to be seen except when i pressed file and open recent and then found it pressed it this file cant be located 

CAN YOU PLEASE HELP ME .

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
community guidelines
Explorer ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

import flash.display.MovieClip;

var container:MovieClip = new MovieClip;

this.addChild(container);

var MC:movieclipas;

setTimeout(add_dalykus, 2000);

function add_dalykus(){
	MC = new movieclipas;
	stage.addChild(MC);
	MC.x = 200;
	MC.y = 200;

	MC.textfield_my.text = "bibiena";
}

It`s all details.

I create empty file.

With code:

import flash.display.MovieClip;

var container:MovieClip = new MovieClip;

this.addChild(container);

var MC:movieclipas;

setTimeout(add_dalykus, 2000);

function add_dalykus(){
	MC = new movieclipas;
	stage.addChild(MC);
	MC.x = 200;
	MC.y = 200;

	MC.textfield_my.text = "bibiena";
}

IT WORKS UNTIL FUNCTION  HAS TO CHANGE/SET TEXT IN THE MC.

The same with events. I mean if I want to addEventListener to textField Im getting the same eror.

TypeError: Error #1010: A term is undefined and has no properties.

But its hapening just with text fields.

 

In this version everything works fine:

import flash.display.MovieClip;

var container:Sprite = new Sprite;

this.addChild(container);

var MC:movieclipas = new movieclipas;;

setTimeout(add_dalykus, 2000);

function add_dalykus(){
	stage.addChild(MC);
	MC.x = 200;
	MC.y = 200;

	MC.textfield_my.text = "bibiena";

}

 

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
community guidelines
Explorer ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

LATEST

It`s all details.

I create empty file.

With code:

import flash.display.MovieClip;

var container:MovieClip = new MovieClip;

this.addChild(container);

var MC:movieclipas;

setTimeout(add_dalykus, 2000);

function add_dalykus(){
	MC = new movieclipas;
	stage.addChild(MC);
	MC.x = 200;
	MC.y = 200;

	MC.textfield_my.text = "bibiena";
}

IT WORKS UNTIL FUNCTION  HAS TO CHANGE/SET TEXT IN THE MC.

The same with events. I mean if I want to addEventListener to textField Im getting the same eror.

TypeError: Error #1010: A term is undefined and has no properties.

But its hapening just with text fields.

 

In this version everything works fine:

import flash.display.MovieClip;

var container:Sprite = new Sprite;

this.addChild(container);

var MC:movieclipas = new movieclipas;;

setTimeout(add_dalykus, 2000);

function add_dalykus(){
	stage.addChild(MC);
	MC.x = 200;
	MC.y = 200;

	MC.textfield_my.text = "bibiena";

}

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