[AS2] attach mc's, show 6 of array.length

Hi all,

I am attaching mc’s from the library using xml to populate the textfields. What I am wanting to do is show the first six mc’s, then after say 10 seconds show the next six. With a text field displaying “1 of 3”, after 10 seconds, “2 of 3” …etc.
A bit similar to image galleries really (sorry if I haven’t explained this very well).

Anyhoo, heres what I have so far, it loads the mc’s one after each other:


import mx.transitions.Tween;
import mx.transitions.easing.*;

//Time in seconds its displayed
var displayTime = 10;

//Spacing between items
var event_spacing = 56;

var eventArray:Array = [];
GenerateEventListing = function (eventContent_xml, target_mc) {
    var events = eventContent_xml.firstChild.childNodes;
    var counter = 0;
    function doTween(target_mc, index) {
        var event_mc = target_mc.attachMovie("event", "event" + index, index);
        event_mc.node = events[index];
        event_mc._y = index * event_spacing;
        var pushed:Number = eventArray.push(event_mc);
        event_mc.txt_mc.title_txt.text = events[index].childNodes[1].childNodes[0].nodeValue;
        event_mc.txt_mc.info_txt.text = events[index].childNodes[2].childNodes[0].nodeValue;
        var myTween = new Tween(event_mc, "_x", Strong.easeOut, 200, 0, .4, true);
        myTween.onMotionFinished = function() {
            if (++index != events.length){
                doTween(target_mc, index);
            }
        };
    }
    doTween(target_mc, counter);
};

// Timer event
countDown = function () {
     displayTime--;
     if (displayTime == 0) {
        clearInterval(timer);
        for (var i:Number = 0; i <= eventArray.length; i++) {
            var myTweenOut = new Tween(eventArray*, "_x", Strong.easeOut,0, -400, .4, true);
        }
     }
};
timer = setInterval(countDown, 1000);

// Load XML
var eventContent_xml = new XML();
eventContent_xml.ignoreWhite = true;
eventContent_xml.onLoad = function(success){
    if (success){
        GenerateEventListing(this, playlist_mc);
    }else trace("Error loading XML file");
}
eventContent_xml.load("../xml/eventContent.xml");

Thanks for any help on this!

anyone any idea on this please?

post up your files so I dont have to replicate your program…xml and images too

here maybe you can get an idea from this

Thanks for the files, looks like it will help me alot!!

Cheers again

My xml is created from an access database using asp. the xml looks like this:


<events>
<eventID>
 <headline>event 1</headline>
 <story>new event UPDATE</story>
 <date>10/06/2008</date>
</eventID>
<eventID>
 <headline>event 2</headline>
 <story>asdfasdf</story>
 <date>10/06/2008</date>
</eventID>
<eventID>
 <headline>event 3</headline>
 <story>wa da fa!</story>
 <date>11/06/2008</date>
</eventID>
<eventID>
 <headline>event 4</headline>
 <story>wa da fa!</story>
 <date>11/06/2008</date>
</eventID>
<eventID>
 <headline>event 5</headline>
 <story>wa da fa!</story>
 <date>11/06/2008</date>
</eventID>
<eventID>
 <headline>event 6</headline>
 <story>wa da fa!</story>
 <date>11/06/2008</date>
</eventID>
<eventID>
 <headline>event 7</headline>
 <story>wa da fa!</story>
 <date>11/06/2008</date>
</eventID>
</events>

What I was trying to achieve was that the flash shows the first 6 of the events, then the remaining event after 5 seconds.

was trying to re-work your example, but cant get it working