AMparanoia
10-29-2003, 09:33 PM
Hi there,
Ok, i just started playing around with PHP combined with flash and now i'm trying to make a vote system using an example script. I know it should be something simple, but i just can't figure out what's wrong.
I've got the vote system working already. You can see the result >>HERE<< (http://www.amparanoia.nl/vote_system/).
But now i'm trying to implement it into my site by importing the *.swf into flash (loadmovie). So the only thing i've to do is to change the paths so everything has the right target. But i'm probably forgetting something
You can download the php files >>HERE<< (http://www.amparanoia.nl/php/php_files.rar)
Now in flash this is the script which is calling all the functions:
onClipEvent (load) {
lsig = 1;
function laden() {
loadVariables("frage.txt?z="+new Date().getTime(), "_parent");
loadVariables("themen.txt?z="+new Date().getTime(), "_parent");
loadVariables("stimm.txt?z="+new Date().getTime(), "_parent");
}
laden();
}
onClipEvent (data) {
_root.frage = frage;
// Themen
themen = new Array();
themen = thema.split(",");
gThema = themen.length;
// Zahlen
gruppen = new Array();
gruppen = stimmen.split(",");
gAnzahl = gruppen.length;
_root.max = gruppen.length-1;
if (_root.max >= 11) {
_root.hoch._visible = 1;
_root.runter._visible = 1;
}
// TotalStimmen
if (lsig==1) {
for (i=0; i<_root.max; i++) {
_root.totalStimmen += Number(gruppen[i]);
lsig = 0;
}
}
// Variablen für die Gruppen
for (j=0; j<_root.max; j++) {
_root["gruppe"+j] = Number(gruppen[j]);
}
// Anzeige aufbauen/Prozentberechnen/Themen
for (k=0; k<_root.max; k++) {
duplicateMovieClip("_root.obj", "obj"+k, k);
_root["obj"+k]._x = 2;
_root["obj"+k]._y = _root["obj"+k]._height*k+80;
_root.hoehe = _root["obj"+k]._height*k;
_root.hsig = 1;
_root["obj"+k].g = _root["gruppe"+k];
_root["prozent"+k] = int((Number(gruppen[k])/_root.totalStimmen)*1000)/10 +"%";
_root["obj"+k].wert = _root["prozent"+k];
_root["obj"+k].w = parseInt(_root["obj"+k].wert);
_root.totalProzent += parseFloat(_root["prozent"+k]);
_root.totalProzent = Math.round(_root.totalProzent);
if (_root.totalProzent != 100) {
_root.totalProzent = 100;
}
_root["obj"+k].t = themen[k];
}
_root.hoehe = _root.hoehe + _root.obj0._height +60;
}
I changed the target of frage.txt, stimm.txt and themen.txt to _parent so it knows the files are in the same folder. For some reason the question (which is frage.txt) does work, but stimm.txt and themen.txt (which are for the multiple-choice answers) don't? And they are all in the same folder.
This should be simple IMO, but i must have forgotten (or just don't understand it at all) something and i hope somebody can help me out!
Thanx in advance!
Ok, i just started playing around with PHP combined with flash and now i'm trying to make a vote system using an example script. I know it should be something simple, but i just can't figure out what's wrong.
I've got the vote system working already. You can see the result >>HERE<< (http://www.amparanoia.nl/vote_system/).
But now i'm trying to implement it into my site by importing the *.swf into flash (loadmovie). So the only thing i've to do is to change the paths so everything has the right target. But i'm probably forgetting something
You can download the php files >>HERE<< (http://www.amparanoia.nl/php/php_files.rar)
Now in flash this is the script which is calling all the functions:
onClipEvent (load) {
lsig = 1;
function laden() {
loadVariables("frage.txt?z="+new Date().getTime(), "_parent");
loadVariables("themen.txt?z="+new Date().getTime(), "_parent");
loadVariables("stimm.txt?z="+new Date().getTime(), "_parent");
}
laden();
}
onClipEvent (data) {
_root.frage = frage;
// Themen
themen = new Array();
themen = thema.split(",");
gThema = themen.length;
// Zahlen
gruppen = new Array();
gruppen = stimmen.split(",");
gAnzahl = gruppen.length;
_root.max = gruppen.length-1;
if (_root.max >= 11) {
_root.hoch._visible = 1;
_root.runter._visible = 1;
}
// TotalStimmen
if (lsig==1) {
for (i=0; i<_root.max; i++) {
_root.totalStimmen += Number(gruppen[i]);
lsig = 0;
}
}
// Variablen für die Gruppen
for (j=0; j<_root.max; j++) {
_root["gruppe"+j] = Number(gruppen[j]);
}
// Anzeige aufbauen/Prozentberechnen/Themen
for (k=0; k<_root.max; k++) {
duplicateMovieClip("_root.obj", "obj"+k, k);
_root["obj"+k]._x = 2;
_root["obj"+k]._y = _root["obj"+k]._height*k+80;
_root.hoehe = _root["obj"+k]._height*k;
_root.hsig = 1;
_root["obj"+k].g = _root["gruppe"+k];
_root["prozent"+k] = int((Number(gruppen[k])/_root.totalStimmen)*1000)/10 +"%";
_root["obj"+k].wert = _root["prozent"+k];
_root["obj"+k].w = parseInt(_root["obj"+k].wert);
_root.totalProzent += parseFloat(_root["prozent"+k]);
_root.totalProzent = Math.round(_root.totalProzent);
if (_root.totalProzent != 100) {
_root.totalProzent = 100;
}
_root["obj"+k].t = themen[k];
}
_root.hoehe = _root.hoehe + _root.obj0._height +60;
}
I changed the target of frage.txt, stimm.txt and themen.txt to _parent so it knows the files are in the same folder. For some reason the question (which is frage.txt) does work, but stimm.txt and themen.txt (which are for the multiple-choice answers) don't? And they are all in the same folder.
This should be simple IMO, but i must have forgotten (or just don't understand it at all) something and i hope somebody can help me out!
Thanx in advance!