What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
Hello! Forgive my flash noobiness again but I’m slowly learning this language as I go along. Every day I’m learning a little more about the language.
When I started, I was jumping between multiple scenes and all over the timeline as I wanted to show/hide different graphics. I have since figured out that’s a stupid way to do it and am now using temp = this.attachMovie() with the “getNextHighestDepth()” function and temp.removeMovieClip() to bring in and remove movieClips from my library.
But I was reading that if you use getNextHighestDepth(), removeMovieClip can fail. It’s in the help for .removeMovieClip but I don’t understand it. Is this something I should worry about? I haven’t run into any problems yet but I haven’t extensively tested my game. If anyone understands this problem and can explain it to me I’d be greatful. Thanks!
Not sure where you read that, getNextHighestDepth() is _usually_ fine since it always returns an integer above 0. If you dont want to use it you can always just create a variable and increment that each time you attach or create a movie ( ie var depth:Number = 0; depth++ ). If you have to, you can also use getInstanceAtDepth() in conjunction with this method to check if a depth is already occupied.
Thanks. If you’re not worried about it then I’m not. I was mostly just curious if this was an actual problem because I’m not creating that many instances of movies. Here’s the text though from MovieClip.removeMovieClip() help file that I was reading in case you’re interested though:
“Note: If you are using V2 components, and use MovieClip.getNextHighestDepth() instead of the DepthManager class to assign depth values, you may find that removeMovieClip() fails silently. When any V2 component is used, the DepthManager class automatically reserves the highest (1048575) and lowest (-16383) available depths for cursors and tooltips. A subsequent call to getNextHighestDepth() returns 1048576, which is outside the valid range. The removeMovieClip() method fails silently if it encounters a depth value outside the valid range. If you must use getNextHighestDepth() with V2 components, then you can use swapDepths() to assign a valid depth value or use MovieClip.unloadMovie() to remove the contents of the movie clip. Alternatively, you can use the DepthManager class to assign depth values within the valid range.”
That only applies to components (and v2 components at that) – if you are not sure what components are, open the component library from the view/windows menu (not sure which without looking). They are mostly scrollbars and standard buttons and stuff – ie. stuff you wouldn’t normally attach dynamically in a game, anyway..
> They are mostly scrollbars and standard buttons and stuff – ie. stuff you wouldn’t normally attach dynamically in a game, anyway..
Having one present in your library will make getNextHighestDepth fail on other movieclips trying to use it as well though.
The other thing to note about removeMovieClip() is that anything you place at authoring time will be given a negative depth, so you’ll need to swapDepths() to a positive depth before removeMovieClip will work on it.