我有几个定制课程。让我们称之为“Character”,它应该导入并使用“Head”。然后“头”导入并使用“帽子”。这很好。。。
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);
}
}
}
然后头部:
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();
}
}
}
最后是帽子课:
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.
如果我试图定义“Hat”类并在我的主脚本中创建一个“Hat”的新实例,或者在“Hat”中,它就像一个魅力。。。如果我试图用我的“性格”来做这件事,它会给我一个可怕的错误。我检查了我的进口产品,它们都一样!!它到底为什么要这么做?!我真的在这上面浪费了一整天!!!!!
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....