Re: [flexcoders] Calling functions with optional parameters
Amy (usually) all programming languages that support something similar support it from right to left, not with empty 'params'... theFunction() or theFunction(3) or theFunction(4,5) should work... i do not have access to the compiler at the moment thought, so i have not checked On Fri, Nov 14, 2008 at 11:12 PM, Amy [EMAIL PROTECTED] wrote: I thought that when you have a function that looks like this: private function theFunction(param1:int=0, param2:int=1, param3:String='foo') { //do stuff } That it's ok to call the function like this: theFunction(,,'bar'); But when I do this, I'm getting all sorts of syntax errors, including Expecting identifier before comma. Am I misunderstanding how this works? Will I have to use ...rest and give up my typed arguments and named variables? Thanks; Amy -- Fotis Chatzinikos, Ph.D. Founder, Phinnovation [EMAIL PROTECTED],
Re: [flexcoders] Calling functions with optional parameters
Amy, Fotis is right--if you want to specify a param that has a default, you need to specify all parameters to the left of it in the argument list. Depending on your function and how many parameters it has, you may want to add a class to represent your function arguments, construct that object independently, and pass that to your function. E.g., var args:FunctionArgs = new FunctionArgs(); args.foo = 123; args.bar = baz; theFunction(args); This doesn't always make sense, but it can help. -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com -Original Message- From: Amy [EMAIL PROTECTED] Reply-To: flexcoders@yahoogroups.com To: flexcoders@yahoogroups.com Subject: [flexcoders] Calling functions with optional parameters Date: Fri, 14 Nov 2008 21:12:16 - I thought that when you have a function that looks like this: private function theFunction(param1:int=0, param2:int=1, param3:String='foo') { //do stuff } That it's ok to call the function like this: theFunction(,,'bar'); But when I do this, I'm getting all sorts of syntax errors, including Expecting identifier before comma. Am I misunderstanding how this works? Will I have to use ...rest and give up my typed arguments and named variables? Thanks; Amy
RE: [flexcoders] Calling functions with optional parameters
What if you explicitly passed null? theFunction(null,null,'bar'); Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Amy Sent: Friday, November 14, 2008 4:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Calling functions with optional parameters I thought that when you have a function that looks like this: private function theFunction(param1:int=0, param2:int=1, param3:String='foo') { //do stuff } That it's ok to call the function like this: theFunction(,,'bar'); But when I do this, I'm getting all sorts of syntax errors, including Expecting identifier before comma. Am I misunderstanding how this works? Will I have to use ...rest and give up my typed arguments and named variables? Thanks; Amy
Re: [flexcoders] Calling functions on loaded SWF
Hi Tom, Here is an example of Play() etc... http://www.bridel.org/?p=9 Hilary www.bridel.org On 9/24/06, Tom Krcha [EMAIL PROTECTED] wrote: Hi, Does anybody know how to call functions on loaded SWF? E.g.: I create my own animation in Flash IDE. Then I load this swf with the animation into the flex swf using SWFLoader or Image. How to call on that swf functions like play(), gotoAndPlay(), stop() … or my defined functions. Thanks Tom -- Hilary-- __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
Re: [flexcoders] Calling functions from an itemRenderer
Rick- Whenever you declare a method such as click="someMethod()"...you cannot have double quotes between the wrapping double-quotes of the click. The compiler always assumes the second quote is the end of the method name. If you changed your code to -- click="callMethod()" and then above it within a mx:Script tag hadprivate function callMethod() : void { navigateToURL(new URLRequest("_javascript_:popup_ultraslim('/tools/entityLookup3/entity_details.cfm?ENTITYID=" + this.label + "',750,550)"), '_self'); }Then it work. Your LinkButton example does not have a double quote b/w the quotes around the click method. I'm guessing you don't have a function named "launchDetailsWindow()" defined which is causing your compiler error.Rick Root [EMAIL PROTECTED] wrote: I've got an itemRenderer in a datagrid that's rendering a linkbutton with a script.The following doesn't work because it's not valid XML, with the " symbols in the click value...mx:DataGridColumn headerText="Entity ID" width="100" dataField="ENTITYID"mx:itemRenderermx:Componentmx:LinkButton label="{data.ENTITYID}" click="navigateToURL(new URLRequest("_javascript_:popup_ultraslim('/tools/entityLookup3/entity_details.cfm?ENTITYID=" + this.label + "',750,550)"), '_self');"//mx:Component/mx:itemRenderer/mx:DataGridColumnI originally had a function defined in the same file that did that and I called like like this:mx:LinkButton label="{data.ENTITYID}" click="launchDetailsWindow(this.label);"/But it kept telling me that launchDetailsWindow was a "possibly undefined function", leading me to believe that I don't understand scoping in itemrenders :)Rick Stay in the know. Pulse on the new Yahoo.com. Check it out. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Calling functions from an itemRenderer
Rick,Have a look at the ExternalInterface functionality to call a _javascript_ function which resides in your HTML page which will satisfy your popup requirements...Brendan On 8/14/06, Rick Root [EMAIL PROTECTED] wrote: I've got an itemRenderer in a datagrid that's rendering a linkbutton with a script. The following doesn't work because it's not valid XML, with the symbols in the click value... mx:DataGridColumn headerText=Entity ID width=100 dataField=ENTITYID mx:itemRenderer mx:Component mx:LinkButton label={data.ENTITYID} click=navigateToURL(new URLRequest(_javascript_:popup_ultraslim('/tools/entityLookup3/entity_details.cfm?ENTITYID= + this.label + ',750,550)), '_self');/ /mx:Component /mx:itemRenderer /mx:DataGridColumn I originally had a function defined in the same file that did that and I called like like this: mx:LinkButton label={data.ENTITYID} click=launchDetailsWindow(this.label);/ But it kept telling me that launchDetailsWindow was a possibly undefined function, leading me to believe that I don't understand scoping in itemrenders :) Rick __._,_.___ -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Calling functions from an itemRenderer
extract the URLRequest() call to a AS method. make sure your mx:script block has the CDATA schtuffs.DKOn 8/14/06, Rick Root [EMAIL PROTECTED] wrote:I've got an itemRenderer in a datagrid that's rendering a linkbutton with a script.The following doesn't work because it's not valid XML, with the symbols in the click value...mx:DataGridColumn headerText=Entity ID width=100 dataField=ENTITYID mx:itemRenderermx:Componentmx:LinkButton label={data.ENTITYID} click=navigateToURL(newURLRequest(_javascript_:popup_ultraslim('/tools/entityLookup3/entity_details.cfm?ENTITYID= + this.label + ',750,550)), '_self');//mx:Component/mx:itemRenderer/mx:DataGridColumnI originally had a function defined in the same file that did that and I called like like this:mx:LinkButton label={data.ENTITYID}click=launchDetailsWindow(this.label);/But it kept telling me that launchDetailsWindow was a possibly undefined function, leading me to believe that I don't understandscoping in itemrenders :)Rick--Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/ -- Douglas Knudsenhttp://www.cubicleman.comthis is my signature, like it? __._,_.___ -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Calling functions from an itemRenderer
Douglas Knudsen wrote: extract the URLRequest() call to a AS method. make sure your mx:script block has the CDATA schtuffs. This is what I had done, as mentioned here: I originally had a function defined in the same file that did that and I called like like this: mx:LinkButton label={data.ENTITYID} click=launchDetailsWindow(this.label);/ But it kept telling me that launchDetailsWindow was a possibly undefined function, leading me to believe that I don't understand scoping in itemrenders :) I had also tried Application.application.launchDetailsWindow(this.label); which also didn't work. so I just added mx.core. to the front of it and it's good now. Rick -- 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/
Re: [flexcoders] Calling functions
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=#FF 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, 0xff, 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 drawlinesArrows(). 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=#FF 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) { . } function drawlinesArrows(target) { var lines = target.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(1, 0xff, 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=-1a href=http://us.ard.yahoo.com/SIG=12h2vss9g/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124795292/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOOcmpgn=GRPRTP=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/
Re: [flexcoders] Calling functions
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=#FF 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, 0xff, 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=#FF 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, 0xff, 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 drawlinesArrows(). 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=#FF initialize=drawlinesArrows(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 drawlinesArrows(target) { var lines = target.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(1, 0xff, 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=-1a 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=YAHOOcmpgn=GRPRTP=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/
RE: [flexcoders] Calling functions
Prasad, What I may say about your code : - the function line contains moveTo that you call each time you call the method line(). It's not a good practise. moveTo is use at the beginning to set the first x,y coordinates, then you use lineTo to draw the shape you want. - arrow seems to be a reserved name - you must createEmptyMovieClip into a control otherwise your Movieclip is overrided by the application I hope that it will help you! David function fArrow(x1:Number, y1:Number, x2:Number, y2:Number, size:Number, sharpness:Number, obj:Object):Void{var lines:MovieClip = new MovieClip();lines = obj.createEmptyMovieClip("line_mc", -1);var w:Number = x2 - x1;var h:Number = y2 - y1;var l:Number = Math.sqrt(w * w + h * h);// Alert.show("w : " + w + " h : " + h + "l : " + l, "__Message__", Alert.OK);// helpful for debugging, don't forget to import the concerned class;w *= size / l;h *= size / l;var s:Number = Math.sin(sharpness);var c:Number = Math.cos(sharpness); with (lines) {lineStyle(1, 0x99, 100);moveTo(x1, y1);lineTo(x2, y2);lineTo(x2 - w * c - s * h, y2 + w * s - h * c);lineTo(x2 - w * c + s * h, y2 - w * s - h * c);endFill();}} function drawlines( event:Object):Void { fArrow(145, 25, 192, 88, 10, 0.4, event.target);} De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de Prasad DhananjayaEnvoyé: mardi 23 août 2005 11:53À: flexcoders@yahoogroups.comObjet: Re: [flexcoders] Calling functions 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="#FF" initialize="drawlines(event.target)" /mx:Canvas/mx:Panelmx: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, 0xff, 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="#FF" 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, 0xff, 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 "drawlinesArrows()". 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="#FF" initialize="drawlinesArrows(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 drawlinesArrows(target)
Re: [flexcoders] Calling functions
Actually it call's functions line() and arrow(), but you forgot to mention where application should draw line!! function line(x1, y1, x2, y2) { moveTo(x1, y1); lineTo(x2, y2); } it should look like movie_clip.moveTo(x1,y1); movie_clip.lineTo(x1,y1); You need to send additional parameter to line function that contain movieclip where you want to draw that line! Best regards Stanislav Zayarsky On 8/23/05, david_gal-reyniez [EMAIL PROTECTED] wrote: Prasad, What I may say about your code : - the function line contains moveTo that you call each time you call the method line(). It's not a good practise. moveTo is use at the beginning to set the first x,y coordinates, then you use lineTo to draw the shape you want. - arrow seems to be a reserved name - you must createEmptyMovieClip into a control otherwise your Movieclip is overrided by the application I hope that it will help you! David function fArrow(x1:Number, y1:Number, x2:Number, y2:Number, size:Number, sharpness:Number, obj:Object):Void { var lines:MovieClip = new MovieClip(); lines = obj.createEmptyMovieClip(line_mc, -1); var w:Number = x2 - x1; var h:Number = y2 - y1; var l:Number = Math.sqrt(w * w + h * h); // Alert.show(w : + w + h : + h + l : + l, __Message__, Alert.OK);// helpful for debugging, don't forget to import the concerned class; w *= size / l; h *= size / l; var s:Number = Math.sin(sharpness); var c:Number = Math.cos(sharpness); with (lines) { lineStyle(1, 0x99, 100); moveTo(x1, y1); lineTo(x2, y2); lineTo(x2 - w * c - s * h, y2 + w * s - h * c); lineTo(x2 - w * c + s * h, y2 - w * s - h * c); endFill(); } } function drawlines( event:Object):Void { fArrow(145, 25, 192, 88, 10, 0.4, event.target); } De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de Prasad Dhananjaya Envoyé : mardi 23 août 2005 11:53 À : flexcoders@yahoogroups.com Objet : Re: [flexcoders] Calling functions 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=#FF 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, 0xff, 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=#FF 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, 0xff, 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 drawlinesArrows(). I tried sevaral ways. But failed. Can someone tell me how to do this? Best Regards, Prasad (Absolute beginner of Flex ActionScript