# Setting component properties of dynamically created movieclip

**URL:** <https://forum.kirupa.com/t/setting-component-properties-of-dynamically-created-movieclip/253522>\
**Category:** flash\
**Created:** [March 2, 2008, 2:26pm UTC](https://forum.kirupa.com/t/setting-component-properties-of-dynamically-created-movieclip/253522 "2008-03-02T14:26:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iridium77](https://avatars.discourse-cdn.com/v4/letter/i/958977/32.png) [@Iridium77](https://forum.kirupa.com/u/Iridium77)\
**Post date:** [March 2, 2008, 2:26pm UTC](https://forum.kirupa.com/t/setting-component-properties-of-dynamically-created-movieclip/253522/1 "2008-03-02T14:26:36Z")

</div>

Hello!

I created a movie clip symbol with a user interface in it, using the standard components. It contains various components that I draged on the stage. I named the instances (e.g titleLabel).  
Then I created an ActionScript class for that user interface. Under the linkage properties of the symbol I specified that class. In the class itself, i declared the attribute “var titleLabel:Label”. I thought this would be the same instance from the symbol? But:  
Trying to set the text of the Label AFTER the movie was dynamically added to the parent does not work. I cannot access any properties.

Here is the example:

My Class for the user interface:

```auto
import mx.controls.*;

class Information extends MovieClip {

    
    var titleLabel:Label; //this is the same instance name as in the symbol
    
    public function Information() {
        
        trace("information created")
    }
    
        
    function setTitle(title:String) {
        
      trace(this.titleLabel.text) //should print the actual text of the label, but prints undefined
      this.titleLabel.text = title;
        
        
    }

```

I am loading the “user interface” with the attachMovie function.  
After that I am calling the function setTitle on the instance.

```auto
var information = this.informationPlaceHolder.attachMovie("information_id", "information", 1);
 information.setTitle("Text for the label");

```

The function “setTitle” gets called properly. But it doesn’t set the text of the label. The property “text” seems undefined. It is like the title label was “null”. But I thought it gets instantiated over the symbol and linkage.  
Anyone knows what I am doing wrong here?

Thanks for looking through.  
-Iridium77
