开发者

Flash, AS3 drag movieclip based on full size, not what's inside

First post here, I have tried searching but couldn't find what I'm looking 开发者_StackOverflow中文版for but most people seem to get the answers they're after!

I'm working on some draggable/droppable functionality in flash as3, but the issue I have at the moment, is that I can only drag on what's inside the draggable movieclip, not the whole of the movieclip itself. For instance, say I have a stick man, I can only drag him if I select the lines, not the whole size of the movieclip

i.e if the arms extend outwards by x amount I should be able to click upto x width, down by the legs on whitespace (within the confines of the movie clip bounding box) and still be able to drag.

Is this possible?

Many Thanks


You could add a Shape inside the movieclip with alpha=0 for the area you want to be clickable as well.

If mc is your movieclip and you want a rectangular clickable area and your stickman is not to the left of x= 0 and not furhter up than y=0:

var shape : Shape = new Shape();
shape.graphics.beginFill(0x000000,0);
shape.graphics.drawRect(0, 0, mc.width, mc.height);
mc.addChild(shape);

If you are using the flash IDE you can alwo just draw any kind of graphic within the movie clip with a colour with alpha value of 0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜