PDA

View Full Version : Alert component works on second try


SteveSloan
08-22-2005, 05:50 PM
ok, i have this code in a button and when you push the ok button on the alert box the first time, nothing happens. when you push the next button and push ok again it works great.
Does anyone have any idea what's going on?

on (release)
{

with(_parent){
//stop any video
var netConn:NetConnection = new NetConnection();
}

import mx.controls.Alert;
mx.controls.Alert.show("Have you completed all of your interviews? If you have click OK to proceed. Otherwise click cancel to continue your interviews.", "Are you sure?", Alert.OK | Alert.CANCEL, this, nextClickHandler, "stockIcon", Alert.OK);

nextClickHandler = function (evt)
{
trace(Alert.OK);
if (evt.detail == Alert.OK)
{
trace("proceed");
//with(_parent){
//stop any video
var netConn:NetConnection = new NetConnection();
fadeIn.gotoAndPlay(22);
//}
}
}
}

SteveSloan
08-22-2005, 07:08 PM
ok i figured it out, it seems you need to have everything in the correct order
1. import
2. handler code
3. Alert.show code

import mx.controls.Alert;
nextClickHandler = function (evt)
{
trace(Alert.OK);
if (evt.detail == Alert.OK)
{
trace("proceed");
//with(_parent){
//stop any video
var netConn:NetConnection = new NetConnection();
fadeIn.gotoAndPlay(22);
//}
}
}

Alert.show("Have you completed all of your interviews? If you have click OK to proceed. Otherwise click cancel to continue your interviews.", "Are you sure?", Alert.OK | Alert.CANCEL, this, nextClickHandler, "stockIcon", Alert.OK);