Hm, I am doing something similar in some item renderers (Have in mind
that there might be an easier / better way i am still learning this):

I can think of two ways 

1) (simple and dirty):

Register the callback and in the callback call a function on the other
component that you are interested:

 a) Component A throws Alert with callback A
 b) callback a calls (component B).alertClosed(some var here if needed)

2) Generic / better ? way (not sure if it any better actually :-)

 a) Create a new event class ie:

package events
{
        import flash.events.Event;

        public class DeletePhotoEvent extends Event
        {
                public var photoId:String ;
                
                public function DeletePhotoEvent (type:String,
bubbles:Boolean=false, cancelable:Boolean=false)
                {
                        super(type, bubbles, cancelable);
                }
        
                // Override the inherited clone() method. 
        override public function clone():Event 
        {
                return new DeletePhotoEvent (type);
        }
        }
}

 b) Make your component - the one with the alert register this type of
event (TileList example):

<mx:TileList xmlns:mx="http://www.adobe.com/2006/mxml";
        direction="horizontal">
        <mx:Metadata>
                [Event(name="deletePhotoEvent",    
type="events.DeletePhotoEvent")]
        </mx:Metadata>
</mx:TileList>

 c) associate this callback with your component b method

  <ns1:UserPhotos id="rightPanelId"
    deletePhotoEvent="componentB.alertClosed()"/>
  
 *) you will still need the callback in component A:

  private function deleteMe(event:MouseEvent):void
  {
     var delPhotoEv:DeletePhotoEvent = new
DeletePhotoEvent("deleteProductEvent", true) ;
                
     delPhotoEv.photoId = event.currentTarget.value ;           
     dispatchEvent(delPhotoEv);// bubble to parent
  }

Hope it helps ;-)
   

--- In flexcoders@yahoogroups.com, "sleblang" <[EMAIL PROTECTED]> wrote:
>
> Thanks. That is not exactly what I am asking. I understand how to set
> a callback/listener for Alert.show() as you explained. However, is
> there another way to detect from another component when the alert has
> been closed (i.e. bubbling, etc.)?
> 
> --- In flexcoders@yahoogroups.com, "fotis.chatzinikos"
> <fotis.chatzinikos@> wrote:
> >
> > Hi, if i understand correctly, the following doesit:
> > 
> > Alert.show("This is the alert text.","",4,null,alertClosed) ;
> > 
> > where alertClosed is an event listener...
> > 
> > Check the asdoc for the alert.show method ;-)
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "sleblang" <scott@> wrote:
> > >
> > > I have an Alert.show() being called from a command class. I need to
> > > detect when this Alert is closed in another mxml component (as
opposed
> > > to the command class). What's the best way to determine when
it's been
> > > closed?  Does the event bubble? So far I have not been able to
'catch'
> > > it.
> > > 
> > > Thanks for any and all replies.
> > >
> >
>


Reply via email to