Load image total in external class

Hi there,

I’m a bit of a class newbie so be nice…

I am trying to get an array of images from a php file using LoadVars… I have an external as file called ImageTotal.as with the following code:

class ImageTotal {
    
    private var galleryVars;
    private var galleryArray:Array;
    private var imageTotal:Number;
    
    function ImageTotal(){}
    
    
    public function getTotal(){
        galleryVars = new LoadVars();
        galleryVars.onLoad = function(){
            galleryArray = galleryVars.filelist.split("|");
            galleryArray.pop();
            imageTotal = galleryArray.length;
            trace(imageTotal);
            
            
        }
        galleryVars.load("http://localhost/michael_price/update2/images/filmography/files.php");
    }
    
}

I am then running the following code from a separate movie:

import ImageTotal;

var iTotal:ImageTotal = new ImageTotal();
iTotal.getTotal();

However when I trace imageTotal I get undefined… now I know the php file works because I have tested it loading the galleryVars from the main timeline, but I really want to have it all in a separate class and can’t seem to get it to work.

Any ideas?

Thanks,

Bob