没有press和release事件
hitTest()被分尸了
var check_mc=new Sprite()
this.addChild(check_mc)
//
check_mc.addEventListener(Event.ENTER_FRAME,checkFunc)
function checkFunc(evt:Event){
//检测对象
/*
if(mc1.hitTestObject(mc2)){
trace("true")
}
*/
//检测坐标
if(mc1.hitTestPoint(this.mouseX,this.mouseY,false)){
trace("true")
}
}
addList(mc1)
addList(mc2)
//增加事件侦听器
function addList(mc){
mc.addEventListener("mouseDown",drag)
mc.addEventListener("mouseUp",drag)
}
//拖动
function drag(evt:MouseEvent){
var obj=evt.target
var evtType=evt.type
switch(evtType){
case "mouseDown":
obj.startDrag()
break
case "mouseUp":
obj.stopDrag()
break
}
}
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/1792.html
hitTest()被分尸了
var check_mc=new Sprite()
this.addChild(check_mc)
//
check_mc.addEventListener(Event.ENTER_FRAME,checkFunc)
function checkFunc(evt:Event){
//检测对象
/*
if(mc1.hitTestObject(mc2)){
trace("true")
}
*/
//检测坐标
if(mc1.hitTestPoint(this.mouseX,this.mouseY,false)){
trace("true")
}
}
addList(mc1)
addList(mc2)
//增加事件侦听器
function addList(mc){
mc.addEventListener("mouseDown",drag)
mc.addEventListener("mouseUp",drag)
}
//拖动
function drag(evt:MouseEvent){
var obj=evt.target
var evtType=evt.type
switch(evtType){
case "mouseDown":
obj.startDrag()
break
case "mouseUp":
obj.stopDrag()
break
}
}
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/1792.html