Hi Juan,
Thanks for the tip, it does makes sense since I had to create something
similar in a different application in AS3 and your sample works just as
expected.

Thanks again,
Helmut

On Sat, Aug 16, 2008 at 5:42 PM, Juan Pablo Califano <
[EMAIL PROTECTED]> wrote:

> Assuming that modifying the custom application is not possible, but that
> you
> can change mySWF.swf, you can use an event manager that acts as a "proxy"
> for dispatching events. So, instead of dispatching the event directly from
> your object, you use the "service" of a third party. You register to that
> same third party to listen for events.
>
> In order to get it working, you have to make sure that you have just one of
> these proxies, so you could use a singleton. Really, that's like using a
> "global" object, but nevertheless a bit more clean than a plain old enter
> frame to check whether a propertie is defined, IMHO.
>
> In code, it could be something like this:
> (I'm using GDispatcher, and I'd advise you to use it as well as it has more
> features than the mx.events.EventDispatcher class, but if you want to go
> with the mx class, just change the function declarations accordingly, and
> adjust the parameters in addEventListener when registering for some event)
>
> import com.gskinner.events.GDispatcher;
>
> class EventManagerProxy {
>
>  /* event dispatcher API declarations */
>  public function
> addEventListener(sEvt:String,oHandler:Object,sFnc:String):Void {}
>  public function
> removeEventListener(sEvt:String,oHandler:Object,sFnc:String):Void {}
>  public function dispatchEvent(oEvt:Object):Void {}
>  public function removeAllEventListeners(sEvt:String):Void {}
>
>
>  public static var STUB_LOADED:String = "stubLoaded";
>
>    private static var _instance:EventManagerProxy = null;
>
>    private function EventManagerProxy() {
>  GDispatcher.initialize(this);
>    }
>
>    public static function getInstance():EventManagerProxy {
>        if(!_instance) {
>            _instance = new EventManagerProxy();
>        }
>        return _instance;
>    }
>
>
> }
>
> // In your loader fla...
>
>
> import EventManagerProxy;
>
> var evtMgrProxy:EventManagerProxy = EventManagerProxy.getInstance();
>
> function handleStubLoaded(evt:Object):Void {
>  for(var field:String in evt) {
>  trace(field + " : " + evt[field]);
>  }
> }
>
>
> evtMgrProxy.addEventListener(EventManagerProxy.STUB_LOADED,this,"handleStubLoaded");
>
> code.customApplication.load("mySWF.swf", myClip_mc);
>
>
>
> // In the loaded stub swf, dispatch the event when needed
>
>
> import EventManagerProxy;
> var evtMgrProxy:EventManagerProxy = EventManagerProxy.getInstance();
>
> evtMgrProxy.dispatchEvent({
>  type:   EventManagerProxy.STUB_LOADED,
>  target:  this,
>  stubId:  "someId -- if you happen to need this!"
> });
>
> Hope it helps.
> Cheers
> Juan Pablo Califano
>
>
>
> 2008/8/16, Helmut Granda <[EMAIL PROTECTED]>:
> >
> > I have the following:
> >
> > code.customApplication.load("mySWF.swf", myClip_mc);
> >
> > now the custom application does not dispatch any events such as
> onComplete,
> > this wasnt built in the original application so what I want to do is
> > dispatch an event from mySWF.swf but of course when it is loaded into
> > myClip_mc the ability to add the event listeners is not there since they
> > are
> > not part of myClip_mc but of mySWF.swf.
> >
> > Is there anyway to go around it? I know one way to do it is to have an
> > "onEnterFrame" checking for one of the properties of mySWF.swf once is
> > loaded....
> >
> > TIA...
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
...helmut
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to