mhoard8110
asked on
Masking In Flex
I am trying to get an image to move behind a mask in flex. here is the code:
public function ImageOnStage(bmp:Bitmap)
{
super();
var myShape:Sprite = new Sprite();
myShape.graphics.lineStyle (1, 0x000000);
myShape.graphics.beginFill (0x0000ff) ;
myShape.graphics.lineTo(15 4.6862, 173.2246);
myShape.graphics.lineTo(18 3.2958, 171.4443);
myShape.graphics.lineTo(22 1.7057, 165.7216);
myShape.graphics.lineTo(25 4.3983, 156.2645);
myShape.graphics.lineTo(29 2.5086, 139.3242);
myShape.graphics.lineTo(31 5.4861, 127.1510);
myShape.graphics.lineTo(33 0.4385, 117.6560);
myShape.graphics.lineTo(34 4.3118, 107.2436);
myShape.graphics.lineTo(35 2.0309, 100.6078);
myShape.graphics.lineTo(36 1.9321, 91.2264);
myShape.graphics.lineTo(36 8.1939, 82.8642);
myShape.graphics.lineTo(37 2.3505, 74.1243);
myShape.graphics.lineTo(37 3.2142, 65.1147);
myShape.graphics.lineTo(37 2.7254, 57.5077);
myShape.graphics.lineTo(37 1.4799, 53.4322);
myShape.graphics.lineTo(36 8.1330, 47.0660);
myShape.graphics.lineTo(36 2.9509, 40.9697);
myShape.graphics.lineTo(35 5.6635, 36.1682);
myShape.graphics.lineTo(34 4.5973, 29.8022);
myShape.graphics.lineTo(33 5.2389, 25.6178);
myShape.graphics.lineTo(31 4.0247, 18.1188);
myShape.graphics.lineTo(29 1.2447, 12.0224);
myShape.graphics.lineTo(27 2.9992, 8.6236);
myShape.graphics.lineTo(26 4.2212, 7.1979);
myShape.graphics.lineTo(22 3.5897, 50.0132);
myShape.graphics.lineTo(19 6.6493, 79.1452);
myShape.graphics.lineTo(17 1.0339, 105.6289);
myShape.graphics.lineTo(14 4.9767, 130.7583);
myShape.graphics.lineTo(13 1.2858, 144.4715);
myShape.graphics.lineTo(11 3.1782, 159.9203);
myShape.graphics.lineTo(10 4.7869, 166.9825);
myShape.graphics.lineTo(10 3.5696, 167.9901);
myShape.graphics.lineTo(10 2.5271, 169.3665);
myShape.graphics.lineTo(10 2.4287, 170.2119);
myShape.graphics.lineTo(10 2.5271, 171.6275);
myShape.graphics.lineTo(10 2.9993, 172.1780);
myShape.graphics.lineTo(10 3.7862, 172.6499);
myShape.graphics.lineTo(10 5.8910, 173.0431);
myShape.graphics.lineTo(10 8.7240, 173.3774);
myShape.graphics.lineTo(15 4.6862, 173.2246);
this.addChild(myShape);
var bUtil:BitmapUtil =new BitmapUtil();
originalBitmap = bUtil.cloneBitmap(bmp);
this.bitmapImage = bmp;
bitmapImage.smoothing = true;
this.type = TYPE;
ImageOnStage.idCount++;
this.idImage = ImageOnStage.idCount+".png ";
image.mask = myShape;
image.startDrag();
}
The issue is the image.startDrag. It does not work. How do I make the image scroll behind the mask. I want the mask to remain fixed. Anyone?
public function ImageOnStage(bmp:Bitmap)
{
super();
var myShape:Sprite = new Sprite();
myShape.graphics.lineStyle
myShape.graphics.beginFill
myShape.graphics.lineTo(15
myShape.graphics.lineTo(18
myShape.graphics.lineTo(22
myShape.graphics.lineTo(25
myShape.graphics.lineTo(29
myShape.graphics.lineTo(31
myShape.graphics.lineTo(33
myShape.graphics.lineTo(34
myShape.graphics.lineTo(35
myShape.graphics.lineTo(36
myShape.graphics.lineTo(36
myShape.graphics.lineTo(37
myShape.graphics.lineTo(37
myShape.graphics.lineTo(37
myShape.graphics.lineTo(37
myShape.graphics.lineTo(36
myShape.graphics.lineTo(36
myShape.graphics.lineTo(35
myShape.graphics.lineTo(34
myShape.graphics.lineTo(33
myShape.graphics.lineTo(31
myShape.graphics.lineTo(29
myShape.graphics.lineTo(27
myShape.graphics.lineTo(26
myShape.graphics.lineTo(22
myShape.graphics.lineTo(19
myShape.graphics.lineTo(17
myShape.graphics.lineTo(14
myShape.graphics.lineTo(13
myShape.graphics.lineTo(11
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(10
myShape.graphics.lineTo(15
this.addChild(myShape);
var bUtil:BitmapUtil =new BitmapUtil();
originalBitmap = bUtil.cloneBitmap(bmp);
this.bitmapImage = bmp;
bitmapImage.smoothing = true;
this.type = TYPE;
ImageOnStage.idCount++;
this.idImage = ImageOnStage.idCount+".png
image.mask = myShape;
image.startDrag();
}
The issue is the image.startDrag. It does not work. How do I make the image scroll behind the mask. I want the mask to remain fixed. Anyone?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just a thought. If you have a mask that masks something behind it, you will not be able to click and drag the image behind it if you click on the masked area.