9 Replies Latest reply on Jul 20, 2006 5:33 PM by injpix

    concatenating question

    aniebel Level 2
      How do I change this:


      Into something like this so that I can call it as a function with parameters?I know this is wrong. I tried it without the quotes and got nothing. I have looked up concatenation in the help and in my flash books but I guess maybe I'm looking for the wrong thing.

      function fLoadItem(thumb:String, thumbImage:String, mainImage:String) {
      var thumbPath:String = "_root.allThumbs_mc"
      thumbPath + ".thumbPanel1_mc." + thumb + ".createEmptyMovieClip("testHolder_mc", _root.getNextHighestDepth())";
      thumbPath + ".thumbPanel1_mc." + thumb + ".testHolder_mc.loadMovie("thumbImage")";
      thumbPath + ".thumbPanel1_mc." + thumb + ".testHolder_mc._x = -20";
      thumbPath + ".thumbPanel1_mc." + thumb + ".testHolder_mc._y = -20";
      thumbPath + ".thumbPanel1_mc." + thumb + ".hitArea = this.thumbHit_mc";
      thumbPath + ".thumbPanel2_mc." + thumb + ".createEmptyMovieClip("testHolder_mc", _root.getNextHighestDepth())";
      thumbPath + ".thumbPanel2_mc." + thumb + ".testHolder_mc.loadMovie("thumbImage")";
      thumbPath + ".thumbPanel2_mc." + thumb + ".testHolder_mc._x = -20";
      thumbPath + ".thumbPanel2_mc." + thumb + ".testHolder_mc._y = -20";
      thumbPath + ".thumbPanel2_mc." + thumb + ".onRelease = function() {
      fLoadPic(_root.mainImage.attributes.pic);
      };"
      }
        • 1. Re: concatenating question
          injpix Level 3
          You need to use brackets for doing such a thing. Check out this thread for using them;

          http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=288&threadid=1171247
          • 2. Re: concatenating question
            aniebel Level 2
            Ok, I've changed it to this but I get no as errors and nothing shows up on screen. Have I misunderstood your other post?
            • 3. Re: concatenating question
              aniebel Level 2
              So, now I am back. I couldn't figure out what I was supposed to do with the brackets. I'll have to research that later when I have more time. Sometimes I feel I'm not cut out for this stuff... grrr.

              I am getting an undefined in my output window for these images. I think it has to do with how the array is referenced but cannot figure out what to change. It seems I've been able to get this to work before in other projects using parameters.

              Please help me if you can. I have to have this working by Friday. Cheers! Thanks! Merci! Bitte! Gracias! and any other language I can't think of (AS is one).
              • 4. Re: concatenating question
                injpix Level 3
                Hard coding the path name as you have is good for troubleshooting. However it is hard to help you with without all the code. Post the XML code and then we can find out the ActionScript/XML part. I think that is also were you are having problems. Also for your fLoadPic(), the pic parameter goes no where in the function. Is that supposed to be?
                • 5. Re: concatenating question
                  aniebel Level 2
                  Sorry, I am posting my working code this time. It took awhile but I figured out that it was a scope issue. I had to call the function inside the onLoad handler for the XML. The other thing I was doing wrong was that I was mixing parameter types... string and xml node.

                  It's getting close to being right now. I have to tweak some things so it works like a charm. Next task is to dynamically populate the sliding menu bar with the number of items rather than have a set number and dynamically popluate it with thumbnail images. :-S

                  Thanks for all your help! Here's a virtual 6-pack!

                  • 6. Re: concatenating question
                    injpix Level 3
                    Can you post the XML code (tagPortfolio.xml)? If possible also post the FLA online. If I see the XML I should be able to understand what is going on. Also you should, as a standard, declare your variables on the top of the actionscript editor.
                    • 7. Re: concatenating question
                      aniebel Level 2
                      Thanks for the tip on declaring variables... Not sure if I can post the FLA yet but here is the XML:
                      • 8. Re: concatenating question
                        injpix Level 3
                        Ok. I am currently at work so I need to go but, I have looked at the XML and did some changes to the AS. Below is what I got so far. Study the trace statements in the Output panel. From the code that you have posted I take it that these movieclips are already on stage EXCEPT “thumbHolder_mc”. Correct? If no, then you need to create them with createEmptyMovieClip( ). Also notice I change the parameter in the fLoadPic( ). I will be back later today, goodluck.
                        • 9. concatenating question
                          injpix Level 3
                          Ok. It works now. Just make sure that you have the right files in the correct directory as you have them listed in the XML file. And again I assume that you have some movieclips already on stage as I mentioned in my previous post.