//solventsky(溶剂)的自定义类:删除可视化类
//它可以方便的删除场景的按钮、影片剪辑、动态文本
//用法:
//import removeOb;
//var mm=new removeOb()
//mm.remove(Object_name)
//-----------------------------------------------
class removeOb extends MovieClip {
private var _myD:Number, _myN:Number, _myPath:String, _myPath2, _mytype:String, t_mc:MovieClip, _myObName:String;
function removeOb(Ob) {
}
public function remove(Ob:Object) {
getMyN(Ob);
getMyPath(Ob);
_myPath2 = eval(_myPath);
_myD = _root[_myPath2].getNextHighestDepth();
_myD == 0 ? +1 : +0;
switch (_myN) {
case 0 :
Ob.swapDepths(_myD);
Ob.removeMovieClip();
case 1 :
t_mc = _root[_myPath2].createEmptyMovieClip("solventsky", Ob.getDepth());
t_mc.removeMovieClip();
trace(t_mc);
}
}
private function getMyN(Ob) {
_mytype = typeof (Ob);
if (_mytype == "movieclip") {
//说明是 mc
_myN = 0;
trace(_myN);
} else if (_mytype == "object") {
//说明是Button or 动态文本
_myN = 1;
}
return _myN;
}
private function getMyPath(Ob:Object) {
_myPath = String(eval(Ob));
_myObName = Ob._name;
_myPath = _myPath.slice(0, _myPath.indexOf(_myObName, -1)-1);
return _myPath;
}
}
//它可以方便的删除场景的按钮、影片剪辑、动态文本
//用法:
//import removeOb;
//var mm=new removeOb()
//mm.remove(Object_name)
//-----------------------------------------------
class removeOb extends MovieClip {
private var _myD:Number, _myN:Number, _myPath:String, _myPath2, _mytype:String, t_mc:MovieClip, _myObName:String;
function removeOb(Ob) {
}
public function remove(Ob:Object) {
getMyN(Ob);
getMyPath(Ob);
_myPath2 = eval(_myPath);
_myD = _root[_myPath2].getNextHighestDepth();
_myD == 0 ? +1 : +0;
switch (_myN) {
case 0 :
Ob.swapDepths(_myD);
Ob.removeMovieClip();
case 1 :
t_mc = _root[_myPath2].createEmptyMovieClip("solventsky", Ob.getDepth());
t_mc.removeMovieClip();
trace(t_mc);
}
}
private function getMyN(Ob) {
_mytype = typeof (Ob);
if (_mytype == "movieclip") {
//说明是 mc
_myN = 0;
trace(_myN);
} else if (_mytype == "object") {
//说明是Button or 动态文本
_myN = 1;
}
return _myN;
}
private function getMyPath(Ob:Object) {
_myPath = String(eval(Ob));
_myObName = Ob._name;
_myPath = _myPath.slice(0, _myPath.indexOf(_myObName, -1)-1);
return _myPath;
}
}
回复Comments
作者:
{commentrecontent}