Explanation:
I made a post a little while ago about potentially using getPixel to refine my hitTests; using different colors to garner different reactions from certain MC’s. So I started playing around with it, and drawing vectors as bitmaps, but I’ve now hit a snag.
I have this script located on ROOT:
[SIZE=1]
[g being the “ground” movieclip][/SIZE]
import flash.display.BitmapData;
var gBit:BitmapData = new BitmapData(_root.g._width,_root.g._height);
gBit.draw(_root.g);
And this script located on a section of the heros script:
[i being a loop I’m using for one of the heros functions]
_root.gPixelX = _root.hero._x-_root.g._x;
_root.gPixelY = (_root.hero._y+i)-_root.g._y;
trace("heros X pixel = "+_root.gPixelX);
trace("heros Y pixel = "+_root.gPixelY);
_root.gPixel = _root.gBit.getPixel(gPixelX,gPixelY).toString(16);
trace("Pixel Color = "+_root.gPixel);
I assumed this would work, but for some reason I cannot even trace my original bitmapData, “gBit”, and it just shows up as [object Object] in a trace.
**Question:
**
What am I doing wrong here? This is new territory for me and I don’t know much about it, so any help is very much appreciated.