|
-
Senior Member
AS2: can someone write: getNextHighestDepthUnderComponentDepth()
I have a site that has a few components on it (comboboxes).
I have need to add in another screen of components over this first one. I made the screen up as a movieclip in the library and then attach and move it into position with a button.
Everything works okay except 'getNextHighestDepth()' returns a depth higher than the max because of the components already present in the file. I forget the number, but components occupy the highest depth allowable by commands like swapdepths, etc.. I think it is 32000 and change.
Attaching this new menu and setting the depth as _root.getNextHighestDepth() gives me a depth ABOVE the comboboxes. So my comboboxes on this new movieclip slide open UNDER the background.
Is there a way to write a function that will quickly give me the next highest depth LOWER than the combobox depth?
I have heard that the depth manager should be used when using components, but frankly I can't find much help on that class in the helpfiles so I have no clue how to use it.
-
OOP is one letter from OOPS
http://www.adobe.com/support/flash/a...ionary526.html
clipToBeMoved.swapDepths(comboBox.getDepth()-1);
I am guessing her based on what you have said, but that should be the basic idea.
-
Senior Member
Not quite, that would return the same depth every time.
Lets say we have a flash file like this:
Code:
Depth Content
1 Some movieclip
2 Some movieclip
3 Some movieclip
10 Some movieclip
50 Some movieclip
XXXX Components
I would like some code that would return me 51. Is there some easy way to go backwards from depth XXXX to find 50 or would this function have to loop through every depth from 1 to XXXXX and check if there is an object at that depth (this would be slow I fear).
-
Senior Member
I just checked the depths, and components act oddly.
When I use getDepth() on the combobox inside the movieclip I get:
-16376
When I check the parent movieclip created with _root.getNextHighestDepth() I get:
1048576
The comboboxes in the root reserve the depth of 1048575 for display purposes. Not sure why they do this, but they really mess up the getNextHighestDepth() function as soon as you use a single component.
Anyway, I am just moving ahead with using an arbitrarily high depth of 1000 for my movieclip and it is working fine. I just don't like to pick numbers out of thin air for depths. I would prefer an easy way to get the REAL nexthighestdepth ignoring the bogus depth of 1048575.
Thanks for taking the time to look into it, if there was an easy answer I would have probably found it by now, heh.
-
OOP is one letter from OOPS
Yeah that seems like Flash being weird. Basically I was taking a guess. From what you put on bold, you wanted the depth of the component -1. Theoretically speaking that should be whatever depth the component is at (comboBox.getDepth()) minus 1.
-
Senior Member
if you dynamically attach the components, they should have a - (negative) depth associated with it..
I think having them on stage at authoring does this.
Maybe have a look at using the Depth Manager Class for your objects? (I personally have never played with it however...just a suggestion)
and use things like:
DepthManager.setDepthBelow()
DepthManager.setDepthAbove()
&
DepthManager.createClassObjectAtDepth()
DepthManager.createObjectAtDepth()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|