When you put your mouse on the corner of an image, you can drag it and the image will be multiplied depending on how much you drag the mouse. Is it possible to do this through code? For example, I lay my mouse on the corner of a movieclip and see a square cursor next to my mouse. Now I drag and the image duplicates a bit. Like a perspective transform?
0
votes
Do you mean when you drag a file on your PC there is a ghosting effect where a transparent version of the icon is attached the cursor? Also you've tagged both AS2 and AS3 - which one are you intending to use?
- Marty
No, like when you put an image to the stage and press 'break apart' you can drag the corners and image will get not larger but will grow more of itself or you can hide part of it by dragging it in the direction in which you are grabbing it.
- user1888370
You mean you want to create a shape with ActionScript and fill it with an image so that it repeats?
- Marty
@Marty Wallace Kind of, when you drag a movieclip's corner you're doing a perspective transform in which the movieclip repeats as you drag, I'd like to do that in actionscript.
- user1888370
1 Answers
0
votes
You can use .beginBitmapFill()
Here's a demo:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ready);
loader.load( new URLRequest("http://www.gravatar.com/avatar/") );
function ready(e:Event):void
{
var shape:Shape = new Shape();
shape.x = shape.y = 50;
shape.graphics.beginBitmapFill((loader.content as Bitmap).bitmapData);
shape.graphics.lineTo(100, 0);
shape.graphics.lineTo(60, 120);
shape.graphics.lineTo(-30, 50);
shape.graphics.lineTo(0, 0);
shape.graphics.endFill();
addChild(shape);
}