3 Replies Latest reply on Sep 18, 2009 1:26 AM by shintashi

    is there an opposite to #include ?

    shintashi Level 1

      Question 1:

      Suppose I want to use #include "myfile.as, but with certain buttons or movieclips active, it becomes redundant or obsolete, or would interfere.

      Is there a way to "disinclude" that actionscript file once it's been added?


      Alternatively, are there tricks like "if(condition==true){#include "myfile.as"} ?



      Question 2:

      when loading text through loadvars, is there a way to clear what was loaded, or do I need to create a "blank" text file to load  and clear the screen?

        • 1. Re: is there an opposite to #include ?
          kglad Adobe Community Professional & MVP

          1.  no


          2.  you can't change what was loaded but you can delete or reassign the variable that originally stored your loadvars value.

          1 person found this helpful
          • 2. Re: About Reassigning Variables?
            shintashi Level 1

            In regard to Question 2:  "but you can delete or reassign the variable that originally stored your loadvars value"


            So this is basically what I was trying to do,

            --------------------------- CODE FOLLOWS -----------------------------


            htmlExpress = function(asFile, textFile){
            asFile = new LoadVars();
            asFile.onLoad = function(){
               myText_txt.htmlText = this.content;
            function react(menu_item, asFile, textFile){   
                onMouseDown = function(){
                if(menu_item.hitTest(_root._xmouse, _root._ymouse, true)){htmlExpress(asFile, textFile);};}
            //htmlExpress(myData, "ghost.txt");   
            onEnterFrame = function(){



            react(pl.A2.s1, myData, "web.txt");
            react(pl.A2.s2, myData, "ghost.txt");
            react(pl.A2.s3, myData, "max.txt");


            --------------------------- END CODE  -----------------------------

            in a nutshell, I push a button and a textfield loads the data of a textfile (with modest html tags like hyperlinks and italic text).

            If I push another button I was hoping it would change the textfield content to the new textfile, such as switching from web.txt to ghost.txt


            but that's not what happened. Instead, the react(blahblah.myData,"blah.txt"); that is closest to the bottom is the one that works. So if I had 27 of these buttons, #27 would work and the first 26 would not.



            • 3. Re: is there an opposite to #include ?
              shintashi Level 1

              managed to refine it somewhat:



              function react(menu_item, textFile){   
                      if(menu_item.hitTest(_root._xmouse, _root._ymouse, true)){
                          onMouseDown = function(){
                      asFile = new LoadVars();
              asFile.onLoad = function(){myText_txt.htmlText = this.content;}


              onEnterFrame = function(){

              react(pl.A2.s3, "web.txt");
              react(pl.A2.s1, "ghost.txt");





              But it's got a weird glitch where it sometimes loads the text file because of the mousedown.

              I do not know how to tell it to stop detecting the mouse when the hitTest is false. I thought it would figure that out

              on it's own but clearly I was wrong.