Answered
target_mc._height
hi if got a little problem how can I use the
target_mc._height outside of my onloadinit function? i have to add
it to my var K to keep me on the right height?
var k = 10;
//variabele voor het bijhouden van de hoogte
var j = 10;
//variabele voor het bijhouden van dfe depth
function loadXML(loaded) {
if (loaded) {
myTBX.contentPath = "content_holder";
xmlNode = this.firstChild;
date = [];
titel = [];
entry = [];
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
date = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
titel = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
entry = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
image = xmlNode.childNodes.childNodes[3].firstChild.nodeValue;
//formatting voor datums
var my_fmt2 = new TextFormat();
my_fmt2.font = "Verdana";
my_fmt2.size = 11;
my_fmt2.underline = true;
my_fmt2.color = 0xFFCC33;
//Yellow
my_fmt2.bold = true;
var metricsDate:Object = my_fmt2.getTextExtent(date , 100);
thisTextBox = myTBX.content.createTextField("tbxDate"+i, 20+j, 20, k, 100, metricsDate.textFieldHeight);
j++;
k += 15;
//tussen titel en datum
thisTextBox.background = false;
thisTextBox.border = false;
thisTextBox.backgroundColor = 0xcccccc;
//light grey
thisTextBox.borderColor = 0x000000;
//black
thisTextBox.multiline = true;
thisTextBox.wordWrap = true;
thisTextBox.text = date;
thisTextBox.setTextFormat(my_fmt2);
//formatting voor datums
var metricsTitel:Object = my_fmt2.getTextExtent(titel , 300);
thisTextBox1 = myTBX.content.createTextField("tbxTitel"+i, 20+j, 20, k, 300, metricsTitel.textFieldHeight);
j++;
k += 15;
//tussen titel en txt
var my_fmt3 = new TextFormat();
my_fmt3.font = "Verdana";
my_fmt3.size = 11;
my_fmt3.underline = true;
my_fmt3.color = 0xFF9900;
//orange
my_fmt3.bold = true;
thisTextBox1.background = false;
thisTextBox1.border = false;
thisTextBox1.backgroundColor = 0xcccccc;
//light grey
thisTextBox1.borderColor = 0x000000;
//black
thisTextBox1.multiline = true;
thisTextBox1.wordWrap = true;
thisTextBox1.text = titel;
thisTextBox1.setTextFormat(my_fmt3);
var my_fmt = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 10;
my_fmt.color = 0x000000;
//grey
var metricsText:Object = my_fmt.getTextExtent(entry , 450);
thisTextBox2 = myTBX.content.createTextField("tbxText"+i, 20+j, 20, k, 450, metricsText.textFieldHeight);
j++;
k += metricsText.textFieldHeight;
thisTextBox2.background = false;
thisTextBox2.border = false;
thisTextBox2.backgroundColor = 0xcccccc;
//light grey
thisTextBox2.borderColor = 0x000000;
//black
thisTextBox2.multiline = true;
thisTextBox2.wordWrap = true;
thisTextBox2.html = true;
thisTextBox2.htmlText = entry;
thisTextBox2.setTextFormat(my_fmt);
k += 15;
//eindhoogte tussen enrty
if (image != "undefined") {
var mci:MovieClip = myTBX.content.createEmptyMovieClip("mc"+i, 40+j);
j++;
var image_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace(target_mc._height); // <--here i have it
};
image_mcl.addListener(mclListener);
image_mcl.loadClip(image, mci);
mci._y = k;
mci._x = 30;
//k+= target_mc._height + 10; // <-- here's my problem
}
}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(" http://localhost/test/get_news_to_xml.php");
/////////////////////////////////////
var k = 10;
//variabele voor het bijhouden van de hoogte
var j = 10;
//variabele voor het bijhouden van dfe depth
function loadXML(loaded) {
if (loaded) {
myTBX.contentPath = "content_holder";
xmlNode = this.firstChild;
date = [];
titel = [];
entry = [];
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
date = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
titel = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
entry = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
image = xmlNode.childNodes.childNodes[3].firstChild.nodeValue;
//formatting voor datums
var my_fmt2 = new TextFormat();
my_fmt2.font = "Verdana";
my_fmt2.size = 11;
my_fmt2.underline = true;
my_fmt2.color = 0xFFCC33;
//Yellow
my_fmt2.bold = true;
var metricsDate:Object = my_fmt2.getTextExtent(date , 100);
thisTextBox = myTBX.content.createTextField("tbxDate"+i, 20+j, 20, k, 100, metricsDate.textFieldHeight);
j++;
k += 15;
//tussen titel en datum
thisTextBox.background = false;
thisTextBox.border = false;
thisTextBox.backgroundColor = 0xcccccc;
//light grey
thisTextBox.borderColor = 0x000000;
//black
thisTextBox.multiline = true;
thisTextBox.wordWrap = true;
thisTextBox.text = date;
thisTextBox.setTextFormat(my_fmt2);
//formatting voor datums
var metricsTitel:Object = my_fmt2.getTextExtent(titel , 300);
thisTextBox1 = myTBX.content.createTextField("tbxTitel"+i, 20+j, 20, k, 300, metricsTitel.textFieldHeight);
j++;
k += 15;
//tussen titel en txt
var my_fmt3 = new TextFormat();
my_fmt3.font = "Verdana";
my_fmt3.size = 11;
my_fmt3.underline = true;
my_fmt3.color = 0xFF9900;
//orange
my_fmt3.bold = true;
thisTextBox1.background = false;
thisTextBox1.border = false;
thisTextBox1.backgroundColor = 0xcccccc;
//light grey
thisTextBox1.borderColor = 0x000000;
//black
thisTextBox1.multiline = true;
thisTextBox1.wordWrap = true;
thisTextBox1.text = titel;
thisTextBox1.setTextFormat(my_fmt3);
var my_fmt = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 10;
my_fmt.color = 0x000000;
//grey
var metricsText:Object = my_fmt.getTextExtent(entry , 450);
thisTextBox2 = myTBX.content.createTextField("tbxText"+i, 20+j, 20, k, 450, metricsText.textFieldHeight);
j++;
k += metricsText.textFieldHeight;
thisTextBox2.background = false;
thisTextBox2.border = false;
thisTextBox2.backgroundColor = 0xcccccc;
//light grey
thisTextBox2.borderColor = 0x000000;
//black
thisTextBox2.multiline = true;
thisTextBox2.wordWrap = true;
thisTextBox2.html = true;
thisTextBox2.htmlText = entry;
thisTextBox2.setTextFormat(my_fmt);
k += 15;
//eindhoogte tussen enrty
if (image != "undefined") {
var mci:MovieClip = myTBX.content.createEmptyMovieClip("mc"+i, 40+j);
j++;
var image_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace(target_mc._height); // <--here i have it
};
image_mcl.addListener(mclListener);
image_mcl.loadClip(image, mci);
mci._y = k;
mci._x = 30;
//k+= target_mc._height + 10; // <-- here's my problem
}
}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(" http://localhost/test/get_news_to_xml.php");
/////////////////////////////////////