Error #1034: Type Coercion failed: cannot convert ... to flash.display.MovieClip

I'm new to ActionScript, so there is a possibility that I'm asking something simple.

import flash.display.MovieClip;
var WinsRM:Array = new Array (protomanwin);
var Robotmaster:MovieClip = new MovieClip;
Robotmaster = WinsRM[0];
addChild(Robotmaster);
Robotmaster.y = 250;
Robotmaster.x = 70;

No compiler error but I get this error:

TypeError: Error #1034: Type Coercion failed: cannot convert protomanwin$
                        to flash.display.MovieClip. 

The protomanwin is a movie clip with many frames. I don't know what's wrong. No symbol will display. Also I use an array because I want to have more than one symbol to call in the future.

Upvotes: 1

Views: 3234

Answers (1)

Vesper
Vesper

Reputation: 18747

It seems that "protomanwin" is a name of an asset in your library. In this case, "protomanwin" is type Class, so instead of doing Robotmaster assignment as you do right now, you have to do this:

Robotmaster=new WinsRM[0]();

Note that you can make more than a single instance of your movie clip should you need to.

Upvotes: 1

Related Questions