Search code examples
flashactionscript-3coercion

Type Coercion Error with Loaded and Instantiated SWF


I am loading a swf, "ImageEdit" into another swf, "Shell". I instantiate ImageEdit with

var ClassReference:Class=imageEditApplicationDomain.getDefinition("ImageEdit") as Class;  
var instance:MovieClip=new ClassReference();

However, I get an error:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@3b678b31 to fl.controls.Slider

ImageEdit does not throw an error when run by itself and not loaded into Shell. I've added:

import fl.controls.Slider

to Shell and other things which didn't help. Both SWFs contain the Slider component in their libraries. I am working Flash Professional CS5.5.

How can I get rid of the coercion error?


Solution

  • Replace MovieClip with Sprite or * or leave the type out.