Strange undefined property of object
I've created a movie clip and exported if for AS, naming the class "Char." The movie clip has a couple of frame labels with a couple of pictures in it on each label.
As the SWF opens, it gets dynamically added to the stage like so:
var charMC:MovieClip = new Char();
addChild(charMC);
charMC.x = 164;
charMC.y = 624;
This works fine with no errors.
However, further down I have a function that is going to call this clip and move it to a different frame. Like so:
function someFunction():void
{
//some stuff
charMC.gotoAndPlay("start");
}
This does not work, and I get the error "Access of undefined property of charMC."
Note this function has not even been called yet, I get the error when the swf compiles. This makes no sense to me. What I am doing wrong? It seems the variable/object is in scope, as it has already been defined and even added to the stage.