获取影片剪辑的颜色点击ActionScipt 3.0 [英] Get Color of movie clip clicked ActionScipt 3.0

查看:256
本文介绍了获取影片剪辑的颜色点击ActionScipt 3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这是点击的影片剪辑的hexColor。我的影片剪辑是一个红色的圆圈纯色。于是就点击红圈的,它应该返回我为0xFF0000。我用的是下面的,但我没有得到期望的结果。它只返回我0。

I want the hexColor of the movieclip which is clicked. My movieclip is a red circle with solid color. So on click of the red circle, it should return me 0xff0000. I use the following but I do not get the desired result. It only returns me 0.

trace(redcircle.transform.colorTransform.color.toString(16));

我在哪里的问题呢?请支持你的答案用一张code。

Where am i going wrong? Please support your answer with a piece of code.

推荐答案

您也可以使用<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#getPixel()"相对=nofollow> BitmapData.getPixel() 让你的影片剪辑的颜色:

You can also use a BitmapData.getPixel() to get the color of your MovieClip :

var bmpd:BitmapData = new BitmapData(mc.width, mc.height);
    bmpd.draw(mc);

// supposed that your circle is at (0, 0)
var color:uint = bmpd.getPixel(mc.width/2, mc.height/2);

trace(color.toString(16));  // gives : ff0000

希望能有所帮助。

Hope that can help.

这篇关于获取影片剪辑的颜色点击ActionScipt 3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆