Before you open the popup dialog, you have to create a reference variable to the dialog box itself

create it like this
private var hwin:TitleWindow;
dont forget to import the TitleWindow class
in your function
private function showLogin(logintitle:String, callback:Function):void
{
statusMsg.text = "Bitte anmelden";
hwin = PopUpManager.createPopUp( this, logwin, true ) as TitleWindow;
hwin.title = logintitle;
}
so far nothing has changed...its the same as ur code, just written differently. the proper way add some kind of callback functionality is to dispatch events within your component. above your script tag in your component....add a metadata tag
<mx:Metadata>
[Event(name="loginEvent", type="eventsFolder.customEventName")]
</mx:Metadata>
when the user clicks on your button you want to dispatch a custom event and pass the event parameters. change the button mxml to look something like this
<mx:Button click="newFunction()" label="Anmelden" />
then handle it like this...
private function newFunction():void
{
var evt:customEventName = new customEventName( username.text, pw.text, "loginEvent" );
dispatchEvent( evt );
}
its best practice to use a data transfer object instead of passing all this params in the events. but i am trying to keep this post as short as possible.
now back to your main application where you call the popup. change the showLogin function to look like this
private function showLogin(logintitle:String, callback:Function):void
{
statusMsg.text = "Bitte anmelden";
hwin = PopUpManager.createPopUp( this, logwin, true ) as TitleWindow;
hwin.title = logintitle;
hwin.addEventListener("loginEvent", loginEventHandler);
}
see where i am going???;-) you add an event listen to the popup...so when a user clicks the button in ur dialog box, the application knows how to handle it since its dispatched from the component.
private function loginEventHandler( evt:customEventName ):void
{
//handle here
}
hope this gives you an idea :-)