If Adaption... class is not extending DisplayObject and a child or grandchild 
(or deeper) of the application, then bubbling will not work.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Tracy Spratt
Sent: Friday, May 01, 2009 2:46 PM
To: [email protected]
Subject: RE: [flexcoders] Dispatching Events from SWC - via Class`




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: [email protected] [mailto:[email protected]] 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
[email protected]

Reply via email to