4 Replies Latest reply on Jun 6, 2008 9:10 AM by Newsgroup_User

    External ActionScript (k)

    Level 7
      I have an external ActionScript file that I call in using #include

      It works well, but I would like to have several different scripts called
      in. I know I can make multiple .as files and call each individually.
      That'll work, but is kinda messy.

      Is there a way I can call separate parts of one .as file? So I can
      include several actions in one .as file and only call specific action?

      -Kirk
        • 1. Re: External ActionScript (k)
          Level 7
          Anybody?



          W. Kirk Lutz wrote:
          > I have an external ActionScript file that I call in using #include
          >
          > It works well, but I would like to have several different scripts called
          > in. I know I can make multiple .as files and call each individually.
          > That'll work, but is kinda messy.
          >
          > Is there a way I can call separate parts of one .as file? So I can
          > include several actions in one .as file and only call specific action?
          >
          > -Kirk
          • 2. Re: External ActionScript (k)
            Bob Pierce Level 1
            If your .as file includes many functions you can call each one individually.
            • 3. Re: External ActionScript (k)
              Level 7
              Could you give an example of how I would write that syntax?

              I'm new to this, sorry.

              -Kirk



              Bob Pierce wrote:
              > If your .as file includes many functions you can call each one individually.
              • 4. Re: External ActionScript (k)
                Level 7
                Maybe this'll help:

                I did break the .as into two files, FadeIn.as and Fade.Out.as

                FadeIn.as is:



                // import tween classes
                import mx.transitions.Tween;
                import mx.transitions.easing.*;
                //
                var Animation:Object;
                //
                Animation = new Tween(this, "_alpha", Regular.easeInOut, 0, 100,
                _global.FadeInTime, true);




                Then on the MovieClips I put:



                onClipEvent (enterFrame) {
                //FadeIn ActionScript is stored in an external .as file
                #include "redheadActionScript/FadeIn.as"
                }



                Works on the first clip, but not the second. I think it is because the
                #include is supposed to be done once.

                So then I thought I could somehow store this code in a variable, but
                that didn't work.

                Then I tried to do a global function, but that didn't work because it
                didn't like me calling the mx.transitions.Tween twice

                So basically, I have no idea what I am doing.

                -Kirk


                W. Kirk Lutz wrote:
                > Could you give an example of how I would write that syntax?
                >
                > I'm new to this, sorry.
                >
                > -Kirk
                >
                >
                >
                > Bob Pierce wrote:
                >> If your .as file includes many functions you can call each one
                >> individually.