actionscript-3 - AS3 跟踪位图为 "[object Shape]"/错误或功能,正在运行

标签 actionscript-3 flash

我需要在影片剪辑中的对象上使用 GetPixel32。

为了到达那个对象,我使用:

var bitmap=clip.getChildAt(0);
//and then 
bitmap.bitmapData.getPixel32(x, y);

但是,即使 childobject 是 png,我也会收到错误并使用
trace(clip.getChildAt(0));

痕迹“[物体形状]”

Flash 会将某些位图转换为形状吗?

请参阅此 fla ( http://www.sendspace.com/file/uycmm5 ) 自己进行测试。

有任何想法吗?

最佳答案

放置在 Flash 时间轴中的位图在编译时转换为形状(使用位图填充),
( 更新 )
除非库中的图像具有链接名称,在这种情况下,它会按预期工作并编译为 Bitmap 对象。

但是,您可以绘制具有该形状的新位图:

var shape:DisplayObject = clip.getChildAt(0);
var bmp:BitmapData = new BitmapData(shape.width, shape.height, true, 0);
bmp.draw(shape);
bmp.getPixel32(x, y);

关于actionscript-3 - AS3 跟踪位图为 "[object Shape]"/错误或功能,正在运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10235783/

相关文章:

Flash 时间线声音在导航离开时不会停止

flash - SWFUpload 在上传时过早关闭连接 (nginx 499)

Flash 10 3D 使文本模糊

apache-flex - 如何在 Flex 3 中在运行时确定函数的参数计数?

actionscript-3 - 在 as3 中播放连续的 wav 声音

javascript - 外部接口(interface)错误

actionscript-3 - Adobe Flash Player 设置不可点击

javascript - this.focus() 在 Firefox 中无法正常工作

html - Webkit 中关于滚动、固定定位 div 和 flash 的问题

apache-flex - 柔性 : passing parameters to custom components