![]() |
masking on 3 differents compoents with single image
Hi Friends,
I created three shapes. in that shapes i am loading an image.now i want to apply mask to the image which is loaded in the three different shapes.i want to display shape area as mask. below i am sending code also what i am trying do please help me its very urjent. public function thribleSlipt():void{ this.container. removeAllChildren(); if(isCropped){ draggableImg.addChild(cropImag); //draggableImg.source =cropImag; }else{ draggableImg.addChild(ldr); //draggableImg.source = ldr; } square = new Sprite(); hline = new Sprite(); square1 = new Sprite(); square2 = new Sprite() hline1 = new Sprite(); hline2 = new Sprite(); elementmask = new Image(); elementmask.x = 0; elementmask1 = new Image(); elementmask1.x = 193; elementmask2 = new Image(); elementmask2.x = 386; square.graphics.beginFill(0xFFFFFF,0.4); square.graphics.moveTo(22,21); square.graphics.lineTo(22,15); square.graphics.lineTo(22,446); square.graphics.lineTo(0,424); square.graphics.lineTo(0,0); square.graphics.endFill(); square.x=147; square.y=0; square1.graphics.beginFill(0xFFFFFF,0.4); square1.graphics.moveTo(22,21); square1.graphics.lineTo(22,15); square1.graphics.lineTo(22,446); square1.graphics.lineTo(0,424); square1.graphics.lineTo(0,0); square1.graphics.endFill(); square1.x=147; square1.y=0; square2.graphics.beginFill(0xFFFFFF,0.4); square2.graphics.moveTo(22,21); square2.graphics.lineTo(22,15); square2.graphics.lineTo(22,446); square2.graphics.lineTo(0,424); square2.graphics.lineTo(0,0); square2.graphics.endFill(); square2.x=147; square2.y=0; hline.graphics.beginFill(0x000000,0.4); hline.graphics.moveTo(147,0); hline.graphics.lineTo(170,23); hline.graphics.lineTo(152,23); hline.graphics.lineTo(15,23); hline.graphics.lineTo(0,0); hline.graphics.endFill(); hline.x=0; hline.y=423; hline1.graphics.beginFill(0x000000,0.4); hline1.graphics.moveTo(147,0); hline1.graphics.lineTo(170,23); hline1.graphics.lineTo(152,23); hline1.graphics.lineTo(15,23); hline1.graphics.lineTo(0,0); hline1.graphics.endFill(); hline1.x=0; hline1.y=423; hline2.graphics.beginFill(0x000000,0.4); hline2.graphics.moveTo(147,0); hline2.graphics.lineTo(170,23); hline2.graphics.lineTo(152,23); hline2.graphics.lineTo(15,23); hline2.graphics.lineTo(0,0); hline2.graphics.endFill(); hline2.x=0; hline2.y=423; spMask = new Shape(); spMask.graphics.beginFill(0xDDDDDD); spMask.graphics.moveTo(149,0); spMask.graphics.lineTo(169,20); spMask.graphics.lineTo(169,445); spMask.graphics.lineTo(14,445); spMask.graphics.lineTo(0,425); spMask.graphics.lineTo(0,0); spMask.graphics.endFill(); spMask.x=0; spMask.y=0; spMask1 = new Shape(); spMask1.graphics.beginFill(0xDDDDDD); spMask1.graphics.moveTo(149,0); spMask1.graphics.lineTo(169,20); spMask1.graphics.lineTo(169,445); spMask1.graphics.lineTo(14,445); spMask1.graphics.lineTo(0,425); spMask1.graphics.lineTo(0,0); spMask1.graphics.endFill(); spMask1.x=0; spMask1.y=0; spMask2 = new Shape(); spMask2.graphics.beginFill(0xDDDDDD); spMask2.graphics.moveTo(149,0); spMask2.graphics.lineTo(169,20); spMask2.graphics.lineTo(169,445); spMask2.graphics.lineTo(14,445); spMask2.graphics.lineTo(0,425); spMask2.graphics.lineTo(0,0); spMask2.graphics.endFill(); spMask2.x=0; spMask2.y=0; elementmask.addChild(draggableImg); elementmask.addChild(spMask); elementmask.addChild(square); elementmask.addChild(hline); draggableImg.mask = spMask this.container.addChild(elementmask); elementmask1.addChild(draggableImg); elementmask1.addChild(spMask1); elementmask1.addChild(square1); elementmask1.addChild(hline1); draggableImg.mask =spMask1; this.container.addChild(elementmask1); elementmask2.addChild(draggableImg); elementmask2.addChild(spMask2); elementmask2.addChild(square2); elementmask2.addChild(hline2); draggableImg.mask =spMask2 this.container.addChild(elementmask2); croppedImg.visible = false; } Thanks in Advance |
| All times are GMT +1. The time now is 12:13 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.