I've got several custom classes. Let's call them "Character", which is supposed to import and use "Head". Then "Head" imports and uses "Hat". That works just fine...
package character
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import flash.display.Sprite;
import flash.events.Event;
import character.Head;
import character.Hat;
public class Character extends MovieClip
{
// the objects
public var _head:Head;
// IF I UNCOMMENT THIS, I GET THIS 1046 ERROR
// public var asdfasfd:Hat;
public function Character():void
{
trace("NEW CHARACTER");
_head=new Head(stageRef, head_text);
//_shirt=new Shirt(stageRef, shirt);
}
}
}
and then head:
package character
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import character.Hat;
// the character's head
public class Head extends MovieClip
{
public var _hat:Hat;
function Head(head_type:String=null):void
{
trace ("NEW HEAD");
this._hat = new Hat();
}
}
}
And finally the hat class:
package character
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import character.*;
// the character's head
public class Hat extends MovieClip
{
private var stageRef:Stage;
function Hat(stageRef:Stage=null, type:String=null):void
{
trace ("NEW HAT");
}
}
}
This runs without a hitch. Simple as pie... But if I try to create a new instance of "Hat" or even define the Hat variable in "Character", it gives me the compile time error : 1046: Type was not found or was not a compile-time constant: Hat.
If I try to define "Hat" class and create a new instance of "Hat" in my main script, or in "Hat" it works like a charm... If I try to do it in my "Character" it gives me this godforsaken error. I've checked my imports, they're all the same!! Why in the world is it doing this?! I have literally wasted an entire day on this!!!!!
EDIT / EXTRA INFO: I literally have 5 almost identical classes, like shirt, pants, head, hat, arm... and some of them work, others don't. I copied n' pasted one of the completely generic classes that does work over one that doesn't and still nothing. They're all linked fine and exported for ActionScript... everything's identical, except some work and others dont. But the ones that don't, do work if I include them in the classes that are being called, or anywhere else for that matter... just not in the class I need. I've been on this same thing for 24 hours now. I need a vacation....