Hello Kirupians,
I am currently working on a project that is compiled using fsch (Flex Compiler Shell) and making use of assets inside an swf library.
I’m having problems when I try to reference an object that has been put inside another object with the Flash IDE (CS3) and given an instance name.
I keep on having a 1034 telling me that:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@7efaec1 to MyOwnClass
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
MyOwnClass extends an AbstractClass. If I define in AbstractClass a public variable with the same name of the object instance on stage, the error won’t be thrown.
Instead if I declare it in MyOwnClass it will throw the error above.
Both MyOwnClass and the referenced object are declared in this way:
[Embed(source="/assets/sharedassets.swf", symbol="MyOwnClass ")]
public class MyOwnClass extends AbstractClass {
}
[Embed(source="/assets/sharedassets.swf", symbol="com.objects.MyObjectInsideMyOwnClass")]
public class MyObjectInsideMyOwnClassextends AbstractClass {
}
The object is declared in MyOwnClass in this way
...
import com.objects.MyObjectInsideMyOwnClass;
[Embed(source="/assets/sharedassets.swf", symbol="MyOwnClass ")]
public class MyOwnClass extends AbstractClass {
public var myObj:MyObjectInsideMyOwnClass
public function MyOwnClass ():void {
}
}
...
If I call myObj inside MyOwnClass it will throw the error above.
Any ideas? I am pulling all my remaining hair.