Text Scroller/Ticker (AS/XML)

This is a nice xml based actionscript driven Flash Text Scroller/Ticker.

I’m wondering if anyone sees a way to make it ‘shuffle’ the “headlines”?

Actionsctipt:


var width = 744;
var height = 22;
var framerate = 30;
var margin_top = 1;
var margin_left = 5;
var margin_right = 5;
var margin_bottom = 1;
var scroll_speed = 3;
var delay_interval = 0;
var texts_count = 0;
objArray = new Array();
fl_loaded = false;
function isLoaded(success)
{
   
    var fChildNodes = this.firstChild.childNodes;
    i = 0;
    
    while (i++, i < fChildNodes.length)
    {
        var node_ = fChildNodes*;
        obj_ = new Object();
        obj_.htmlText = "<a href=\"" + node_.attributes.link + "\" target=\"" + node_.attributes["target-frame"] + "\"><font face=\"" + node_.attributes["font-face"] + "\" size=\"" + node_.attributes["font-size"] + "\">" + node_.firstChild.nodeValue + "</font></a>";
        obj_.higlight_color = node_.attributes["higlight-color"];
        obj_.color = node_.attributes["font-color"];
        objArray.push(obj_);
    } // end while
    texts_count = fChildNodes.length;
    fl_loaded = true;
} // End of the function
xmlDoc = new XML();
xmlDoc.ignoreWhite = true;
xmlDoc.onLoad = isLoaded;
xmlDoc.load("data.xml");
var sleep_count = 0;
var fl_sleep = false;
var fl_last_hided = false;
TP = TextField.prototype;
TP.hitTest = MovieClip.prototype.hitTest;
ASSetPropFlags(TP, "hitTest", 1);
if (_global.TextFlair == null)
{
    _global.TextFlair = new Object();
} // end if
o = _global.TextFlair.ButtonEventFlair = {};
o.snapOn = function (_txt)
{
    var flair = _txt.__buttonEventFlair = {};
    flair._txt = _txt;
    flair.__mouseDown = flair.__press = flair.__over = false;
    flair.onMouseMove = this._onMouseMove;
    Mouse.addListener(flair);
    flair.onMouseMove();
};
o.snapOff = function (_txt)
{
    Mouse.removeListener(_txt.__buttonEventFlair);
};
o._onMouseMove = function ()
{
    if (!this._txt.hitTest(_level0._xmouse, _level0._ymouse, true))
    {
        if (this.__over)
        {
            this.__over = false;
            if (this.__mouseDown)
            {
                if (this.__press)
                {
                    this._txt.onDragOut();
                } // end if
            }
            else
            {
                this._txt.onRollOut();
            } // end if
        } // end else if
    }
    else if (!this.__over)
    {
        this.__over = true;
        if (this.__mouseDown)
        {
            if (this.__press)
            {
                this._txt.onDragOver();
            } // end if
        }
        else
        {
            this._txt.onRollOver();
        } // end else if
    } // end else if
};
counter = 0;
depth = 0;
createClip = function (in_mc)
{
    name = "texts" + depth;
    var ref_ = createEmptyMovieClip(name, depth);
    ++depth;
    if (depth > 1000)
    {
        depth = 0;
    } // end if
    ref_.color = objArray[counter].color;
    ref_.higlight_color = objArray[counter].higlight_color;
    ref_.createTextField("text", 1, 0, margin_top, 0, in_mc.height - margin_top - margin_bottom);
    with (ref_.text)
    {
        border = false;
        selectable = false;
        html = true;
        htmlText = objArray[counter].htmlText;
        tf_.text = objArray[counter].htmlText;
        fontColor = objArray[counter].color;
        autoSize = true;
        multiline = true;
    } // End of with
    ref_.text.onRollOver = function ()
    {
        this.textColor = this._parent.higlight_color;
    };
    ref_.text.onRollOut = function ()
    {
        this.textColor = this._parent.color;
    };
    TextFlair.ButtonEventFlair.snapOn(ref_.text);
    ref_.onEnterFrame = function ()
    {
        if (!fl_sleep)
        {
            this._x = this._x - this._parent.scroll_speed;
            prom = this._x - this._parent.margin_left;
            if (this._parent.scroll_speed * -1 / 2 < prom)
            {
                if (this._parent.scroll_speed / 2 >= prom)
                {
                    this._parent.fl_sleep = true;
                } // end if
            } // end if
            if (this._x + this.text._width < this._parent.width - 3)
            {
                if (!this.ready)
                {
                    this.ready = true;
                    createClip(this._parent);
                } // end if
                if (this.text._width * -1 >= this._x)
                {
                    this.removemovieclip();
                } // end if
            } // end if
        } // end if
    };
    ref_._x = in_mc.width;
    ref_.ready = false;
    ref_.text.textColor = ref_.color;
    ++counter;
    if (counter == texts_count)
    {
        counter = 0;
    } // end if
};
var first_mc = 0;
onEnterFrame = function ()
{
    if (!fl_loaded)
    {
        return (0);
    } // end if
    if (first_mc == 0)
    {
        first_mc = createClip(this);
    } // end if
    if (fl_sleep)
    {
        if (this.sleep_count >= this.delay_interval)
        {
            this.fl_sleep = false;
            this.sleep_count = 0;
        }
        else
        {
            ++this.sleep_count;
        } // end if
    } // end else if
};

XML:


<items>
<item link="" target-frame="_self" font-face="Arial" font-size="16" font-color="0" higlight-color="255"><![CDATA[BLANK]]></item>
<item link="" target-frame="_self" font-face="Arial" font-size="16" font-color="0" higlight-color="255"><![CDATA[Headline Page 1]]></item>
<item link="" target-frame="_self" font-face="Arial" font-size="16" font-color="0" higlight-color="255"><![CDATA[Headline Page 2]]></item>
<item link="" target-frame="_self" font-face="Arial" font-size="16" font-color="0" higlight-color="255"><![CDATA[Headline Page 3]]></item>
</items>