// comments page
var comments_txt:TextField = createTextField("comments_txt", getNextHighestDepth(), 0, 0, 381, 390);
comments_txt.html = true;
comments_txt.selectable = true;
comments_txt.mouseWheelEnabled = true;
comments_txt._visible = true;
scroller.visible = false;
scroller.setStyle("themeColor", "haloBlue");
var comments:Array = [];
createEmptyMovieClip("user_img_mc", getNextHighestDepth());
user_img_mc._visible = false;
function display_comments()
{
var i:Number, len:Number = comments.length;
var width:Number, height:Number;
var text:String = "";
var d:Date = new Date();
comments_txt.htmlText = "";
for (i = 0; i < len; i++)
{
//if (comments[i].img_mc != undefined)
//{
width = 75;
height = Math.round(comments[i].img_height * (width / comments[i].img_width));
if ( height > 65 )
{
height = 65;
width = Math.round(comments[i].img_width * (height / comments[i].img_height));
}
text += ""+
""+
""+
""+ comments[i].screen_name +" - "+ comments[i].time +"
"+ comments[i].comment +
"
";
/*} else {
text += ""+
""+
""+
""+ comments[i].screen_name +" - "+ comments[i].time +"
"+ comments[i].comment +
"";
}*/
}
comments_txt.htmlText = text;
scroller._targetInstanceName = comments_txt;
scroller.setSize(16, comments_txt._height);
scroller.visible = true;
}
function load_image(c_indice:Number)
{
comments[c_indice].img_mc = user_img_mc.createEmptyMovieClip(c_indice, user_img_mc.getNextHighestDepth());
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(
{
indice : c_indice ,
onLoadInit : function(target_mc:MovieClip)
{
if (target_mc._width > 65)
{
target_mc._yscale = target_mc._xscale =
(65 / target_mc._width * 100);
}
comments[this.indice].img_mc = target_mc;
if (comments[++this.indice])
load_image(this.indice);
display_comments();
}
}
);
mcl.loadClip(comments[c_indice].img_url, comments[c_indice].img_mc);
}
function load_comments()
{
var conn_comments:LoadVars = new LoadVars();
conn_comments.onLoad = function(success:Boolean)
{
if (success)
{
var i:Number, len:Number = parseInt(this.n);
if (!isNaN(len))
{
for (i = 0; i <= len; i++)
{
trace("this[\"i"+ i +"\"] = "+ this["i"+ i]);
if (this["i"+ i])
{
comments[comments.length] =
{
id : this["i"+ i] ,
screen_name : this["sn"+ i] ,
img_mc : undefined ,
img_url : this["iu"+ i] ,
img_width : parseInt(this["iw"+ i]) ,
img_height : parseInt(this["ih"+ i]) ,
time : this["pt"+ i] ,
comment : this["c"+ i]
};
}
}
display_comments();
//load_image(0);
}
} else {
comments_txt.htmlText = "
I could not load comments at this time.
Please try again later.
"+ this.error +"
"; } } comments_txt.htmlText = "Loading Comments...
"; conn_comments.load("http://www.createvibe.com/myspace/_comments.php"); } load_comments(); stop();