开发者

load swf to background of sprite

开发者 https://www.devze.com 2023-04-02 09:29 出处:网络
i have saved my background as a swf file. [Embed(source=\"Back.swf\")] private var SomeClass:Class; Now inside the main class i added

i have saved my background as a swf file.

    [Embed(source="Back.swf")]
    private var SomeClass:Class;

Now inside the main class i added

addChild(SomeClass);

But i get this red problem :- Description Reso开发者_运维知识库urce Path Location Type 1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject. Test.as /Test/src


When you are using the addChild method, you need to parse there a DisplayObject type. in this case your SomeClass is Class type.

try:

addChild ( new SomeClass () );

or

addChild ( new SomeClass () as MovieClip );
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号