XML based banner + dynamically created textfields + loops

Hello everybody!
I have recently started a task, and have some difficulties with it right now. I literally got stuck with that! I’d appreciate if someone could look at my problem “with fresh eyes” and advise me on possible solution(s).

I need to make XML-based banner. XML file itself will contain from 5 up to 30 tags (childNodes). It is supposed that this XML file gonna be edited by the client, so the client can add/remove or change data (that is, quantity of ChildNodes).

I need to take the data out of XML and then display them (animated!) in a flash banner, five at a time. Firts five, then second five, and so on. If, for example, there will be 13 tags, that should be first 5, then second 5 and then the last 3. After that everything should start from the beginning (first five).

XML-file is like this:

<?xml version = “1.0” encoding = “Windows-1251” ?>
<tariffs>
<tariff where = “Kaliningrad, Russia” howmuch = “1,5$” />
<tariff where = “Khorezm” howmuch = “0,2$” />
<tariff where = “Moscow” howmuch = “2,5$” />
<tariff where = “Kiev” howmuch = “0,4$” />
<tariff where = “Bobruysk” howmuch = “0,3$” />
<tariff where = “Chirchik” howmuch = “0,3$” />
<tariff where = “Tashkent, mobiles” howmuch = “0,3$” />
<tariff where = “Magadan” howmuch = “0,3$” />
<tariff where = “Almaty” howmuch = “0,3$” />
</tariffs>

actionscript is as following:

[COLOR=#990000]first frame: [/COLOR]

var indhold:XML = new XML();
indhold.ignoreWhite = true;
var destinations:Array = new Array();
var prices:Array = new Array();
var Format:TextFormat = new TextFormat();

Format.size = 11;
Format.color = 0xffffff;
Format.font = “tahoma”;
Format.bold = true;

indhold.load(“tarifi.xml”);

[COLOR=#cc0000]second frame:[/COLOR]

indhold.onLoad = function(success) {
if (success) {
var tarifiki:Array = this.firstChild.childNodes;
for (i=0; i<tarifiki.length; i++) {
destinations.push(tarifiki*.attributes.where);
prices.push(tarifiki*.attributes.howmuch);
}
} else {
trace(“error loading xml”);
}
};

[COLOR=#cc0000]third frame:

[COLOR=#000000]import mx.transitions.;
import flash.filters.
;

for (i=0; i<5; i++) {
_root.createTextField(“gde”+i, i+3, 16, 20i+30, 200, 30);
var ds:DropShadowFilter = new DropShadowFilter(5, 45, 0x000000, 100, 1, 3, 0, 1, false, false, false); //this filter is added just for the sake of alpha tween
// which did not work without that!
_root[“gde”+i].filters = [ds];
_root[“gde”+i].text = destinations
;
_root[“gde”+i].setTextFormat(Format);
var nashTween = new Tween(_root[“gde”+i], “_alpha”, Strong.easeIn, 0, 100, 2, true);
}

for (i=0; i<5; i++) {
_root.createTextField(“pochem”+i, i+33, 180, 20i+30, 200, 30);
var ds:DropShadowFilter = new DropShadowFilter(5, 45, 0x000000, 100, 1, 3, 0, 1, false, false, false);
_root[“pochem”+i].filters = [ds];
_root[“pochem”+i].text = prices
;
_root[“pochem”+i].setTextFormat(Format);
var nashTween = new Tween(_root[“pochem”+i], “_alpha”, Strong.easeIn, 0, 100, 2, true);
}
var maskClip:MovieClip = _root.createEmptyMovieClip(“opa”, 200);
with (maskClip) {

// Draw a mask
        beginFill(0x667686, 100);
        moveTo(0, 30);
        lineTo(Stage.width, 30);
        lineTo(Stage.width, Stage.height);
        lineTo(0, Stage.height);
        lineTo(0, 30);
        endFill();
    }
    
    
    var myTransitionManager:TransitionManager = new TransitionManager(opa);
    myTransitionManager.startTransition({type:Wipe, direction:Transition.OUT, duration:3, easing:None.easeNone, startPoint:9});
    var myListener:Object = new Object();
    myListener.allTransitionsOutDone = function(eventObj:Object) {
    trace("allTransitionsOutDone event occurred."); // added just to catch the moment when transition is finished, though I am not sure that this is right way to do it.
                                                                          // i tried to begin second-five-items-display here.. and it did not work.
    };
    myTransitionManager.addEventListener("allTransitionsOutDone", myListener);

stop(); //added just to be able to see that things look like they should.

and now I got stuck…
how to get the next five nodes to be shown?
i did try to do that on allTransitionsOutDone event, removing old textfields and creating new with new .text values, but with no success… :frowning:
another thing that i can’t find out is how to check for the quantity of 5-items-sets already shown and how to calculate for the next 5 (or less) to be shown?
and finally, how to arrange that at the end the entire “show” begin again?

please point me out the directions! =)
[/COLOR][/COLOR]