CustomEvent class issue
I make use of a CustomEvent class, one which I believe is standard since when I went to create it at one point, I swear Flash filled in all of the code for it before I could paste it in. I use it to have swf's that are loaded by a main file capable of dispatching an event with some data to go with it. The code for the class is shown below at the bottom.
The CustomEvent class file is planted in a com folder structure that is defined in my classpath for Flash
It works fine for me when it works, but it seems like anytime I start a new directory/collection of files for a new/divergent revision of the main file, the published swf's produce errors with respect to the CustomEvent class when I try to load into the main file...
TypeError: Error #1034: Type Coercion failed: cannot convert com.path::CustomEvent@80ac1c1 to CustomEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at loadedswf_fla::MainTimeline/frame23()
What ends up fixing this is publishing the files again within their new folder structure.
I have always been under the impression that once you publish an swf it burns in the code that was used in its creation and no longer requires the AS class files that were used in creating it. But this one seems to defy that.
Do you know why this happens and what might be done to not have to remedy it by republishing? There are quite a few of them which makes it a bit of a pain each time a new variation comes about.
Here is the class file code:
package com.path
{
import flash.events.Event;
public class CustomEvent extends Event
{
public var params:Object;
public function CustomEvent(type:String, params:Object, bubbles:Boolean = false, cancelable:Boolean = false)
{
super(type, bubbles, cancelable);
this.params = params;
}
public override function clone():Event
{
return new CustomEvent(type, params, bubbles, cancelable);
}
public override function toString():String
{
return formatToString("CustomEvent", "params", "type", "bubbles", "cancelable", "eventPhase");
}
}
}
