I must be missing something, but shouldn't arrow() return something as
a parameter for createChild?

--- In [email protected], "jrab2999" <[EMAIL PROTECTED]> wrote:
> Maybe canvas within a canvas will do the job:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; >
> <mx:Script>
> <![CDATA[
>       var isPointerStarted = false;
>       var bx:Number;
>       var by:Number;
> 
>       function pointerStart(target) {
>             if (isPointerStarted) return;
>                   isPointerStarted = true;
>                   bx = target.mouseX;
>                   by = target.mouseY;
>             }
> 
>       function pointerReleased(target) {
>             if (!isPointerStarted) return;
>                   target.lineStyle(2, 0x666666, 100);
>                               target.createChild(arrow(target));
>                   isPointerStarted = false;
>                   //drawing squre on the canves
>                   var ref_mc =
> outerCanves.createChild(mx.containers.Canvas,undefined,{width:1000});
>                   ref_mc.fillRect(900, 100, 910, 110, 0x000000, 30);
>             }
> 
>       function arrow(target) {
>             var w = target.mouseX - bx;
>             var h = target.mouseY - by;
>             var l = Math.sqrt(w * w + h * h);
>             var size=8;
>             var sharpness=0.5;
>             var s = Math.sin(sharpness);
>             var c = Math.cos(sharpness);
>             if(l>0){
>                   w *= size / l;
>                   h *= size / l;
>                   target.moveTo(bx,by);
>                   target.lineTo(target.mouseX, target.mouseY);
>                   target.lineTo(target.mouseX - w * c - s * h,
> target.mouseY + w * s - h * c);
>                   target.moveTo(target.mouseX, target.mouseY);
>                   target.lineTo(target.mouseX - w * c + s * h,
> target.mouseY - w * s - h * c);
>             }
>       }
> ]]>
> </mx:Script>
> 
> <mx:Canvas id="outerCanves" 
>       x="0" y="110"  width="100%" height="225" 
>       borderStyle="solid"
>     backgroundColor="#DEE0FE"
>     backgroundAlpha="0">
>    <mx:Canvas id="myCanves" 
>       x="0" y="0"  width="100%" height="225" 
>       borderStyle="none"
>       mouseUpSomewhere="pointerReleased(event.target)"
>       mouseDown="pointerStart(event.target)"
>     backgroundColor="#DEE0FE"
>     backgroundAlpha="0">
>       </mx:Canvas>
> </mx:Canvas>
> </mx:Application>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to