Im trying to figure out amfphp and as3 and could use some help… what im trying to do is really simple (or at least it should be) in my database i have a table with 4 lines: id, topic(rubrik), content(innehall) and urladresses(adress) and i’ve done a loop that makes a button for each topic which contains a textfield which displays the topic.
but how do i make these buttons display the content in a separate textfield on click (without referencing with a static adress)?
function onResult(responds:Object):void {
var t:Array=responds.serverInfo.initialData;
var placering:Number=60;
for (var i:uint=0; i<t.length; i++) {
var knapp_mc:MovieClip = new Rubrik();
knapp_mc.buttonMode=true;
knapp_mc.mouseChildren=false;
knapp_mc.name="knapp"+i;
knapp_mc.x=95;
knapp_mc.y=placering;
placering+=30;
addChild(knapp_mc);
knapp_mc.rubrik_txt.text=t*[1];
var innehall = t*[2];
addEventListener(MouseEvent.CLICK, klick);
lista.text=t[0][3];
}
var lank=getChildByName("knapp0");
var lank2=getChildByName("knapp1");
function klick(e:MouseEvent):void {
lista.text=innehall;
}
}
it kind of works now but i can only get the content for the last row in my database. if i don’t change innehall to innehall = t[0][2], and than t[1][2] and t[2][2] etc. but i dont want to have a static adress like that.