2 Replies Latest reply on Sep 3, 2009 9:37 AM by Flex harUI

    Calling a function inside a function

    tguy895 Level 1

      How does one do that? I am trying to call function 1 inside function 2. What is the corrct syntax?

        • 1. Re: Calling a function inside a function
          Gregory Lafrance Level 6

          If this post answers your question or helps, please mark it as such.

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:Script>
              <![CDATA[
                private function callFuncs():void{
                  one();
                }     
                private function one():void{
                  txt.text += "In function one()\n";
                  two();
                }
                private function two():void{
                  txt.text += "In function two()\n";
                  three();
                }
                private function three():void{
                  txt.text += "In function three()\n";
                }
              ]]>
            </mx:Script>
            <mx:Button label="Call Functions" click="callFuncs();"/>
            <mx:TextArea width="500" height="500" id="txt"/>
          </mx:Application>

          • 2. Re: Calling a function inside a function
            Flex harUI Adobe Employee

            Show us what you're latest attempt looks like.  Are these nested functions?  Where are you trying to call from?

             

            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui