关于Flash层深度的问题 - 蓝光

来源:百度文库 编辑:神马文学网 时间:2024/04/28 12:00:50
关于Flash层深度的问题作者:何足道 日期:2007-11-09制作一套课件时,研究了一下关于层的深度的处理问题,现做一下总结!原文地址:http://www.blue-sun.cn/article.asp?id=302(转载请保留)所谓深度,不难理解,就是谁在上谁在下的问题,从而实现遮与被遮!(我的理解 )1、获得某对象所在的深度 程序代码MovieClip.getDepth 2、获得某个深度处的实例对象 程序代码MovieClip.getInstanceAtDepth3、获得下一个可用的最高深度 程序代码MovieClip.getNextHighestDepth 4、交换深度 程序代码MovieClip.swapDepths()5、使对象处在最上面 程序代码mx.behaviors.DepthControl.bringToFront(MovieClip);应用实例:Flash动画在线播放实例代码: 程序代码mc1.txt.htmlText = "蓝光博客www.blue-sun.cn
关于对象深度的一个小实例mc1";mc2.txt.htmlText = "蓝光博客www.blue-sun.cn
关于对象深度的一个小实例mc2";this.mc1.txt.htmlText += "深度:"+this.mc1.getDepth();//获得mc1的深度this.mc2.txt.htmlText += "深度:"+this.mc2.getDepth();//获得mc2的深度mc1.onPress = function() { this.startDrag(); mx.behaviors.DepthControl.bringToFront(this);//将mc1移到最前};mc1.onReleaseOutside = function() { this.stopDrag();};mc1.onRelease = function() { this.stopDrag();};mc2.onPress = function() { this.startDrag(); mx.behaviors.DepthControl.bringToFront(this);//将mc2移到最前};mc2.onReleaseOutside = function() { this.stopDrag();};mc2.onRelease = function() { this.stopDrag();};swap.onRelease = function() { _root.mc1.swapDepths(_root.mc2);//交换mc1与mc2的深度 }