3 Replies Latest reply on Aug 15, 2011 9:29 AM by Mike Blaustein

    call flash as3 function

    bluelemonade Level 1

      Hello,

       

      how can i call a function in an as3 movieclip?

       

      regards

        • 1. Re: call flash as3 function
          Mike Blaustein Level 4

          Before Director 11.5, you can not use AS3.  If you do have D11.5, you need to have the latest version (11.5.8) which you can get by going to Help, Update....

           

          Then you can call root-level scripts by calling the sprite.  So, if you have a AS3 flash sprite in channel 1, and in that file, there is a public function called doSomething, you can do this:

           

          sprite(1).doSomething()

           

          If you have a movieclip named "clip" which has a doSomething() function, you could do

           

          sprite(1).clip.doSomething()

          • 2. Re: call flash as3 function
            bluelemonade Level 1

            hello mike,

             

            my flash file has a document class DocClass. when i call sprite(flashSprite).DocClassName.myFunction i got an error. in the inspector i see "[type DocClassName$]" for sprite(flashSprite).DocClassName. when i press the + sign there is only a line with prototype [type object]

             

            I can't call a function or set value direct. the functions and the values are public!

             

            regards

            • 3. Re: call flash as3 function
              Mike Blaustein Level 4

              Hmm.  Not sure then. I don't use document classes, so they may act differently.  You could try to make a getter / setter function in the 1st frame of the flash movie, and call them from Director.  That is how I usually do it.