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]