Hi all,
My first post on this eminent forum! Hopefully i can contribute to it soon aswell, but first mayby there is someone in here that can help me!
I have a videoplayer in which i load video interviews via XML into flash.
I dynamically create the “question” buttons via attachMovie.
My problem is that the length of each questions text can be different, so i need to place the questions underneath eachother dynamically depending on how large the textfield becomes. The “buttons”/text have a given/static width off 330px so they need to grow by height dynamically but with 10px beeteween each question.
It is the
newBut._y = (i*newBut.but_txt._height)+75;
that is puzzeling me!
Anyway, here is the code I am using:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(ok) {
if (ok) {
//trace ('data loaded');
//trace (this.firstChild.firstChild.attributes.text);
allData = this.firstChild.childNodes;
for (i=0; i<allData.length; i++) {
//trace(allData*.attributes.text);
newBut = _root.attachMovie('butTemp', 'but'+i, i);
newBut.but_txt.autoSize = true;
newBut._x = 170;
//newBut._y=(i*30)+75;
newBut._y = (i*newBut.but_txt._height)+75;
newBut.but_txt.text = allData*.attributes.text;
//trace(allData*.firstChild.firstChild)
newBut.myHeading = allData*.firstChild.firstChild;
//trace(allData*.firstChild.nextSibling.firstChild)
newBut.myVideo = allData*.firstChild.nextSibling.firstChild;
newBut.onRelease = function() {
heading_txt.text = this.myHeading;
content_txt.text = this.myVideo;
netStream.play("media/"+this.myVideo+".flv");
my_video.play_butt._visible = false;
my_video.pause_butt._visible = true;
};
}
} else {
trace('error');
}
};
myXML.load('video.xml');
Hopefully someone can help me
Best Regards
/John