I'm sort of new to Flash. I understand it's nearly obsolete, but the project I'm working on is written in Flash.
My current task is to obtain RGB data from any pixel in a .jpg file. I have done the following so far:
I have saved the image as a .fla file, and converted the image itself into its own custom class, called "StageWheel", with BitmapData as its base class. However, when I do this:
var sWheel:StageWheel = new StageWheel();
addChild(sWheel);
sWheel.addEventListener(MouseEvent.CLICK, getColorSample);
var bitmapWheel:BitmapData = new BitmapData(sWheel.width, sWheel.height);
I get an error:
"Implicit coercion of a value of type StageWheel to an unrelated type flash.display.DisplayObject"
on the line with
addChild(sWheel);
What does this error mean? Can I not use addChild to add things to the stage this way?
EDIT
That worked @LDMS, thank you. I am now trying to do this later on:
var rgb:uint = bitMapWheel.getPixel(sWheel.mouseX,sWheel.mouseY);
and get an error
"1061: Call to a possibly undefined method getPixel through a reference with static type flash.display:Bitmap."
What does this mean? Can I not use getPixel on a Bitmap? Sorry for the newbiness, for some reason Flash is extremely difficult for me to learn.
bitmapWheel
var, you are just creating a new empty BitmapData that matches the width and height or your sWheel bitmap data. yoursWheel
instance is already BitmapData, you don't need to create another bitmap data var. – BadFeelingAboutThisbitmapWheel
(eg. uppercase M sometimes). – BadFeelingAboutThis