views:

19

answers:

1

Hi Everyone,

I'm trying to make a banner which the user can edit his Preferences in a xml file. My xml file looks like below.

<billBoard>
    <items>
        <item>
            <imageUrl>images/plaatje_1.jpg</imageUrl>
            <imageShowTime>5</imageShowTime>
            <imageClickLink>http://www.google.nl&lt;/imageClickLink&gt;
            <imageClickLinkTarget>_blank</imageClickLinkTarget>
            <animatiePosition>top</animatiePosition>
            <animatieEffectType>Cubic</animatieEffectType>
            <textboxen>
                <textbox>
                    <textFontSize>14</textFontSize>
                    <textFontColor>0xFFFFFF</textFontColor>
                    <textBgColor>0xFF0000</textBgColor>
                    <textBgOpicity>0.8</textBgOpicity>
                    <textPadding>10</textPadding>
                    <textAnimationDirection>left</textAnimationDirection>
                    <textAnimatieTime>2</textAnimatieTime>
                    <textAnimatieDelay>0.07</textAnimatieDelay>
                    <textXposition>200</textXposition>
                    <textYposition>300</textYposition>
                    <text>hier komt de tekst</text>
                </textbox>

                <textbox>
                    <textFontSize>18</textFontSize>
                    <textFontColor>#FF0080</textFontColor>
                    <textBgColor>0xFF0000</textBgColor>
                    <textBgOpicity>0.6</textBgOpicity>
                    <textPadding>12</textPadding>
                    <textAnimationDirection>right</textAnimationDirection>
                    <textAnimatieTime>3</textAnimatieTime>
                    <textAnimatieDelay>0.07</textAnimatieDelay>
                    <textXposition>200</textXposition>
                    <textYposition>300</textYposition>
                    <text>hier komt de tekst 2 van item 1</text>
                </textbox>

the goal is that i can parse the item associated with textboxes.

to parse the data i use a for loop in a foor loop who looks like below:

_billboardData_array = new Array();

        for (var i:int = 0; i < xml.billBoard.items.item.length(); i++) {
            //hold the data of the billboardItems

            var billBoardData:Array = new Array();


            billBoardData['billBoardID'] = i;
            billBoardData['imageUrl'] = xml.billBoard.items.item[i].imageUrl;
            billBoardData['imageShowTime'] = xml.billBoard.items.item[i].imageShowTime;
            billBoardData['imageClickLink'] = xml.billBoard.items.item[i].imageClickLink;
            billBoardData['imageClickLinkTarget'] = xml.billBoard.items.item[i].imageClickLinkTarget;
            billBoardData['animatiePosition'] = xml.billBoard.items.item[i].animatiePosition;

            trace("<---" + billBoardData['imageUrl'] + "--->");
            for (var j:int = 0; j < xml.billBoard.items.item[i].textboxen.textbox.length(); j++) {

                billBoardData['textFontSize'] = xml.billBoard.items.item[i].textboxen.textbox.textFontSize[j];
                trace(billBoardData['textFontSize'] = xml.billBoard.items.item[i].textboxen.textbox.textFontSize[j]);
            }


            //trace(item.textboxen[i].textbox.length());

            _billboardData_array[i] = billBoardData;


       }    
        }

        public function get billboardData_array():Array { return _billboardData_array; }

when i parse this i get the right results like:

<---images/plaatje_1.jpg---> 14 18 30 <---images/plaatje_2.jpg---> 20 26

that means image 1 has three textboxes with fontsize: 14,18,30.

now i've the following problem.

as you can see i've get function from my billboardData_array i want to call this get function in other classes to get the correct data i need.

for now i made a example function like:

public function showBla():void {
        trace("show bla functie");
        trace(swisBillBoardData.billboardData_array[0]['textFontSize']);

    }

this function returns the last fontsize but i need to loop through it to display text on the stage.

i hope someone can help me with this one.

thanks a lot

A: 

it's fixed:). The problem was that i rewrite the array each time i loop trough the texbox.

Navid