9 Replies Latest reply on Dec 9, 2009 4:50 AM by Ned Murphy

    Actionscript version

    WarDemonZ Level 1

      Hi everyone,

       

      Iv just finished following a tutorial on how to make a web gallery since im not all that proficient in flash myself, iv followed the tutorial to the letter and i cant make it work right, i understand that different versions of actionscript have different codes in and will and wont do different things on each version. the version i have is Flash CS4, and i think the tutorial maker did his in Flash 8, obviously when i make my program i have a choice of which version of actionscript to use, so i wanted to ask which version of actionscript Flash 8 uses? i set mine up to use AS2 but doesnt work so naturally id assume it was written in AS1, can anyone take a look at the code and verify which version it is supposed to work on?

       

      http://www.pixel2life.com/viewtutorial/74562/creating_the_ultimate_xml_gallery_in_flash_8/   *about half way down*

       

      also if i have built this in the wrong version is there anyway in Flash CS4 to convert which version it runs in so i dont have to start again but choose a different version of actionscript?

       

      Any help would be great

       

      Thanks

       

      Andrew

        • 1. Re: Actionscript version
          Ned Murphy Adobe Community Professional & MVP

          You are right, that is AS2 code.  Flash 8 preceded AS3, so it can only handle up to AS2.  Since you have CS4, you have no problem in any case as far as selecting which version you want to use.

          • 2. Re: Actionscript version
            WarDemonZ Level 1

            ah great thanks

             

            unfortunately that is half the answer i didnt want, because that means my program doesnt work and i cant figure out why

            • 3. Re: Actionscript version
              Ned Murphy Adobe Community Professional & MVP

              Yeah, I figured that would be the case.  Often tutorials contain errant code and/or directions--lots of people like to write them, not all have a talent for it.

               

              What you should do first is go thru and triple check that you have everything besides the code set up properly.  If that all still looks good, then you can try tracking down where the program is failing by using trace() commands to see what the status of things is as things get processed.

              • 4. Re: Actionscript version
                WarDemonZ Level 1

                ill try checking over the instance names and objects etc but the problem isnt that its crashing or it breaks, it works and no error message comes up it just doesnt do what it should be doing. if you look at the example program he has built (theres a link somewhere on the page of the first message) what should be happening is menu buttons get created based on folders and instances written inside an XML file (which is downloadable) so the more folders inside the root folder and appending the XML file should cause more buttons to be created, but they dont appear on my program. like it says at the bottom of the tutorial to copy his folder names and have example pictures, i have only put pictures in 1 folder to test it, but i have made the folders such as they are in his example. i dont know if its not finding the XML file or if theres something going wrong after that. looking at the comments after the tutorial it seems the code and XML is fine as people seem to have it working

                • 5. Re: Actionscript version
                  Ned Murphy Adobe Community Professional & MVP

                  Error messages are your friends, so when things don't work and you aren't getting them, things get tougher to solve.   That's where the trace() function becomes your ally.  If you are familiar with using the trace() function, you should be able to walk thru the processing stages to see where things start to not appear as you expect they should.

                  • 6. Re: Actionscript version
                    WarDemonZ Level 1

                    Thanks, im not great at actionscript and looking at this huge lump of code and attempting to reverse engineer it is quite a task, id already spotted 1 instance name error i made but that was for a minor feature of it, unfortunately im not all that familiar with the trace feature, i know what it does but i dont think id know what i was looking for or where to put it. i doubt it would be anything to do with the code since there are no errors and the comments on the tutorial dont seem to mention any problems with the straight forward code, just when people try to modify it. however i dont know how to check if its finding the XML file, maybe this is where the trace function comes in? is there a way of putting it in the code to see if it can actually find the XML file its supposed to be looking at?

                    • 7. Re: Actionscript version
                      Ned Murphy Adobe Community Professional & MVP

                      You can use the trace() function to check the status of just about any variable or object/property.  For instance, if you are wondering about the xml loading, in your parseGalleries function there is the line...

                       

                      if (imageGallery.firstChild.nodeName == "galleries") {

                       

                      So what you could do is just before that line use....

                       

                      trace(image.firstChild.nodeName);

                       

                      To see if it indicates the value is "galleries"

                       

                      and later in that function at the end there is...

                       

                      numberOfGalleries = i;

                       

                      so just after that line you could try

                       

                      trace(numberOfGalleries);

                       

                      to make sure there are some galleries accounted for.  That should tell you whether or not the xml file is being read (assuming it has the data that it should).

                       

                      And if you find that's all fine, then at the end of that function you see a call to the enableButtons function.  That would be the next location for some trace testing.  If that looks to be fine, then you probably want to test the button code to see if anything is coming up undefined there. 

                       

                      You essentially need to gradually go thru the code the way it would be processed and check the status of things at each stage.  Eventually you should come up with something not being what you night epect it to be.  It does require being more familiar with the code than just having borrowed it blindly, so you will have to learn about the design.  The problem may indeed not be a coding provlem, but if it is related to instance names being off or something like that, it should still show up in the trace testing.

                       

                      • 8. Re: Actionscript version
                        WarDemonZ Level 1

                        hi, sorry i didnt reply yesterday i had to meet my friend at the gym

                         

                        iv just tried using the trace function on those parts you mentioned and it works as it should be, it returns 'galleries' and '5' so its definitely getting something, i almost thought for a while it wasnt finding the XML file but i was just writing the trace function wrong

                         

                        the problem with mine is that the buttons just arent being created, if you have tried the example program on his site you can use the 'up' and 'down' buttons and that works on mine as well, and i would guess that as soon as the buttons appear the rest (ie being able to click each photo to bring up a larger view) will work as well. 1 thought i had was that in the tutorial he instructs to use the linkage option on several items, but there is no direct method for option to right click the item and choose linkage, it works the same by going through the 'advanced' section of the properties menu doesnt it? i assume it will that was just something i had to find how to do myself on CS4 as opposed to how it works on Flash 8

                         

                        since this is getting its information from an XML file is there a way i can put in my own tester button to see if it finds the pictures in the galleries and it works from the part after the buttons are found

                         

                        Thanks for your help so far

                         

                        Andrew

                        • 9. Re: Actionscript version
                          Ned Murphy Adobe Community Professional & MVP

                          I haven't tried the file from the tutorial and I don't really plan to.  Just trying to give you some guidance to find the solution yourself--but I am not going to go thru this with you every step of the way.  If you say the buttons are not being created, then that in itself is a good clue regarding you where you need to focus your investigation.  Trace thru the code involved with creating the buttons and see where something isn't coming up as what you might expect.