PDA

View Full Version : Invoking getNextHighestDepth() Method


marijntje@orange.nl
02-11-2006, 07:22 PM
for some reason when i use getNextHighestDepth() when creating multiple TextFields or MovieClips in one wrapper_mc MovieClip it doesn't return the nexth highest depth.

_root.header_mc.createEmptyMovieClip(mcName, getNextHighestDepth());
_root.header_mc[mcName].createEmptyMovieClip(mcArtName, getNextHighestDepth());
_root.header_mc[mcName][mcArtName].loadMovie(varN.art[1].Url);
_root.header_mc[mcName].createEmptyMovieClip(mcTextName, getNextHighestDepth());
_root.header_mc[mcName][mcTextName].createTextField("title_txt", getNextHighestDepth(), 180, 20, 600, 40);
_root.header_mc[mcName][mcTextName].createTextField("description_txt", getNextHighestDepth(), 380, 60, 400, 80);
_root.header_mc[mcName][mcTextName].createTextField("links_txt", getNextHighestDepth(), 380, 135, 400, 20);

what is going wrong here? i could just add +1 +2 etc. but i'd like to just use getNextHighestDepth() for what it was build for ;)

tnx marijntje

Flash Gordon
02-11-2006, 07:27 PM
_root.header_mc.createEmptyMovieClip(mcName, header_mc.getNextHighestDepth());
trace(header_mc.mcName.getDepth());

Output?

Xeef
02-11-2006, 07:33 PM
a bit more clearly

if you use "getNextHighestDepth()" whit out anything in front you will get the getNextHighestDepth from the curent scope (usualy _root)
wich will not change aslong you not creating the object on it

eg.

a=getNextHighestDepth() //let's say 1234


_root.header_mc[mcName][mcTextName].createTextField("title_txt", getNextHighestDepth(), 180, 20, 600, 40);
_root.header_mc[mcName][mcTextName].createTextField("description_txt", getNextHighestDepth(), 380, 60, 400, 80);


it will by in both cases still 1234


root.header_mc[mcName][mcTextName].getNextHighestDepth()

you shoud use

hangalot
02-11-2006, 07:45 PM
this code is much more readable and should solve your problem



var clip:MovieClip = _root.header_mc.createEmptyMovieClip(mcName, getNextHighestDepth());
var artNameClip:MovieClip = clip.createEmptyMovieClip(mcArtName, clip.getNextHighestDepth());
artNameClip.loadMovie(varN.art[1].Url);
clip.createEmptyMovieClip(mcTextName, clip.getNextHighestDepth());
clip.createTextField("title_txt", clip.getNextHighestDepth(), 180, 20, 600, 40);
clip.createTextField("description_txt", clip.getNextHighestDepth(), 380, 60, 400, 80);
clip.createTextField("links_txt", clip.getNextHighestDepth(), 380, 135, 400, 20);