Hi, Thank you very much for the reply. I tried it. But still not working.(Didn't call "line()" and "arrow()" functions) Any other errors?
Best Regards, Prasad ---------------------------------------------------------------- <?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, 0xff0000, 100); line(145, 25,192, 88); arrow(100, 100, 300, 300, 10, 0.4); } } ]]> </mx:Script> </mx:Application> ---------------------------------------------------------------------------- > Hello, > > You had several errors in your script, try this variant: > > > <?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) > { > trace("func line"); > } > > function arrow(x1, y1, x2, y2, size) > { > trace("func arrow"); > } > > function drawlines(target) > { > var lines = target.createEmptyMovieClip("line_mc", 1); > with (lines) > { > lineStyle(1, 0xff0000, 100); > line(145, 25,192, 88); > arrow(100, 100, 300, 300, 10, 0.4); > } > } > ]]> > </mx:Script> > </mx:Application> > > Best regards > Stanislav > > On 8/23/05, Prasad Dhananjaya <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > I have a small question. > > I want to call function "line()" and function "arrow()" from > > function "drawlines&Arrows()". I tried sevaral ways. But failed. > > Can someone tell me how to do this? > > > > Best Regards, > > Prasad > > (Absolute beginner of Flex & ActionScript) > > > > > > ---------------------------------------------------------------------------- > > <?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&Arrows(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) { ..... } > > > > function drawlines&Arrows(target) { > > var lines = target.createEmptyMovieClip("line_mc", 1); > > with (lines) { > > lineStyle(1, 0xff0000, 100); > > //★below two lines are not working > > line(145, 25,192, 88); > > arrow(100, 100, 300, 300, 10, 0.4); > > } > > } > > ]]> > > </mx:Script> > > </mx:Application> > > > > > > > > > > -- > > 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 > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hfnekk3/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124798733/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!</a>.</font> --------------------------------------------------------------------~-> -- 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/