stevenS.
03-20-2008, 04:58 PM
Hey there, so I'm creating this voting thing in Flash that would send the info to a PHP file and then onto a database. I'm not working on the PHP though, just the flash side. The problem is that he's saying he isn't able to receive the info still. So my question is what kind of PHP coding should he use to receive it from my Flash file. Here's the actionscript:
var myLv:LoadVars = new LoadVars();
var resultArray:Array = ["empty"];
var totalPressed:Number = 0;
stop();
for (i=1;i<13;i++) {
this["box"+i].id = i;
this["box"+i].onRelease = function() {
judgeAmount(this,this.id);
};
resultArray.push(0);
};
function judgeAmount(box:MovieClip,idNo:Number):Void {
if (box._currentframe == 2) {
totalPressed--;
resultArray[idNo] = 0;
this["box"+idNo].voting = 0;
box.gotoAndStop(1);
}
else {
if (totalPressed < 6) {
box.gotoAndStop(2);
resultArray[idNo] = 1;
this["box"+idNo].voting = 1;
totalPressed++;
}
};
if (totalPressed == 6)
{
submit._alpha = 100;
submit.enabled = true;
}
else
{
submit._alpha = 0
submit.enabled = false;
}
}
submit.onRelease = function():Void
{
sendVars();
_root.gotoAndStop(2);
}
myLv.onLoad = function():Void
{
trace("data sent");
}
function sendVars():Void
{
var len:Number = resultArray.length;
for (i=1;i<len;i++)
{
myLv["var"+i]=resultArray[i];
}
myLv.sendAndLoad("myphp.php",myLv,"POST");
}
To clarify a little more, does he need to be writing code that would receive information for every movieclip of the boxes people vote for, or for the array that the Flash file is sending out? And what might that code look like so I can advise him on it? I'm guessing it would be a sort of $_POST kind of thing...
Any help would be greatly appreciated! Thanks so much!
var myLv:LoadVars = new LoadVars();
var resultArray:Array = ["empty"];
var totalPressed:Number = 0;
stop();
for (i=1;i<13;i++) {
this["box"+i].id = i;
this["box"+i].onRelease = function() {
judgeAmount(this,this.id);
};
resultArray.push(0);
};
function judgeAmount(box:MovieClip,idNo:Number):Void {
if (box._currentframe == 2) {
totalPressed--;
resultArray[idNo] = 0;
this["box"+idNo].voting = 0;
box.gotoAndStop(1);
}
else {
if (totalPressed < 6) {
box.gotoAndStop(2);
resultArray[idNo] = 1;
this["box"+idNo].voting = 1;
totalPressed++;
}
};
if (totalPressed == 6)
{
submit._alpha = 100;
submit.enabled = true;
}
else
{
submit._alpha = 0
submit.enabled = false;
}
}
submit.onRelease = function():Void
{
sendVars();
_root.gotoAndStop(2);
}
myLv.onLoad = function():Void
{
trace("data sent");
}
function sendVars():Void
{
var len:Number = resultArray.length;
for (i=1;i<len;i++)
{
myLv["var"+i]=resultArray[i];
}
myLv.sendAndLoad("myphp.php",myLv,"POST");
}
To clarify a little more, does he need to be writing code that would receive information for every movieclip of the boxes people vote for, or for the array that the Flash file is sending out? And what might that code look like so I can advise him on it? I'm guessing it would be a sort of $_POST kind of thing...
Any help would be greatly appreciated! Thanks so much!