PDA

View Full Version : Getting back into ActionScript


bladeMX
04-24-2003, 05:47 PM
I have two function that I currently set up for testing purposes. Now I'm trying to combine the two. What I'm trying to accomplish here is to have my hours convert to 24 hour format and then sent to the backend script ... all within a single function. What is the best way to handle this? Any suggestions are welcomed ... thanks!

Here is the first function:

function transferDate(){
whour1 = Number(whour);
if (wam_pm=="pm"){
if(whour1<=11){
whour1+=12;
}
}else{
if (whour1==12){
whour1 = 0;
}
}
trace(whour1);
return whour1;
}


Here is the second function:

function setWakeup(){
loginInfo = new XML("<doc><SendNotificationMessage></SendNotificationMessage></doc>");
loginInfo.sendAndLoad("myScript.pl", wakeXML);
trace(wakeXML);
gotoAndPlay("wait", 1);
waitMessage="Verifying your message, please hold ...";
}

jaybee
04-28-2003, 10:31 AM
not too difficult to combine them but have you set up the xml objects correctly, with load handlers? ie, does it work ? end result could be something like this:


function dateCleanAndSend(){
if (wam_pm=="pm"){
if(whour<=11) whour+=12;
}else{
if (whour==12) whour = 0;
}

loginInfo = new XML("<doc><SendNotificationMessage></SendNotificationMessage></doc>");
wakeXML = new XML();
wakeXML.ignoreWhite = true;
wakeXML.onLoad = function() {
// what do you want to happen when the xml is loaded?
};
loginInfo.sendAndLoad("myScript.pl", wakeXML);
gotoAndPlay("wait", 1);
waitMessage="Verifying your message, please hold ...";
}


note that you prolly don't need to use Number(), put it back in if you do....and add some code in the wakeXML.onLoad function to deal with the xml that is returned from your perl script.

bladeMX
04-29-2003, 07:06 PM
Thanks for your help Jaybee!

I went ahead and expanded on your code, and got something going. I still need to work out some details, but from what I can see now, the code looks good.