mardi 23 février 2016

display text in different position when loading from a php to AIR app

I've got a database with multiple lines of "title".

I asking my AS3 code to load theses lines like that :

urlReqSearchAll.method = URLRequestMethod.POST;  
loader5.load(urlReqSearchAll);
loader5.addEventListener(Event.COMPLETE,complete);
}

function complete(e:Event):void {
 addChild(list);
   products = JSON.parse(loader5.data) as Array;
     products.reverse();
    for(var i:int = 0; i < products.length; i++){
        createListItem(i, products[i]);
}
function showList():void {
    list.visible = true;
    searchList.visible = false;
}

function createListItem(index:int, item:Object):void {

    var listItem:TextField = new TextField();
    var myFormat:TextFormat = new TextFormat();
    myFormat.size = 25
    myFormat.color = 0x000000;
    myFormat.font = "Mohave";
    listItem.defaultTextFormat = myFormat;
    listItem.text = item.title;
    listItem.x = 2;
    listItem.y = 75+ index * 40;
    listItem.width = 350;
    listItem.height = 80;

 listItem.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
        showDetails(item);
    });
    list.addChild(listItem);
    str = item.title;

}

The list is created in my textField listItem. But it's like that :

item1
item2
item3
..

Is it possible to display it like that ? :

item1                          item2                         item3

item4      

If so, how ?

Thx

Aucun commentaire:

Enregistrer un commentaire