SyntaxScrewer's Blog

August 19, 2011

SWF in a SWF in a SWF SHELL = Exception fault: TypeError: Error #1034: Type Coercion failed:

Filed under: ActionScript 3.0,Flash — geekymaira @ 2:59 pm

Hello folks!!

I got stuck with this bugging bug!! and I just HAD to share it.
So, I had a Main SWF that loaded up a MapClass swf and a SHELL that loaded up the Main swf. Everything worked when I debugged the Main SWF alone. But as soon as I debugged the shell, I got the following error.

Exception fault: TypeError: Error #1034: Type Coercion failed: cannot convert a.b.c::MapEvent@c899eb1 to a.b.c.MapEvent.
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at com.iomedia.components::MapDocumentClass/onMapButtonClicked()
My Project structure was

<Root>
   <src>
	<a>
           <b>
             Main.as
             Shell.as
               <c>
                 MapDocumentClass.as
                 MapEvent.as
   <fla>
      <maps>
        MapClass.fla   //SRC path set as   "../../src"   DOCUMENT CLASS: a.b.c.MapDocumentClass

Basically, I had 3 levels of nesting of swf's.
SHELL SWF <- MAIN SWF <- SHELL SWF

When I compiled the Main.as file it automatically compiled the event class and had it ready for the Erroneous Swf to use. So everything was peachy!
However, when I compiled the SHELL SWF, it didn't compile the Event Class because there was no reference to it in the Shell.as class.

The solution :

1) Create  a dummy variable for the event in the Shell.as class
2) Import the Event Class so that it gets compiled.

Everything worked after that!!
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: