PDA

View Full Version : [php + flash] php variables into flash



Dragonknight
April 2nd, 2008, 02:12 AM
i'm trying to get php to read how many .swf files are in a folder called "horns"


<?

$total= count(glob('./horns/'));
$total=$total+1;
// loads "hornNum" variable and ignores Server Automated Ads
echo "hornNum=" . $total . "&ignore=advert";

?>

but when i do try it, it some how becomes a ten or something

2 would end up to being 20

heres the actionscript code that leaves me thinking that

on (release) {
_root.pethorns++
var i:Number = _root.pethorns;
if (_root.pethorns>=_root.hornNum+1) {
_root.pethorns = 1;
_root.loadhorns("1.swf")
} else {
_root.loadhorns(i+".swf")
}
}

and heres the code on frame 1 of my flash file

function loadhorns(obj) {
_root.defaultpet.defaulthead.defaulthorn.loadMovie ("horns/"+obj);
}
function petskin(obj) {
var skincolor:Color = new Color(obj);
skincolor.setRGB(_root.colorskin);
}
_root.colorskin = "0x006600";
loadVariablesNum("itemcounter.php?nocache="+random(65000), 0, "POST");
_root.pethorns = 1;
_root.pose = 1;

and heres the actual flash file right here
http://gaiahost.freeweb7.com/cap/test.swf

what i tried to do was make php count the files in the "horns" folder and pass it to flash as a variable

seems i did something wrong somewhere x.x;;

borrob
April 2nd, 2008, 04:05 AM
I tried this piece of code ( with a dir on my host ) and it always gives me a zero:
$total= count(glob('./horns/'));
you should probaply do:

count( glob('./horns/horn*.swf') ); // if your files start with horn

Dragonknight
April 2nd, 2008, 07:20 PM
the php seems to be working correctly

but the flash isn't

see here
http://gaiahost.freeweb7.com/cap/test.swf

horn changer variable is not supposed to go over HornNumber

HornNumber is the number Php counted from /horns/ folder

but for some reason the horn changer variable can go up to 20 before resetting to 1

which is supposed to reset when the horn changer variable is over HornNumber

Dragonknight
April 3rd, 2008, 02:22 PM
could somebody please help?

Dragonknight
April 5th, 2008, 11:40 AM
bump

Dragonknight
April 6th, 2008, 11:19 AM
guess nobody is going to help? :h:

p.s.

my server is usually down or slowed down during the weekends