TextField text changed during parent's container gets reset


i'm having aggravating issue think might inherent problem flash, maybe i'm missing something. i'm finding if write class file movieclip in library contains textfield, , try change textfield text in constructor, gets reset or doesn't set or something. i'm thinking maybe flash runs code create library version of movieclip after custom constructor?

 

so example right now, i've got movieclip in library called "menubar". menubar has background bitmap , textfield instance name lbltitle, which has text "title" within library.

 

i've written class file menubar has function:

 

          /**the title of menu displayed in center of menu bar

                     */

                    public final function set title(text:string):void {

                                   trace(lbltitle);

                                   if (lbltitle != null) {

                                                  trace(text);

                                                  lbltitle.text = title;

                                             trace(lbltitle.text);

                                   }

                    }

 

then i've got movieclip in library called "menuscreen". has instance of menubar called menubar. menuscreen has own class file starts this:

 

public function menuscreen(titletext:string)

         {

                    super();

                    menubartop = menubar(this.getchildbyname("menubar"));

                    trace(titletext);

                    trace("old title:" + menubartop.title);

                    menubartop.title = titletext;

                    trace("new title:" + menubartop.title);

         }

 

now run code:

 

var menu:menuscreen = new menuscreen("new title");

 

the debug output comes out this:

 

new title

old title:title

textfield: [object textfield]

incoming text: new title

new text: title

new title:title

 

it's running code change text in textfield, , doesn't throw error, doesn't change text. missing?

i won't pretend follow of described, here's observation... in function show assigning "title" lbltext.text, passing in variable call "text"  don't see title defined anywhere.

 

                    public final function set title(text:string):void { 

                                   trace(lbltitle);

                                   if (lbltitle != null) {

                                                  trace(text);

                                                  lbltitle.text = title;

                                             trace(lbltitle.text);

                                   }

                    }



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support