继承Sprite-MovieClip所产生的AS3的问题
TestSprite类:package{importflash.display.*;importflash.events.Event;publicclassTestSpr...
TestSprite类:package{import flash.display.*;import flash.events.Event;public class TestSprite extends Sprite{public function TestSprite(){addEventListener(Event.ADDED_TO_STAGE,added);}function added(e:Event){trace(Sprite(parent).boo);//trace(MovieClip(parent).boo);//修改为MovieClip输出:say hello}}} Test文档类:package{import flash.display.*;public class Test extends Sprite{//修改为继承MovieClipvar boo:String="say hello";var testSprite:TestSprite=new TestSprite();public function Test(){addChild(testSprite);}}} 求解:为什么文档类修改为继承MovieClip,在TestSprite类将parent转换MovieClip可以访问到文档类的属性,而转换为Sprite却访问不到?
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询