ActionScript2 Class

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

ActionScript2 Class

Post 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?
Post Reply