Actionscript 3 message box?
I need to show a modal confirmation dialog with yes no buttons and get the results what the user has clicked in ActionScript 3
ok save diaglog does not who up when exit is called the application just exits.
Alert.show("Do you realy want to delete", "My Title", 3,null,
function alertClickHandler(event:CloseEvent):void
{
if (event.detail==Alert.YES)
{
canvas.save(); // does not popup when next line is present
exit();
开发者_C百科 }
} );
Abdul Khaliq
This is the example for an Alert box:
Alert.show("Do you realy want to delete", "My Title", 3,null,
function alertClickHandler(event:CloseEvent):void
{
if (event.detail==Alert.YES)
{
//do stuff if clicked yes
}
} );
The calls in Actionscript are sometimes asynchronous.
Specially calls to file saves and all.
What you should really do is :
Alert.show("Do you realy want to delete", "My Title", 3,null,
function alertClickHandler(event:CloseEvent):void
{
if (event.detail==Alert.YES)
{
canvas.save(true); // does not popup when next line is present
exit();
}
} );
Modify the save function as follows:
public function save(exitAfterSave:boolean):void
{
//do whatever you need to do to save the file
if(exitAfterSave)
exit();
}
精彩评论