cphunk
10-23-2003, 05:12 AM
Hey everyone, I have a simple question for you. Hopefully someone can help here.
I'm currently duplicating a clip on the stage as a news item. The problem is. The textfield within the movie clip is resized based on the dynamic text's textHeight. The next duplicated movie must be placed so that it's 10px below the previous - dynamically sized duplicated movie. Do you follow me?
The problem is that, I can't get the previously duplicated clip's height. Is there a way to target your last duplicate somehow?
Here's the code:
You can even download the fla and text file here:
http://www.c-phunk.com/testDup.zip
n = _root.numberOfNewsItems;
objTexts = new LoadVars();
objTexts.load("newsText.txt");
objTexts.pntTimeline = this;
objTexts.onLoad = function() {
this.pntTimeline.dupClips();
};
dupClips = function(){
mc._visible = false;
for(var i = 0; i<n; i++) {
// duplicates mc and sets the text field to newsText.txt text var
var pntThisDupe = mc.duplicateMovieClip("dupe"+i,i);
pntThisDupe.field.text = objTexts["text" + i];
pntThisDupe.date.text = objTexts["Date" + i];
pntThisDupe.field._height = pntThisDupe.field.textHeight;
pntThisDupe.alphaClip._height = pntThisDupe.field.textHeight+10;
// i thought the following would target the prev clip, but it doesn't
if(i > 0) {
var oneLess = i-1;
var newName = "dupe"+oneLess;
// traceing newName returns the correct previous clip
// but i cannot target it's values ..._y, _height for example
trace(newName);
_pntThisDupe._y = newName._height + 10;
}
}
};
I'm currently duplicating a clip on the stage as a news item. The problem is. The textfield within the movie clip is resized based on the dynamic text's textHeight. The next duplicated movie must be placed so that it's 10px below the previous - dynamically sized duplicated movie. Do you follow me?
The problem is that, I can't get the previously duplicated clip's height. Is there a way to target your last duplicate somehow?
Here's the code:
You can even download the fla and text file here:
http://www.c-phunk.com/testDup.zip
n = _root.numberOfNewsItems;
objTexts = new LoadVars();
objTexts.load("newsText.txt");
objTexts.pntTimeline = this;
objTexts.onLoad = function() {
this.pntTimeline.dupClips();
};
dupClips = function(){
mc._visible = false;
for(var i = 0; i<n; i++) {
// duplicates mc and sets the text field to newsText.txt text var
var pntThisDupe = mc.duplicateMovieClip("dupe"+i,i);
pntThisDupe.field.text = objTexts["text" + i];
pntThisDupe.date.text = objTexts["Date" + i];
pntThisDupe.field._height = pntThisDupe.field.textHeight;
pntThisDupe.alphaClip._height = pntThisDupe.field.textHeight+10;
// i thought the following would target the prev clip, but it doesn't
if(i > 0) {
var oneLess = i-1;
var newName = "dupe"+oneLess;
// traceing newName returns the correct previous clip
// but i cannot target it's values ..._y, _height for example
trace(newName);
_pntThisDupe._y = newName._height + 10;
}
}
};