Nice.
To add on to Jim's post, for some flexibility you might add some
rotation too and just call the function drawArrow:
function drawArrow (target_mc:MovieClip, color:Number, width:Number,
height:Number, rotation:Number) {
var size:Number = Math.round((width / 2) - 2);
var startY:Number = Math.round((height / 2) - (size / 2));
var startX:Number = Math.round((width / 2) - (size / 2));
target_mc.lineStyle(0, color, 100);
target_mc.moveTo(startX, startY+1);
target_mc.beginFill(color);
target_mc.lineTo(Math.round(startX + (size / 2)), (size + startY
- 1));
target_mc.lineTo((size + startX), startY);
target_mc.lineTo(startX, startY);
target_mc.endFill();
target_mc._rotation = rotation;
}
Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Palmer, Jim
>>Sent: Wednesday, August 16, 2006 1:16 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] need help in drawing arrow
>>
>>function _drawDownArrow (target:MovieClip, Color:Number,
aWdith:Number,
>>aHeight:Number) {
>> var size:Number = Math.round((aWdith / 2) - 2);
>> target.lineStyle(0, Color, 100);
>> var startY = Math.round((aHeight / 2) - (size / 2));
>> var startX = Math.round((aWdith / 2) - (size / 2));
>> target.moveTo(startX, startY+1);
>> target.beginFill(Color);
>> target.lineTo(Math.round(startX + (size / 2)), (size + startY -
1));
>> target.lineTo((size + startX), startY);
>> target.lineTo(startX, startY);
>> target.endFill();
>>}
>>
>>var _testArrow = createEmptyMovieClip("_testArrow",
getNextHighestDepth());
>>_drawDownArrow(_testArrow, 0x000000, 20, 20);
>>
>>/*
>>just drop this into the actionscript for frame 1 on an empty movieclip
and you'll
>>see the arrow
>>it's a padded arrow - specifically padded for use in my button
component - but
>>should be easy to modify
>>*/
>>--
>>Jim Palmer ! Mammoth Web Operations
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com