all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

getNextHighestDepth and TextField


getNextHighestDepth and TextField rdw75wu
9/22/2005 10:54:02 PM
flash actionscript:
When I use the code listed below, the application won't display both text
fields, they are overwriting each other at the same level. When I use specific
depths it works fine. In my main code I execute each item sequentially, and the
second call displays. When I call only one, everything appears correctly, so I
doubt it is a font issue.

Any ideas?


function addTitle(titleText, boxWidth) {
checkBox_mc.createTextField("windowTitle_txt", this.getNextHighestDepth(), 2,
2, boxWidth-10, 10);
checkBox_mc.windowTitle_txt.antiAliasType = "advanced";
checkBox_mc.windowTitle_txt.embedFonts = true;
checkBox_mc.windowTitle_txt.text = titleText;
checkBox_mc.windowTitle_txt.setTextFormat(windowTitle_fmt);
checkBox_mc.lineStyle(1, 0x000000, 20);
checkBox_mc.moveTo(2, 17);
checkBox_mc.lineTo(boxWidth-4, 17);
trace("Title added");
}
function addText(textString, boxWidth, boxHeight) {
checkBox_mc.createTextField("windowText_txt", this.getNextHighestDepth(), 2,
19, boxWidth-10, boxHeight-20);
checkBox_mc.windowText_txt.antiAliasType = "advanced";
checkBox_mc.windowText_txt.embedFonts = true;
checkBox_mc.windowText_txt.wordWrap = true;
checkBox_mc.windowText_txt.text = textString;
checkBox_mc.windowText_txt.setTextFormat(windowText_fmt);
trace("Text added");
}
Re: getNextHighestDepth and TextField NSurveyor
9/22/2005 11:05:32 PM
Try:

checkBox_mc.createTextField("windowTitle_txt",
checkBox_mc.getNextHighestDepth(), 2, 2, boxWidth-10, 10);

and

checkBox_mc.createTextField("windowText_txt",
checkBox_mc.getNextHighestDepth(), 2, 19, boxWidth-10, boxHeight-20);

Re: getNextHighestDepth and TextField rdw75wu
9/23/2005 12:00:00 AM
Re: getNextHighestDepth and TextField NSurveyor
9/23/2005 8:47:42 PM
You're welcome.

I think a lot of people are taking advantage of the getNextHighestDepth - more
importantly, I don't think people understand depths. Every clip has a range of
depths in which you can place things in. Depth 1 in one clip is different from
Depth 1 in another. In your code, you were using this.getNextHighestDepth()
when the highest depth you wanted was from your checkBox_mc. Since you used the
parent clip, and nothing has changed to that clip, the getNextHighestDepth()
returned the same number, which removed the previous textfield because both
were placed at the same depth.
AddThis Social Bookmark Button