The class does not appear to be a UI class, so why can't you instantiate it
where you need it and set a direct listener on it?

 

Also, if it is going to dispatch an event it needs to extend
EventDispatcher, I believe.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of Eric W Dunn
Sent: Wednesday, May 06, 2009 11:47 AM
To: [email protected]
Subject: [flexcoders] Re: Dispatching Events from SWC - via Class`

 






It would appear that it is not in the child hierarchy..

I am not sure how o fix this problem.. What would you recomend me trying? 

--- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
"Tracy Spratt" <tr...@...> wrote:
>
> That is not even a "custom event", it is a flash event with a custom type.
> 
> 
> 
> The metadata should go above the class definition, but the metadata should
> not be necessary.
> 
> 
> 
> If you are depending on the bubbling, are yo sure the Adaption. class is
in
> the child hierarchy of the listener? PopUps, for example are not.
> 
> 
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
> _____ 
> 
> From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
[mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
On
> Behalf Of Eric Dunn
> Sent: Friday, May 01, 2009 4:23 PM
> To: flexcoders
> Subject: [flexcoders] Dispatching Events from SWC - via Class`
> 
> 
> 
> 
> 
> 
> 
> 
> I am trying to creating a custom event in a actionscript class that will
be
> distributed via a swc file..
> 
> I need to notify the parent application of when data is finished loading. 
> 
> Here is what I've been playing with: 
> 
> Class File: created as a Flex Library Project
> package com.adaption.instance
> { 
> import com.adaption.Adaption_SiteDetails_Structure;
> import flash.events.Event; 
> 
> public class Adaption_SiteDetails_
> {
> private static var instance:Adaption_SiteDetails_;
> public static function get siteDetail():Adaption_SiteDetails_
> {
> if (instance == null)
> {
> instance = new Adaption_SiteDetails_;
> }
> return instance;
> }
> [Bindable] public var myInstance_SiteDetails:Object = new
> Adaption_SiteDetails_Structure;
> 
> [Event (name="enableChanged", type="flash.events.Event")]
> 
> public function createSiteDetail(dataObject:Object):void
> {
> siteDetail.myInstance_SiteDetails.businessLine =
> dataObject.businessLine; 
> siteDetail.myInstance_SiteDetails.businessPartnerID =
> dataObject.businessPartnerID;
> siteDetail.myInstance_SiteDetails.ccEnterpriceID =
> dataObject.ccEnterpriceID;
> siteDetail.myInstance_SiteDetails.ccGroupID =
> dataObject.ccGroupID;
> dispatchEvent(new Event("enableChanged",true));
> }
> 
> Application File:
> creationComplete="initApp(event)" // in the application header. 
> private function initApp(e:FlexEvent):void 
> {
> valueOfBusinessPartner =
> Application.application.parameters.businessPartnerValue;
> valueOfAuthCode = Application.application.parameters.authCodeValue;
> valueOfAppiaWs = Application.application.parameters.appiaWsValue;
> if (valueOfAuthCode == "QA")
> {
> header.lblConnectionType.text = "QA-build"
> }
> loadWsXML(e);
> loadBpXML(e);
> loadAcXML(e);
> 
> bm = BrowserManager.getInstance();
> bm.init("", "OfficeFone Dashboard - Site Administrator");
> bm.setTitle("OfficeFone Dashboard - Site Administrator");
> this.addEventListener("enableChanged", getSiteDetailsHandler);
> }
> 
> Any one see where I've gone wrong or what I've missed? I tried putting
> <MetaData> tags around the Event method but no love , I've tired the
> MetaDataEvent (that the only option when I ctrl-SpaceBar) EventDispatch is
> soething else I've tired. 
> 
> Do I need to create a Custom Event Class in the library? or should I be
> doing this another way... 
> 
> 
> I am trying to create a component libary to invoke a web service, store
the
> data and send out a notification upon completion of the data retrieval. 
> 
> Thanks... 
> 
> Eric W Dunn
> Adaption Technologies
> 281-465-3326
> ed...@...
>



Reply via email to