function onDragStart(event){
this.data = event.data;
var dianjix = this.data.global.x;
var dianjiy = this.data.global.y;
console.log('dianjix:'+dianjix);
console.log('dianjiy:'+dianjiy);
var appAllChildren = app.stage.children
var acNum = appAllChildren.length
for (var i = 0; i < acNum; i++) {
if(appAllChildren[i].isSprite){
var baoweihe=appAllChildren[i].getBounds();
console.log(baoweihe);
var isdianji = isCollsion(dianjix, dianjiy, baoweihe.x, baoweihe.y, baoweihe.width, baoweihe.height);
if(isdianji){
//获取点击的像素是不是透明的
var touchinx=parseInt(dianjix-baoweihe.x);
var touchiny=parseInt(dianjiy-baoweihe.y);
var xiangsucount=(touchinx+1)*(touchiny+1);
//注意这个输出的像素是按照原来图片本身的大小来的
var ss=app.renderer.extract.pixels(appAllChildren[i]);
console.log(ss);
var xiangsuindex=(xiangsucount-1)*4+3;
// var xiangsutouming=ss[xiangsutouming];
// alert(xiangsutouming);
}
}
}
}
ps:
app.renderer.extract.pixels 这个参数 一定要写画布 或者精灵渲染的画布(离屏渲染)