-
Changing Button Depth?
Hello,
Is there any function that can be utilized to change the depth of a Button (not movieClip used as a button).
I know that for mcs there is this function (swapDepths), but is there one for Buttons?
Regards!
P.S. A Button, not movieClip as a button.
-
.
Hi,
Similar, something like
PHP Code:
trace(theButton.getDepth());
theButton.onRelease = function():Void { this.swapDepths(_root.getNextHighestDepth()); trace(theButton.getDepth()); };
just drag a component button on to the stage and call it theButton
-
Thank you,
That method above is working, perfectly, with a Button component. However, if the button was drawn the old fashion way; like drawing a square or circle and converting it to a button with F8, tried the code, it is not working with that.
The button component was initially, I guess, built as movieclip, the reason why the function (swapDepths) works with it.
Last edited by Dr_flash; 03-19-2016 at 05:44 AM.
-
.
Hi,
Yes you are right, you can however:
put your button in a container clip and do it that way, container.swapDepths();
or you can use this workaround in your code and keep the code I gave with your button
PHP Code:
Button.prototype.swapDepths = MovieClip.prototype.swapDepths;
found on adobe site
-
Originally Posted by fruitbeard
Hi,
Yes you are right, you can however:
put your button in a container clip and do it that way, container.swapDepths();
or you can use this workaround in your code and keep the code I gave with your button
PHP Code:
Button.prototype.swapDepths = MovieClip.prototype.swapDepths;
found on adobe site
Hello All,
Has anyone used the above code in the quote. Did it work with no problems? Did it interfer/miss up with other codes. Beacuse the key word "prototype" could be understood as if the method still in early stages, not consolidated yet. I do not know because I did not use it before. Can some one, who happened to have used it before, weigh on that.
Any tips,
Regards!
Last edited by Dr_flash; 04-24-2016 at 09:07 AM.
-
.
Hi,
Test it and see, it did of course work when testing it here.
http://www.lashf.com/page/actionscript/prototypes
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
|