Hi,

Have a other question about calling functions.

Want to draw a line & arrow on the canvas.
functions of line() and arrow() works well. But didn't draw anything or
giving no errors.
Please tell me what's wrong.... 

thanks,

-----------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; >
<mx:Panel width="732" title="MyPanel" >
<mx:Canvas id ="mycanvas" width="715" height="408" backgroundColor="#CCCCFF" 
initialize="drawlines(event.target)"></mx:Canvas>
</mx:Panel>

<mx:Script>
    <![CDATA[
    function line(x1, y1, x2, y2)
        { 
        moveTo(x1, y1);
        lineTo(x2, y2);
        }
        
    function arrow(x1, y1, x2, y2, size, sharpness)
        {
        var w = x2 - x1;
        var h = y2 - y1;
        var l = Math.sqrt(w * w + h * h);
        w *= size / l;
        h *= size / l;
        var s = Math.sin(sharpness);
        var c = Math.cos(sharpness);
        line(x1, y1, x2, y2);
        line(x2, y2, x2 - w * c - s * h, y2 + w * s - h * c);
        line(x2, y2, x2 - w * c + s * h, y2 - w * s - h * c);
        }

    function drawlines(target) 
        {
       var lines = target.createEmptyMovieClip("line_mc", 1);
           with (lines)
                   {
                           lineStyle(1, 0x000000, 100);
                           line(145, 25,192, 88);
                           arrow(0, 0, 300, 300, 5, 0.4);
           }
   }
]]>
</mx:Script>
</mx:Application>
--------------------------------------------------------------------------


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/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