Controlling dynamic MCs with XML data

Hi all,

I’m pretty new to AS3 but have a project with a very tight turnaround here, having been lumbered with it after a guy from work got taken ill. The basic idea is a visualisation of an XML feed, using the data pulled in to control the behaviour of movieclips. So far I have this;

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, loadXML);

xmlLoader.load(new URLRequest("xml/tasks.xml"));

function loadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    parseTasks(xmlData);
}

function parseTasks(tasks:XML):void {
    var taskList:XMLList = tasks.item;
    
    for each (var task:XML in taskList) {
        /*trace(task);*/
        var tlength:Number = task.length.text().substring(0,1);
        var tpriority:String = task.priority.text();
        trace(tlength + " & " + tpriority);
                
        var newParticle:Particle = new Particle();
        newParticle.x = 400;
        newParticle.y = 300;
        newParticle.scaleX = newParticle.scaleY  = tlength;
        
        this.addChild(newParticle);
        
        addEventListener(Event.ENTER_FRAME, particleMover(newParticle, 1, 1));
    }
}

function particleMover(particle:MovieClip, xVel:Number, yVel:Number) {
    particle.x += xVel;
    particle.y += yVel;
}

Hopefully it isnt too hard to see what I’m trying to do. The above code plops 5 movieclips on the stage, their size dictated by the ‘tlength’ value, and the next step is to get them moving. Ultimately I’d like these MCs to shift out from the centre of the screen and vary in size and distance depending on the data that is applied to them, but running the current code throws this error;

TypeError: Error #2007: Parameter listener must be non-null.
Any help or suggestions of a better way to do this would be GREATLY appreciated, I’m totally stumped.