-
LoadVars issue
Hi, I am using Flash MX (7) and have an issue (with my understanding, let alone the coding), where I am loading external data via asp and SQL.
My Flash movie is based around a series of radio buttons (frame 1), that allow the user to select the external data they wish to receive.
After selection, I am trying to play a 'loading' animation (frames "loader"), whilst the requested data is sent and retrieved by Flash. Upon completion of loading, I then want the movie to stop at frame "end", where I have a listBox component, which will read the data in.
So far, my code successfully completes the majority of this, it just wil not go and display the result after data is loaded. If I do not use a 'loading' animation and just sendAndLoad the data and then pass into the listBox, everything works.
I am trying to look at using the loadVars.loaded, but as yet I cannot get everything to work. I also have a feeling that I will need to store the received data, before passing into the list Box.
Any ideas, as ever, are greatly appreciated,
Regards,
motorpilot
Code:
replyData_lv = new LoadVars();
replyData_lv.onLoad = function (success) {
if (success) {
trace("SUCCESS");
// organise data for listBox
for (i=0; i<this.numOrg; i++){
myListBox.addItem(eval("this.name"+i), eval("this.id"+i));
}
_root.gotoAndStop("end");
} else {
trace("ERROR");
}
}
// Button to activate retrieval of data
this.mc_button1.onRelease = function() {
sendData_lv = new LoadVars();
sendData_lv.searchMode = "search1";
sendData_lv.sendAndLoad ("http://www.mysite.com/process5.asp", replyData_lv, "POST");
_root.gotoAndPlay("loader");
}
-
Ok, so I've posted an issue and then gone back to the file and realised that my listBox component only existed in frame "end", therefore, how the heck it previously was picking up information I do not know.
Anyway, now that an instance of my listBox exists when the onLoad command is fired, everything is working as expected !
Sometimes you just look at completely the wring thing !!
Hope my code might help anyone else trying to achieve this ?
motorpilot