33 Replies Latest reply on Jan 31, 2013 8:18 AM by kglad

    Referring to a function SWF Studio file save+open

    Reeece

      Hello, I am still a bit rusty on AS1 and I am working on an old project to get it up and running, (I am using SWF Studio v2.5 to create a full .exe file with linked files) I have got the project 95% functioning I am on the last bit which is:

       

      File save and load file buttons + functions. ( I have been playing around with these for the last 2-3 days and got it nearly functional)

       

      so far I have got the file browsing system working the title of the file browsing window, as well as a default file name and specific text only file type and all that good stuff working in both the save and the load button/functions. and the open file function also opens the text (name, title, notes) but not the positions (but ill get to that in time)

       

      I am currently trying to tackle the save file I am trying to link to a function on the main timeline which reads and saves the position of objects to a .txt document to the start directory along with a save animation.

       

      This is the last frame of the AS object called "OpenFileSave" - ssFileSave is the function which gathers the information inputted (filename, location etc.)

      onsaver is the function which read and writes(saves/creates) the file which is on the main timeline.

       

      This is either reaallllyy easy or a bit difficult either way, it currently does not work, and does not reach the stage of the function, although if i code gotoAndPlay the save button animation in this frame it works fine and dandy, trying to reach the onsaver function seems unreachable.

       

      if (_root.ssFileSave != "?") {

      root.filename = _root.ssFileSave;

      _root.onsaver(); 

      }

       

      The onsaver function looks a bit like this(without other code ive also tried):

      function onsaver(component) {

      //evaluate files and write the file to save

        ssReadFile = a1[0]+"="+eval(a1[0]) etc.

      fscommand("CLEAR");

      fscommand("ARG", filename);

      fscommand("ARG", ssReadFile);

      fscommand("FILESYS2.WRITEFILE");

      savedmovie.gotoAndPlay(2);

       

      I am using win 7, swf studio2.5 (I have also tried on v3.8 with even less sucess) and Flash CS5.

        • 1. Re: Referring to a function SWF Studio file save+open
          kglad Adobe Community Professional & MVP

          1.  you're not passing any parameter to onsaver (though from the code you showed you don't use the parameter lised in onsaver's definition).

          2.  it's far from clear what your fscommands will do (if anything).

          3.  use the trace function to debug actionscript:

           

           

          Reeece wrote:

           

          Hello, I am still a bit rusty on AS1 and I am working on an old project to get it up and running, (I am using SWF Studio v2.5 to create a full .exe file with linked files) I have got the project 95% functioning I am on the last bit which is:

           

          File save and load file buttons + functions. ( I have been playing around with these for the last 2-3 days and got it nearly functional)

          trace(_root.ssFileSave);

          if (_root.ssFileSave != "?") {

          root.filename = _root.ssFileSave;

          trace("call onsaver")

          _root.onsaver(); 

          }

           

          trace("onsaver defined")

          function onsaver(component) {

          trace("onsaver called")

          //evaluate files and write the file to save

            ssReadFile = a1[0]+"="+eval(a1[0]) etc.

          fscommand("CLEAR");

          fscommand("ARG", filename);

          fscommand("ARG", ssReadFile);

          fscommand("FILESYS2.WRITEFILE");

          savedmovie.gotoAndPlay(2);

           

          I am using win 7, swf studio2.5 (I have also tried on v3.8 with even less sucess) and Flash CS5.

          1 person found this helpful
          • 2. Re: Referring to a function SWF Studio file save+open
            Reeece Level 1

            Hi thanks for the reply,

             

            The problem is that I cannot use the debugging as I am using SWF studio and it doesnt get to the frame needed to even test the debug as it uses FileSys2 commands to gather the information via a file browsing open dialogue window, these commands only play in an .exe made from SWF Studio and they do not work in .swf files, and SWF v2.5 does not have a debugger either.

             

            What would you suggest to do from here - I guess I will try and move the code around just for testing purposes and then move it back when I know exactly what code I need.

             

            Thanks again hopfully I can make a bit more progress that bit quicker

            • 3. Re: Referring to a function SWF Studio file save+open
              kglad Adobe Community Professional & MVP

              use a third parth app like monster debugger so you can debug your app and see those trace statements or add a textfield to your app so you can see text output.

              1 person found this helpful
              • 4. Re: Referring to a function SWF Studio file save+open
                Reeece Level 1

                Alright great! will do thanks. glad I can still explore more options and progress forward

                • 6. Re: Referring to a function SWF Studio file save+open
                  Reeece Level 1

                  Sorry for being such a noob, but how can I use the textfield for debug, I have been googling it for a while and I can't find anything to use a text field as a debug output or anything :s

                  • 7. Re: Referring to a function SWF Studio file save+open
                    kglad Adobe Community Professional & MVP

                    add a textfield to the stage that remains throught your app (eg, tf).  you then would use:

                     

                     

                    tf.text+=_root.ssFileSave+"\n";

                    if (_root.ssFileSave != "?") {

                    root.filename = _root.ssFileSave;

                    tf.text+="call onsaver\n"

                    _root.onsaver(); 

                    }

                     

                    trace("onsaver defined")

                    function onsaver(component) {

                    tf.text+="onsaver called\n"

                    //evaluate files and write the file to save

                      ssReadFile = a1[0]+"="+eval(a1[0]) etc.

                    fscommand("CLEAR");

                    fscommand("ARG", filename);

                    fscommand("ARG", ssReadFile);

                    fscommand("FILESYS2.WRITEFILE");

                    savedmovie.gotoAndPlay(2);

                     

                     

                    1 person found this helpful
                    • 8. Re: Referring to a function SWF Studio file save+open
                      Reeece Level 1

                      Thanks so much might continue this over the weekend if it goes well. Cheers, looking forward to making some fast progress.

                      • 9. Re: Referring to a function SWF Studio file save+open
                        kglad Adobe Community Professional & MVP

                        you're welcome.

                        • 10. Re: Referring to a function SWF Studio file save+open
                          Reeece Level 1

                          Hi again,

                           

                          I have implimented all of the code for the trace although I get no response what so ever, I have tested it on a normal button to change frame and get a response there in the textfield but nothing else, again, I know it reaches that frame as I have tested before and again.

                           

                          EDIT:

                          The only trace I get back is from a seperate function on the main timeline, and even trying to call that function with the open button I have does not seem to be working either.

                           

                          So basically the debugger works in some aspects although I need to find a different way to call/execute the functions from within the object or figure out why the current code isn't working seeing as kglad stated before it is the correct code.

                          • 11. Re: Referring to a function SWF Studio file save+open
                            kglad Adobe Community Professional & MVP

                            do you have a textfield named tf visible on-stage?

                             

                            test that you have that setup correctly by adding:

                             

                            tf.text="Test";

                             

                            in your first frame, a frame you know is played.

                            • 12. Re: Referring to a function SWF Studio file save+open
                              Reeece Level 1

                              Yes I have it set up and working for 3 functions, 1 function with an else for the same function and an erase button which goes to the next frame and deletes the current variables and then returns to the previous frame afterwards, so it seems to work in that regard.

                               

                              All the functions I have traced which operate on the main timeline are working but none of the ones I am linking to the main timeline through the scripted mc/objects do not work, either in function or trace.

                               

                              I have also tested it on a button to goto the next frame which also works no problem at all.

                               

                              I have tried all sorts of different combinations for calling these functions, _root. _global call() that sort of thing and none of them work, I cannot figure out why they do not work everything else which doesn't link or refer to the main timeline/outside of the object works completely I can link you the code for the whole mc if you would like as it is just for script. But as far as I can tell it does not look to be the problem.

                               

                              I am also not 100% sure what tf.text+=_root.ssFileSave+"ssFileSave\n"; does, but I do not get feedback from that either.

                               

                              In fact no trace at all is working in either of my scripted mc/objects even if I put one right on the first frame after the stop I tried:

                              tf.text="save";

                              tf.text="save\n";

                              I figured that would of easily worked since I have played an animated mc from a later frame in the same mc.

                              • 13. Re: Referring to a function SWF Studio file save+open
                                kglad Adobe Community Professional & MVP

                                copy and paste the code that's failing to add text to tf and copy and paste the code that, you think, should cause that code to execute.

                                • 14. Re: Referring to a function SWF Studio file save+open
                                  Reeece Level 1

                                  Whoops, I meant the second frame as that is where the mc starts.

                                   

                                  Save/write file link to execution, this should link to the main timeline to read the data and write the file

                                  tf.text+=_root.ssFileSave+"n";

                                  if (_root.ssFileSave != "?") {

                                  root.filename = _root.ssFileSave;

                                  tf.text+="call onsaver\n"

                                  _root.onsaver(); 

                                  }

                                   

                                  Open file execution:

                                  tf.text+=_root.ssFileOpen+"\n";

                                  if (_root.ssFileOpen != "?") {

                                  _root.filename = _root.ssFileOpen;

                                  loadVariablesNum(_root.filename, 0);

                                  nextFrame();

                                  }

                                   

                                  next part of the open file which deletes the current preset/layout/save

                                  play();

                                  tf.text+="call deleteall\n";

                                  _global.deleteall();

                                  _root.deleteall();

                                   

                                  After that there is similar code on different frames to create it and then another part to set up and place the variables/objects etc.

                                   

                                  I have also tried all sorts of code to try and get the open file to read the data to move the objects to the preset locations although all I get out of it so far is the text.

                                  • 15. Re: Referring to a function SWF Studio file save+open
                                    kglad Adobe Community Professional & MVP

                                    what code is used to trigger the execution of:

                                     

                                    tf.text+=_root.ssFileSave+"n";

                                    if (_root.ssFileSave != "?") {

                                    root.filename = _root.ssFileSave;

                                    tf.text+="call onsaver\n"

                                    _root.onsaver(); 

                                    }

                                    • 16. Re: Referring to a function SWF Studio file save+open
                                      Reeece Level 1

                                      The 3 frames leading up to the frame with that code on are:

                                       

                                       

                                      1:

                                      _root.ssFileSave = "";

                                      tf.text+="FileSave\n"

                                      fscommand("ARG", "_level0.ssFileSave");  

                                      fscommand("ARG", "yourfile.txt");         //default file name text

                                      fscommand("ARG", "Enter File Name");      // title on file open dialog

                                      fscommand("ARG", _root.startdir);

                                      fscommand("ARG", "Text Files|*.txt||");   // default file type

                                      fscommand("FileSys2.FileSave");

                                       

                                      2:

                                      Empty for looping

                                       

                                      3:

                                      if (_root.ssFileSave == "") {

                                      gotoAndPlay(_currentFrame-1);

                                      }

                                       

                                      The first 5 frames of the mc before that include finding the start directory

                                      • 17. Re: Referring to a function SWF Studio file save+open
                                        Reeece Level 1

                                        Ok I have got the trace working for the objects, I was just being an idiot and didn't even put _root.tf.text.... the objects run smoothly and execute themselves fine, its just executing _root.functions which is the persistant problem, the trace mentioned at first:

                                        _root.tf.text+=_root.ssFileSave+"\n";

                                        if (_root.ssFileSave != "?") {

                                        _root.filename = _root.ssFileSave;

                                        _root.tf.text+="call onsaver\n"

                                        _root.onsaver();

                                        }

                                        Comes back with:

                                        FileSave

                                        (Full path to start directory folder+)\yourfile.txt

                                        call onsaver

                                         

                                        But the functions on the main timeline still aren't recieving any calls.

                                        • 18. Re: Referring to a function SWF Studio file save+open
                                          kglad Adobe Community Professional & MVP

                                          if you used:

                                           

                                          _root.tf.text+=_root.ssFileSave+"\n";

                                          if (_root.ssFileSave != "?") {

                                          root.filename = _root.ssFileSave;

                                          _root.tf.text+="call onsaver\n"

                                          _root.onsaver(); 

                                          }

                                           

                                          _root.tf.text+="onsaver defined";

                                          function onsaver(component) {

                                          _root.tf.text+="onsaver called\n"

                                          //evaluate files and write the file to save

                                            ssReadFile = a1[0]+"="+eval(a1[0]) etc.

                                          fscommand("CLEAR");

                                          fscommand("ARG", filename);

                                          fscommand("ARG", ssReadFile);

                                          fscommand("FILESYS2.WRITEFILE");

                                          savedmovie.gotoAndPlay(2);

                                           

                                           

                                          and failed to see "onsaver defined" appear above "onsaver called", onsaver is not defined when you are trying to call it.    in as2 (but not as3) named functions (which is the type you are using) must have their definition appear in a frame that plays before any frame that contains a call to that function.

                                          • 19. Re: Referring to a function SWF Studio file save+open
                                            Reeece Level 1

                                            Do I need _root. on code in the main timeline? o.o

                                             

                                            I did not have _root.tf.text+="onsaver defined"; before either I will try putting _root. on the main timeline functions if that will work I think I have tried it once before just incase but I didn't think that would work anyway.

                                             

                                            I am not getting any "called" trace I am only getting "call" trace, the only "called" trace is the function which executes itself on the start of the frame on the main timeline and again when opening files in certain situations (I am also using AS1)

                                             

                                            EDIT:

                                            Well I have made a little bit of progress by trying some different variations of code earlier on in the mc (which I have also tried before) and got createall to call and got a response back with createall being called right after, although the other 2 parts which are all coded to call in the same way e.g:

                                            MC:

                                            play();

                                            _root.tf.text+="call createall\n";

                                            _root.createall();

                                             

                                            Timeline:

                                            function createall() {

                                            tf.text+="createall called\n"

                                            • 20. Re: Referring to a function SWF Studio file save+open
                                              kglad Adobe Community Professional & MVP

                                              for objects on the _root timeline, you do not need to prefix with _root.  but it doesn't hurt, either.

                                               

                                              but again, if you failed to see "onsaver defined" appear above "onsaver called", onsaver is not defined when you are trying to call it. 

                                               

                                              one remedy would be to move all your function definitions to frame 1.

                                              • 21. Re: Referring to a function SWF Studio file save+open
                                                Reeece Level 1

                                                Ok fair enough, well all the functions I am trying to call are on frames on the main timeline (mostly one frame/layer - but createall is on a different frame/layer)

                                                 

                                                onsaver isnt called at all so I am not getting the defined text either, I call it but it does not respond. I have tried putting all the code into one(the same) frame (but not at the start of the timeline) but with no avail.

                                                 

                                                Just tried moving all the code for that frame onto the first frame of the project all on one frame and layer, although that didn't do anything, infact it went back as I didnt get a trace from createall called.

                                                 

                                                EDIT: I tried the same thing with the createaall function, I still get the call and called trace although I do not get a defined trace what so ever :S

                                                • 22. Re: Referring to a function SWF Studio file save+open
                                                  Reeece Level 1

                                                  I have found the root of the problem.

                                                   

                                                  Upon splitting up the code it is the onsaver function which seems to be disturbing the other parts of the code in that frame so I moved that function into a layer in its own, and found out that it is also the culprit for the unknown error I found early on where I had to /* Comment out the bottom of the script because if I didn't do that it would crash on export.

                                                   

                                                  I am getting closer to a full finished product, hopefully the onsaver wont cause TOO much trouble to sort out, it looks troublesome though Thanks for the help so far

                                                   

                                                  EDIT: I forgot to mention all the functions I traced all come back defined at the start and I see what you mean by it defining at the start ( I thought u meant once you use the function) everything but the onsaver function is working so 99% complete

                                                  • 23. Re: Referring to a function SWF Studio file save+open
                                                    Reeece Level 1

                                                    Ok great - just one last thing to fix, I have seperated ssReadFile from the onsaver function and I can now create blank files and it all runs smoothly.

                                                     

                                                    ssReadFile 'reads' and formats the data so that it can be saved/written into a .txt file.

                                                     

                                                    1: Would I be able to create another function for ssReadFile so that I can reference it within the onsaver function and keep them both in seperate frames/layers?

                                                     

                                                    2: Would I be able to simplify the code to (hopefully) use within the function as it used to be?

                                                     

                                                    The code looks like this:

                                                     

                                                    ssReadFile = a1[0]+"="+eval(a1[0])+"&"+a1[1]+"="+eval(a1[1]).....//etc.

                                                    Continues from [a1] to [a1000] with a /* after (with no */ to close it) so that I can export it without it crashing (which has been a known problem from early on)

                                                     

                                                    I will continue tomorrow if you could give me somewhere to start or the most effectrive way to solve it I would greatly appreciate it .

                                                     

                                                    Many Thanks,

                                                    Reece.

                                                    • 24. Re: Referring to a function SWF Studio file save+open
                                                      kglad Adobe Community Professional & MVP

                                                      1.  layers don't even exist in your published swf.  they only exist for your developing/designing convenience.  you can use different frames for different functions but a frame must play before any code in that frame executes.  ie, a frame must play before a function defined on that frame is defined.

                                                       

                                                      2. i'm not sure what you're trying to do.  but yes, you can create strings using concatenation and yes, you can force actionscript to coerce a string to an object using array notation.  so, if you have an object mc defined on "this" timeline, you can use this["mc"] to reference the object.

                                                      • 25. Re: Referring to a function SWF Studio file save+open
                                                        Reeece Level 1

                                                        Hello again, yes I know that they are not used in the exported version etc. sorry I wasn't clear enough, basically ssReadFile disrupts the functions of everything else in that frame even though it isn't technically a 'function' itself.

                                                         

                                                        it overwrites the locations from where the objects started and replaces it with the new locations of the objects which the user has moved in the exported .exe version.

                                                         

                                                        EDIT: Ok so I have found and fixed the syntax, whenever there is an error it can export but when its fixed with no errors it crashes flash on export :S

                                                         

                                                        How would I phrase it and put it together as a working part of code. I know what the code does for the most part I just do not know how to fit it in with other code.

                                                         

                                                        P.S This is the related code just to put it into context a bit better:

                                                        a1 = ["name", "title", "notes", "dsacx" etc.

                                                         

                                                        Any help is appreciated.

                                                         

                                                        Thanks.

                                                        • 26. Re: Referring to a function SWF Studio file save+open
                                                          kglad Adobe Community Professional & MVP

                                                          what is the class of ssReadFile?

                                                          • 27. Re: Referring to a function SWF Studio file save+open
                                                            Reeece Level 1

                                                            Hello, I am currently working on a new code for ssReadFile, but the old code was like this:

                                                             

                                                            ReadFile = a1[0]+"="+eval(a1[0])+"&"+a1[1]+"="+eval(a1[1])+"&"+a1[2]+"="+eval(a1[2])+"&"+a1[3]+"="+e val(a1[3])+"&"+a1[4]+"="+eval(a1[4])+"&"+a1[5]+"="+eval(a1[5])+"&"+a1[6]+"="+eval(a1[6])+" &"+a1[7]+"="+eval(a1[7])+"&"+a1[8]+"="+eval(a1[8])+"&"+a1[9]+"="+eval(a1[9])+"&"+a1[10]+"= "+eval(a1[10])+"&"+a1[11]+"="+eval(a1[11])+"&"+a1[12]+"="+eval(a1[12])+"&"+a1[13]+"="+eval (a1[13])+"&"+a1[14]+"="+eval(a1[14])+"&"+a1[15]+"="+eval(a1[15])+"&"+a1[16]+"="+eval(a1[16 ])+"&"+a1[17]+"="+eval(a1[17])+"&"+a1[18]+"="+eval(a1[18])+"&"+a1[19]+"="+eval(a1[19])+"&" +a1[20]+"="+eval(a1[20])+"&"+a1[21]+"="+eval(a1[21])+"&"+a1[22]+"="+eval(a1[22])+"&"+a1[23 ]+"="+eval(a1[23])+"&"+a1[24]+"="+eval(a1[24])+"&"+a1[25]+"="+eval(a1[25])+"&"+a1[26]+"="+ eval(a1[26])+"&"+a1[27]+"="+eval(a1[27])+"&"+a1[28]+"="+eval(a1[28])+"&"+a1[29]+"="+eval(a 1[29])+"&"+a1[30]+"="+eval(a1[30])+"&"+a1[31]+"="+eval(a1[31])+"&"+a1[32]+"="+eval(a1[32]) +"&"+a1[33]+"="+eval(a1[33])+"&"+a1[34]+"="+eval(a1[34])+"&"+a1[35]+"="+eval(a1[35])+"&"+a 1[36]+"="+eval(a1[36])+"&"+a1[37]+"="+eval(a1[37])+"&"+a1[38]+"="+eval(a1[38])+"&"+a1[39]+ "="+eval(a1[39])+"&"+a1[40]+"="+eval(a1[40])+"&"+a1[41]+"="+eval(a1[41])+"&"+a1[42]+"="+ev al(a1[42])+"&"+a1[43]+"="+eval(a1[43])+"&"+a1[44]+"="+eval(a1[44])+"&"+a1[45]+"="+eval(a1[ 45])+"&"+a1[46]+"="+eval(a1[46])+"&"+a1[47]+"="+eval(a1[47])+"&"+a1[48]+"="+eval(a1[48])+" &"+a1[49]+"="+eval(a1[49])+"&"+a1[50]+"="+eval(a1[50])+"&"+a1[51]+"="+eval(a1[51])+"&"+a1[ 52]+"="+eval(a1[52])+"&"+a1[53]+"="+eval(a1[53])+"&"+a1[54]+"="+eval(a1[54])+"&"+a1[55]+"= "+eval(a1[55])+"&"+a1[56]+"="+eval(a1[56])+"&"+a1[57]+"="+eval(a1[57])+"&"+a1[58]+"="+eval (a1[58])+"&"+a1[59]+"="+eval(a1[59])+"&"+a1[60]+"="+eval(a1[60])+"&"+a1[61]+"="+eval(a1[61 ])+"&"+a1[62]+"="+eval(a1[62])+"&"+a1[63]+"="+eval(a1[63])+"&"+a1[64]+"="+eval(a1[64])+"&" +a1[65]+"="+eval(a1[65])+"&"+a1[66]+"="+eval(a1[66])+"&"+a1[67]+"="+eval(a1[67])+"&"+a1[68 ]+"="+eval(a1[68])+"&"+a1[69]+"="+eval(a1[69])+"&"+a1[70]+"="+eval(a1[70])+"&"+a1[71]+"="+ eval(a1[71])+"&"+a1[72]+"="+eval(a1[72])+"&"+a1[73]+"="+eval(a1[73])+"&"+a1[74]+"="+eval(a 1[74])+"&"+a1[75]+"="+eval(a1[75])+"&"+a1[76]+"="+eval(a1[76])+"&"+a1[77]+"="+eval(a1[77]) +"&"+a1[78]+"="+eval(a1[78])+"&"+a1[79]+"="+eval(a1[79])+"&"+a1[80]+"="+eval(a1[80])+"&"+a 1[81]+"="+eval(a1[81])+"&"+a1[82]+"="+eval(a1[82])+"&"+a1[83]+"="+eval(a1[83])+"&"+a1[84]+ "="+eval(a1[84])+"&"+a1[85]+"="+eval(a1[85])+"&"+a1[86]+"="+eval(a1[86])+"&"+a1[87]+"="+ev al(a1[87])+"&"+a1[88]+"="+eval(a1[88])+"&"+a1[89]+"="+eval(a1[89])+"&"+a1[90]+"="+eval(a1[ 90])+"&"+a1[91]+"="+eval(a1[91])+"&"+a1[92]+"="+eval(a1[92])+"&"+a1[93]+"="+eval(a1[93])+" &"+a1[94]+"="+eval(a1[94])+"&"+a1[95]+"="+eval(a1[95])+"&"+a1[96]+"="+eval(a1[96])+"&"+a1[ 97]+"="+eval(a1[97])+"&"+a1[98]+"="+eval(a1[98])+"&"+a1[99]+"="+eval(a1[99])+"&"+a1[100]+" ="+eval(a1[100])+"&"+a1[101]+"="+eval(a1[101])

                                                            //continues to 1000

                                                            That code also refers to this code:

                                                            a1 = ["name", "title", "notes", "dsacx", "dsac1x", "dsac2x", "dsac3x", "dsac4x", "dsac5x", "dsac6x", "dsac7x", "dsac8x", "dsac9x", "dsac10x", "ddac11x", "ddac12x", "ddac13x", "ddac14x", "ddac15x", "ddac16x", "ddac17x", "ddac18x", "ddac19x", "ddac20x", "d3portx", "d3port21x", "d3port22x", "d3port23x", "d3port24x", "d3port25x", "d3port26x", "d3port27x", "d3port28x", "d3port29x", "d3port30x", "d5portx", "d5port31x", "d5port32x", "d5port33x", "d5port34x", "d5port35x", "d5port36x", "d5port37x", "d5port38x", "d5port39x", "d5port40x", "dexhaustx", "dexhaust41x", "dexhaust42x", "dexhaust43x", "dexhaust44x", "dexhaust45x", "dexhaust46x", "dexhaust47x", "dexhaust48x", "dexhaust49x", "dexhaust50x", "dexhaust51x", "dexhaust52x", "dexhaust53x", "dexhaust54x", "dexhaust55x", "dexhaust56x", "dexhaust57x", "dexhaust58x", "dexhaust59x", "dexhaust60x", "dairinx", "dairin61x", "dairin62x", "dairin63x", "dairin64x", "dairin65x", "dairin66x", "dairin67x", "dairin68x", "dairin69x", "dairin70x", "dairin71x", "dairin72x", "dairin73x", "dairin74x", "dairin75x", "dairin76x", "dairin77x", "dairin78x", "dairin79x", "dairin80x", "dflowx", "dflow81x", "dflow82x", "dflow83x", "dflow84x", "dflow85x", "dflow86x", "dflow87x", "dflow88x", "dflow89x", "dflow90x", "dflowmx", "dflowm91x", "dflowm92x", "dflowm93x", "dflowm94x", "dflowm95x", "dflowm96x", "dflowm97x", "dflowm98x", "dflowm99x", "dflowm100x", "dshuttlex", "dshuttle101x", "dshuttle102x", "dshuttle103x", "dshuttle104x", "dshuttle105x", "dshuttle106x", "dshuttle107x", "dshuttle108x", "dshuttle109x", "dshuttle110x", "drollerx", "droller111x", "droller112x", "droller113x", "droller114x", "droller115x", "droller116x", "droller117x", "droller118x", "droller119x", "droller120x", "dpeddlex", "dpeddle121x", "dpeddle122x", "dpeddle123x", "dpeddle124x", "dpeddle125x", "dpeddle126x", "dpeddle127x", "dpeddle128x", "dpeddle129x", "dpeddle130x", "dpushx", "dpush131x", "dpush132x", "dpush133x", "dpush134x", "dpush135x", "dpush136x", "dpush137x", "dpush138x", "dpush139x", "dpush140x", "dleverx", "dlever141x", "dlever142x", "dlever143x", "dlever144x"(etc...)];

                                                            • 28. Re: Referring to a function SWF Studio file save+open
                                                              kglad Adobe Community Professional & MVP

                                                              what is the class of ssReadFile?

                                                               

                                                              it looks like it's a string.  if it is, what is the point of those eval() functions?

                                                              • 29. Re: Referring to a function SWF Studio file save+open
                                                                Reeece Level 1

                                                                I am not sure I did not code this bit, I am updating it - I have not worked with eval like this before.

                                                                 

                                                                It is almost working with the new code now I am getting a double trace back and it creates the file still but it does not save the data on, that could be the other part of the code, but still it is outputting it twice so it still needs a little tweaking

                                                                 

                                                                replaced the above ssReadFile = with:

                                                                 

                                                                for (i = 0; i < a1.length; i++)

                                                                {

                                                                    ssReadFile += "&" + a1[i] + "=" + a1[i];

                                                                }

                                                                With a trace as well:

                                                                tf.text+="onsaver defined\n";

                                                                function onsaver(component) {

                                                                tf.text+="onsaver called\n"

                                                                //evaluate files and write the file to save

                                                                tf.text += ssReadFile + "\n";

                                                                 

                                                                Which outputs this:

                                                                &name=name&title=title&notes=notes&dsacx=dsacx //etc...

                                                                • 30. Re: Referring to a function SWF Studio file save+open
                                                                  Reeece Level 1

                                                                  I am trumped I have recorded all the ssReadFile code and it just crashes on export with the whole code there, but if I delete it down to a1[100]-a1[200] I can get it to export but even then it all the results are equal to themselves and do not show any values or inputted text etc.

                                                                   

                                                                  ssReadFile Code:

                                                                  ssReadFile = a1[0]+"="+eval("a1.0")+"&"+a1[1]+"="+eval("a1.1")+"&"+a1[2]+"="+eval("a1.2")+"&"+a1[3]+"= "+eval("a1.3")+"&"+a1[4]+"="+eval("a1.4")+"&"+a1[5]+"="+eval("a1.5")

                                                                  Trace results and output data:

                                                                  name=name&title=title&notes=notes&dsacx=dsacx&dsac1x=dsac1x&dsac2x=dsac2x&dsac3x=dsac3x&ds ac4x=dsac4x&dsac5x=dsac5x&dsac6x=dsac6

                                                                  I am aiming to get results more like this:

                                                                  name=test&title=myproject&notes=more text&dsacx=675.3&dsac1x=675.3&dsac2x=675.3&dsac3x=675.3&dsac4x=675.3&dsac5x=675.3&dsac6x= 487

                                                                   

                                                                  Any ideas? I am lost for ideas and I can't figure out what's wrong or how to fix it

                                                                  • 31. Re: Referring to a function SWF Studio file save+open
                                                                    kglad Adobe Community Professional & MVP

                                                                    because you cannot explain what that code is supposed to do, i don't understand what that code is supposed to do. 

                                                                     

                                                                    so, i don't think i can help further without downloading and correcting your file(s) (and the only free help i offer is via the adobe forums).

                                                                    • 32. Re: Referring to a function SWF Studio file save+open
                                                                      Reeece Level 1

                                                                      I am sorry I cannot pinpoint exactly how it works because I havent used it before but basically once the save button is pressed the variables positions are saved and then once the file directory is is selected and the filename is saved this all goes under one package which goes on to help write the file with the onsaver command whilst ssReadFile reads and evaluates the data to be saved into the text file which can then later be read and openedby other functions.

                                                                       

                                                                      So far I have got close enough to write the data but it is incorrect because it just saves the value of the variables as the variables names, I just don't know how to correct it :S or why eval is disrupting other code and crashing on export under certain circumstances is there anything that you could help me fix to help get going because I do not know how to approach this hurdle.

                                                                       

                                                                      I can link you some more code to put it into a bit more context if you like, either way I would like to thank you for all your help thus far you have helped me a lot and guided me in the right direction, so once again thank you.

                                                                       

                                                                      Kind Regards,

                                                                      Reece