honorstrike
12-14-2005, 01:07 AM
Hey guys, my first post here, but I've been coming here for years to reference material and check out various methods of scripting, I thought you might be able to help me :).
Ok, the basic function of this is to count the jpeg files in a directory and return the number to flash. I'm using mx 2k4 if that helps at all, AS 2.0. I'm using a combination of PHP and actionscript as well. Please let me know if you see any flaws, as it is NOT working, scripts are posted below...
Real quick, when try to do it, it GETS the variable (its a count number), but DOES NOT transfer it to the proper internal variable (_root.weddingCount).
Here's a screenshot of the debugger, see if you guys can help out...
http://www.promorphus.com/asorg/flashdebugger%20pic.jpg
I tried attaching this as well, dunno if it worked...
php file (filecounter.php)
<?php
$weddingDir = "http://www.aleamoore.com/images/wedding/";
$weddingDir = "../images/wedding/";
$weddingCount = 0;
if (is_dir($weddingDir) && $directoryPointer = @opendir($weddingDir))
{
while ($oneFile = readdir($directoryPointer))
{
$thisFileType = strtolower(substr(strrchr($oneFile, "."), 1));
if ($thisFileType == "jpg" || $thisFileType == "jpeg")
{
$weddingCount++;
}
}
}
else
{
$weddingCount = 200;
}
echo $weddingCount;
?>
and here's the actionscript to get the variable from the file....
numberVars = new LoadVars();
numberVars.load("http://www.aleamoore.com/cgi/filecounter.php");
numberVars.onLoad = function()
{
_root.weddingCount = numberVars.weddingCount;
}
Ok, the basic function of this is to count the jpeg files in a directory and return the number to flash. I'm using mx 2k4 if that helps at all, AS 2.0. I'm using a combination of PHP and actionscript as well. Please let me know if you see any flaws, as it is NOT working, scripts are posted below...
Real quick, when try to do it, it GETS the variable (its a count number), but DOES NOT transfer it to the proper internal variable (_root.weddingCount).
Here's a screenshot of the debugger, see if you guys can help out...
http://www.promorphus.com/asorg/flashdebugger%20pic.jpg
I tried attaching this as well, dunno if it worked...
php file (filecounter.php)
<?php
$weddingDir = "http://www.aleamoore.com/images/wedding/";
$weddingDir = "../images/wedding/";
$weddingCount = 0;
if (is_dir($weddingDir) && $directoryPointer = @opendir($weddingDir))
{
while ($oneFile = readdir($directoryPointer))
{
$thisFileType = strtolower(substr(strrchr($oneFile, "."), 1));
if ($thisFileType == "jpg" || $thisFileType == "jpeg")
{
$weddingCount++;
}
}
}
else
{
$weddingCount = 200;
}
echo $weddingCount;
?>
and here's the actionscript to get the variable from the file....
numberVars = new LoadVars();
numberVars.load("http://www.aleamoore.com/cgi/filecounter.php");
numberVars.onLoad = function()
{
_root.weddingCount = numberVars.weddingCount;
}