PDA

View Full Version : Flash 8 component problem


nyghtrunner
07-06-2007, 06:19 PM
Hey all,

This one really has me stumped... I've set up a really simple flash file that has a couple of input fields, a submit button, and som server side stuff (PHP and SQL). I also used a comboBox to display various pieces of the dbase both before and after you enter text and submit it. Everything's working like a charm, with the exception of the comboBox.

I tried to set it up so that it would kill everything in the box when you hit the submit to avoid redundancies. I used just a basic function to do this:


theList.removeAll();


Here's what I don't understand (I'll post more code in a sec...): The code works like a charm locally, meaning that the box clears and then updates with info from the dbase. It can't write to it, because it's local, and not actually on the server, but that's ok. I know that part works. When I upload it to the server, and run it through a browser, that line seems to stop working. The comboBox still populates with info from the server, and updates when I submit something and write it to the server, but the box no longer clears. It just adds everything into the comboBox below the rest of the info, and so I have everything from the dbase posting 2x, with the exception of the most recent submission, which finds a home smack dab in the middle of the comboBox...

Everything I have tried has exactly the same effect, so I'm starting to wonder if I'm totally missing something. Anyways, here's the rest of the call/populate scripts...


xmlCall();

function xmlCall() {
var theXML:XML = new XML();
theXML.ignoreWhite = true;
theXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for(i=0;i<nodes.length;i++) {
theList.addItem(nodes[i].firstChild.nodeValue,1);
}
}
theXML.load("myPage.php");
}
/////That just calls the xml and populates the og list

/////This is then what sends and loads, and is supposed to clear out the
/////comBox, but only sends and loads with no clearing
tester.buttonHolder_mc.s1_mc.onRelease = function() {

var input1 = tester.textHolder_mc.nameInput.text;
var input2 = tester.textHolder_mc.postInput.text;

tester.textHolder_mc.nameInput.text = "type name here";
tester.textHolder_mc.nameInput.setTextFormat(forma tInput_fmt);
tester.textHolder_mc.postInput.text = "type submission here";
tester.textHolder_mc.postInput.setTextFormat(forma tInput_fmt);

theList.removeAll(); //no matter where i put this, in another called function or otherwise, the local recognizes it, and the one on the server doesn't...

var poster = new LoadVars();

poster.nameText = input1;
poster.postText = input2;

poster.onLoad = function() {
tester.textHolder_mc.postOutput.text = poster.soapOut;
tester.textHolder_mc.postOutput.setTextFormat(form atOutput_fmt);
cleaner();
}

poster.sendAndLoad("tester.php", poster, "POST");
//for debugging purposes, you can use the "send" function in an _blank to act as a trace here.
}

function cleaner() {
xmlCall();
}


If anyone sees anything glaringly wrong with this, I'd love to hear back from you, because I'm at a complete loss..... :eek:

Stephen

LOLFlash
07-06-2007, 06:50 PM
I don't see your comboBox instace, and could you split poster in two LoadVars: one sendPoster another recievePoster.

nyghtrunner
07-06-2007, 07:33 PM
The comboBox instance(only reference to it) is in the function xmlCall();. As for splitting the poster in twain, I am going to give that a try now.

The comboBox identifier is "theList".

nyghtrunner
07-06-2007, 07:37 PM
Oh yeah, the other reference to the comboBox is in the "tester.buttonHolder_mc.s1_mc.onRelease = function() {" function.

nyghtrunner
07-06-2007, 07:43 PM
Ok, don't know why it works this way, but here it goes, for all who would like to look at it.


tester.buttonHolder_mc.s1_mc.onRelease = function() {

var input1 = tester.textHolder_mc.nameInput.text;
var input2 = tester.textHolder_mc.postInput.text;

tester.textHolder_mc.nameInput.text = "type name here";
tester.textHolder_mc.nameInput.setTextFormat(forma tInput_fmt);
tester.textHolder_mc.postInput.text = "type submission here";
tester.textHolder_mc.postInput.setTextFormat(forma tInput_fmt);

var sendPoster = new LoadVars();

sendPoster.nameText = input1;
sendPoster.postText = input2;

var recievePoster = new LoadVars();

recievePoster.onLoad = function() {
tester.textHolder_mc.postOutput.text = recievePoster.soapOut;
tester.textHolder_mc.postOutput.setTextFormat(form atOutput_fmt);
cleaner();
}

sendPoster.sendAndLoad("tester.php", recievePoster, "POST");
//for debugging purposes, you can use the "send" function in an _blank to act as a trace here.
}

function cleaner() {
tester.theList.removeAll();
xmlCall();
}


I split it into 2 vars, and changed the position of the "removeAll()" back into the "cleaner()" function, and now it's posting, reading, and clearing. :)

Thanks for the help! ;)

S.