5 Replies Latest reply on May 2, 2007 11:33 AM by Newsgroup_User

    Calling Flash from Director

    ajeet.ghule
      Hi Guys :-)

      I am calling a flash function call processExport from the diector application.
      This processExport function is in the fla file and is under layer ImportExport which contains anothe layer called Export.

      From Director when i import the swf file and call the processExport function it gives me error:Handler not found.

      I call the flash function like this :

      sprite("txtEdit").processExport()

      also i have teh swf fiel along with the fla file in application folder.

      One more strange thing...
      I have created another fla file and have written a function but it is not under any lyer and i am able to sucessfully call that function.
      Do i have to call it using the layer name from lingo??

      Please let me know asap as i am really stuck in this issue

      Thanks and Best Reagrds,
      Ajit



        • 1. Re: Calling Flash from Director
          Level 7
          You have to supply the complete path to the function that you want to
          call. It sounds like the function that you want, processExport() is
          located in a movieClip. To call that function from Director, you will
          need to use something like this:

          sprite("txtEdit").clipName.processExport()

          where you substitute the actual name of the movie clip instance.

          --
          Rob
          _______
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412-243-9119

          http://www.macromedia.com/software/trial/
          • 2. Re: Calling Flash from Director
            ajeet.ghule Level 1
            Thanks Rob :-)
            Actually i am new to flash and dont know what a movieclip is :(
            But one thing i am sure that there are various folders Like Actions,ImportExport,Initialization ets

            Here in my case i want to access the processExport function which in under the ImportExport folder aand again under that there a Layer called Export

            so do i have to give the sprite("txtEdit").ImportExport.Export.processExport()

            but thsi thing is also not working
            it is giving me error as property not found

            Please let me know some soln.
            • 3. Re: Calling Flash from Director
              Level 7
              Is this Flash movie something that you made? Or is it something that you
              have to work with? Actionscript functions are usually written to frames.
              It is possible to attach actionscript directly to movieClips, but that's
              not the norm.

              If you draw something directly to the stage in flash, or import a
              graphic, that will be a stage object and cannot be controlled using
              actionscript. If you click on something on the Flash stage, the property
              inspector window will tell you what it is. If you see the selected
              object is a shape, then that is a stage object and can't have code
              attached, nor can it be addressed by actionscript. If the property
              inspector tells you that the object that you selected is a movieClip or
              a button, then that is an object that can contain actionscript and can
              be addressed by actionscript. If you select an object on the stage and
              the property inspector shows that it is a movieClip or button, there is
              a space on the left of the property inspector where the object can be
              named. This is the instance name of that object. You use this instance
              name to address the movieClip.

              A movieClip object in Flash is essentially another Flash movie. You can
              click in to that movieClip and see that it contains it's own timeline.

              You can use the Movie Explorer window to help you to find actionscript
              in the Flash movie. This will help you to find the path to a function.

              --
              Rob
              _______
              Rob Dillon
              Adobe Community Expert
              http://www.ddg-designs.com
              412-243-9119

              http://www.macromedia.com/software/trial/
              • 4. Re: Calling Flash from Director
                ajeet.ghule Level 1
                Hi Rob :-)

                I am getting little bit.

                Actually they are the layers and each layer has a action scripts associated with it.
                and each layer has been given name.so suppose the name is "Export" and this Export layer contains a function namely "processExport"

                then it should be called from the Lingo

                sprite("txtedit").Export.processExport()

                am i right.

                But if my perception is right then also i am given error by the application as "Property Not Found for object"

                When i try to explore the Movie by using "Movie Explore" the path returned to me is

                Scene 1 -> Editor ->Frame 1 -> Text Editor component
                Please forgive me if i am wrong or really not understanding your explanation.

                Thanks and best regards
                • 5. Re: Calling Flash from Director
                  Level 7
                  If you have actionscript written to the first frame of a layer on the
                  main timeline, usually called "Scene 1", then you should be able to call
                  that function directly. The frame should have a lower case "a" in it and
                  an open circle. The "a" tells you that there is actionscript attached to
                  that frame, and the open circle indicates a key frame with no content.

                  This path, Scene 1 -> Editor ->Frame 1 -> Text Editor component, shows
                  that you have something called "Text Editor component" located in frame
                  1 of a layer titled "Editor". If you had an additional item in < >
                  brackets like this, then that would be the instance name of the
                  component.

                  What you really want to have is the path to the function, not to the
                  component. You do not want to include the name of the layer in the path
                  to the function. So if the layer "Export" is on the main timeline then
                  you should be able to call the function processExport() by using the
                  sprite reference and the function name.

                  Did you name the sprite? You are showing sprite("txtedit"). ... If this
                  is the name of the sprite then sprite("txtedit").processExport() should
                  be correct. If this is the name of the cast member and you haven't named
                  the sprite, then substitute the sprite channel number.

                  If you are calling the function as soon as you get to the sprite, then
                  the problem may be that the Flash movie is not yet ready to receive a
                  function call. You may need to wait a frame cycle or two before making
                  the function call.

                  --
                  Rob
                  _______
                  Rob Dillon
                  Adobe Community Expert
                  http://www.ddg-designs.com
                  412-243-9119

                  http://www.macromedia.com/software/trial/