Coverting a (php)variable to numeric value in flash


I got this script from axis100 yesterday
// Open directory
$myDirectory = opendir(“path o\directory”);
// get each entry
while($entryName = readdir($myDirectory))
$dirArray[] = $entryName;
// close directory
// count elements in array
$indexCount = (count($dirArray));
// return the amount of files in the directory to flash with :
print “&myVariable=” . urlencode($indexCount+1);

(…and this is the flash part)

dirCount = new LoadVars(); dirCount.load(“http://path_to/listdirectory.php”);
dirCount.onLoad = function(success) {
if (success) {
_root.myVariable = this.myVariable;
} else {
trace(“directory listing error”);

its working fine long as I onli display the number, but my problem is that I need myVariable to be a numeric value in flash. I’ve tried
Number(myVariable), but when I trace it it returns: NAN
Does anybody has an idea why and how to convert it.

use parseInt(). here’s an example:

var myString = “33”;
var myNumber = parseInt(myString);

It’s just what i needed!
thanks, it works just fine.