Page 1 of 1

ActionScript2 Class

Posted: Sun May 30, 2004 1:05 pm
by Gen-ik
This one's for those of you who work with ActionScript...

Is it possible to use onLoad events and setInterval within a Class?
There's a small example below of what I'm trying to do but the onLoad event doesn't fire when the XML file has loaded.

It's not a problem with paths/filenames/directories etc because outside of a Class the example works fine. It seems to me that onLoad and setInterval can't be used inside of a Class... unless I'm doing something stupid of course :)

Code: Select all

class JuiceMX
{
        var juicePacks:Array;
        
        function LoadJuicePack(packId, packURL)
        {
                juicePacksїpackId] = new Object();
                
                juicePacksїpackId].xml = new XML();
                juicePacksїpackId].xml.ignoreWhite = true;
                juicePacksїpackId].xml.onLoad = JuicePackLoaded;
                juicePacksїpackId].xml.load(packURL);
                
                trace("Loading " + packURL);
        }
        
        function JuicePackLoaded()
        {
                trace("Loaded");
        }
}
Any ideas?