# Scoping issue with .swc?

**URL:** <https://forum.kirupa.com/t/scoping-issue-with-swc/225920>\
**Category:** Uncategorized\
**Created:** [May 16, 2007, 6:42pm UTC](https://forum.kirupa.com/t/scoping-issue-with-swc/225920 "2007-05-16T18:42:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huinoio](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@Huinoio](https://forum.kirupa.com/u/Huinoio)\
**Post date:** [May 16, 2007, 6:42pm UTC](https://forum.kirupa.com/t/scoping-issue-with-swc/225920/1 "2007-05-16T18:42:49Z")

</div>

I’m trying to create a simple example of how I can create a .swc component with CS3. I hope this lays out what I’m trying to do here.

I create a .fla file with a symbol (movieclip) that has within it a single textfield which is “dynamic” and I name it ‘mytext\_txt’.

In the linkage for this symbol (movieclip), I enter the name of the .as class file I want to associate with this and it looks like this:

[COLOR=blue]package {  
import flash.display.\*;  
import flash.text.TextField;[/COLOR]  
[COLOR=blue] public class testpoint extends MovieClip{[/COLOR]

[COLOR=blue] public var \_pointid:String = “Howdy”;[/COLOR]

[COLOR=blue] public function pbvert(){  
mytext\_txt.text = \_pointid;  
}[/COLOR]

[COLOR=blue] [Inspectable(defaultValue=“Howdy”)]  
public function get PointID(){  
return \_pointid;  
}  
public function set PointID(val:String):void{  
\_pointid = val;  
}  
}  
}[/COLOR]  
[COLOR=#0000ff][/COLOR]  
[COLOR=black]Now if I run this from the .fla, it works as expected and the label will display “Howdy” as the constructor commands. Now when I turn this into a .swc file and try to use it in another .fla, it can’t find the mytext object and reports the error: [/COLOR]  
[COLOR=red]‘access of possibly undefined property mytext\_txt through a reference with static type’[/COLOR]

[COLOR=black]Why can’t it see the textfield now?[/COLOR]
