all groups > flash actionscript > june 2006 >
You're in the

flash actionscript

group:

PopUpManager in the UIComponent Class and events


PopUpManager in the UIComponent Class and events LA Flash Guy
6/22/2006 8:44:38 PM
flash actionscript:
Can anyone shed some light on the PopUpManager in the UIComponent Class in
Flash?
I am working on a project in which everything inheirits from the UIComponent
Class and I'm having a bit of trouble with paths to my movieClips.

I am creating a popup in an MC Class which is called IMDevice.
popAlert = PopUpManager.createPopUp (this, Window, true, { title : "Choose
Instant Message Type", contentPath : "IMAlert", closeButton : false});
popAlert.setSize (320, 350);
popAlert.move (680, 405);
popAlert.addEventListener("click",this);
popAlert.addEventListener("change",this);

It loads the MC Class IMAlert from the lib.
That all works fine.

However I'm I'm not getting events dispatched from IMAlert.

I've tried adding a dispatchEvent in the eventHandler in IMAlert to address
what I thought was a scoping issue

_parent.dispatchEvent({type:"change"});

But I don't receive anything in the parent MC.

Any help would be appreciated.
Re: PopUpManager in the UIComponent Class and events LA Flash Guy
6/23/2006 12:22:07 AM
The mystery has been solved.
2 things for anyone interested:

#1 An MC that loads into a Window can be found at Window.content
#2 You can't add the eventListener until the content has loaded completely. You
can use the "complete" event that is dispatched when a Window is completely
loaded.

// this is all within a Class that extends UIComponent so event delegation
isn't required
popAlert = PopUpManager.createPopUp (this, Window, true, { title : "Choose
Instant Message Type", contentPath : "IMAlert", closeButton : true});
popAlert.setSize (320, 350);
popAlert.move (680, 405);
popAlert.addEventListener("complete", this);

function handleEvent (evt : Object) : Void {

var e = evt.event;
var t = evt.target;

if (e == "complete") {
popAlert.content.addEventListener("change",this);
}

if (e == "change") {
trace ('IMDevice.change target: ' + t);
}
}
AddThis Social Bookmark Button