Hello, there!
So, I’m redesigning my website and it’s my first AS3 adventure.
The trick is: I’m calling variables from PHP and inserting data on text fields inside a mc. So far, do good.
My problem appears when I want to loop theese mc’s and displaying it’s instances with different heights.
My code goes below.
Cheers!
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.TEXT;
myLoader.load(new URLRequest("http://www.loligovulgaris.com/php/newsfeed.php"));
myLoader.addEventListener(Event.COMPLETE, makeVars);
var infomc:infoMc;
var infomcY:Number = 56;
var infomcH:Number = 0;
function makeVars(event:Event):void {
var variables:URLVariables = new URLVariables(event.target.data);
for (var i:Number = 0; i<variables.numberOfRows; i++) {
infomc = new infoMc();
addChild(infomc);
infomc.textDate.text = "posted on "+variables["date"+i];
infomc.textTitle.text = variables["title"+i];
infomc.textBody.htmlText = variables["texto"+i];
infomcY += infomcH+22;
infomc.y = infomcY;
infomcH = infomc.height;
}
}