12 Replies Latest reply on Jul 19, 2006 3:25 PM by Bill O

    Is something wrong with this code?

    aniebel Level 2
      This works if I change the alpha instead of attachMovie so I know the path is ok. I've tried mixing things around but sill no success. The item I wish to attach has a linkage id of "thumb0". Have I screwed up the code somehow?

        • 1. Re: Is something wrong with this code?
          aniebel Level 2
          Any help is greatly appreciated... I'll explain myself a bit further, if that helps.

          I have set up an XML slide show type thing but I want to control the slide previews with an "infinite menu" that I picked up from Kirupa's peeps. Basically, it's one of those sliding thumbnail menus that yugop made famous. I found a few ideas on here on how to use the XML file to dynamically load the thumbnail images but I could not figure out how to load them into the nested movieclips plus it looked as if there would be a delay to load as opposed to attachMovie.

          I'm wracking my brains trying to figure out the best way to handle this. If there were such things as virtual 6-packs, I'd send one as a token of appreciation for your help! ;-)
          • 2. Re: Is something wrong with this code?
            Rothrock Level 5
            Really no idea what you are trying to do. What is actually going wrong?

            However I can tell that whatever you are trying to do, this isn't the way to do it. There is almost never a time where you will put an attachMovie inside an onEnterFrame – do you really want to attach the exact same move 20 or 30 times a second? So get rid of the onEnterFrame.

            Other than that, if you are sure you have a symbol in the library with its linkage set to thumb0 and you are certain that you have a clip called thumbHolder_mc inside of the clip called thumb1_mc which is inside of the clip called thumbPanel1_mc which is inside of a clip called allThumbs_mc which is on the main timeline then it should work. (PS: It has to be on that frame at the time that you try and attach the movie.

            First from a design perspective I would say that is probably way to many levels of clips. There is bound to be a typo somewhere in there so check that very carefully.

            Yes there is bound to be a delay with loading the external clips, but it won't be any longer than the delay of having to wait for the whole swf to download. So you might really want to go back to looking for that XML technique.

            Finally, you load external files into nested clips the exact same way as you load into any other clip. So if you can do t hat with one you should be able to do the other.
            • 3. Re: Is something wrong with this code?
              aniebel Level 2
              Thanks for responding, Rothrock. I'm trying to create a portfolio that shows items and corresponding description based on an XML file. I've been able to get this to work with "next" and "back" buttons that step through the XML but I want to use the scrolling button menu instead... with thumbnails of each item.

              I found a tutorial on Kirupa that explains how to create the scrolling "infinite menu". You can view this here. What I'm trying to do is use this and populate the thumbnails from the XML dynamically so I can update it easily. The problem I'm having is that I am not getting any images in my thumbnail mcs as things are now. My mcs are blank.

              I clicked the target button in the actionscript panel to paste the target path instead of typing it. I don't think the problem lies in that area because I was able to successfully alter the alpha with the same path.

              I apologize if I was too vague. Your comments were helpful. Back to the drawing board I go!
              • 4. Re: Is something wrong with this code?
                Rothrock Level 5
                Are you sure the external clips are a format that your version of Flash understands? Which version are you using? If it is Flash MX04 (also called 7) then you can use jpegs – and make sure the jpeg is not saved as a progressive one.

                None of it is too complex, it is just that there are many little places where one misstep will seem to derail the same thing. You aren't getting an error that the file isn't there are you?
                • 5. Re: Is something wrong with this code?
                  aniebel Level 2
                  Nah, it's not the images.... that is one element to toss as a possible problem. They're GIFs and work if I manually place them. No, I'm not getting an error that it can't find the files.

                  Yeah, I bet you're right about the many possibilities for error. I'll probably kick myself when I figure it out. I'm using Flash 8 Pro, btw. I'm going to dive deep back into this today. I'll let you know what I find either way so maybe I can help someone else with the solution. Or... I'll be back to ask more ???s Thanks!
                  • 6. Re: Is something wrong with this code?
                    Rothrock Level 5
                    Are you sure you are publishing for flash 8? Because earlier versions can't load GIF. Also there are many formats that can be placed manually in the authoring environment, but can't be loaded dynamically at runtime. If they are animated GIFs that might be part of the problem. I've only ever loaded jpegs.
                    • 7. Re: Is something wrong with this code?
                      aniebel Level 2
                      Ok, it's working now. I knew it would be something stupid... well sorta. I had a few issues.

                      1.) the image was loading just fine. I couldn't see it because it was outside the mask area (doh!)
                      2.) this only showed up when I disabled the scrolling action of the thumb panel. I had to adjust the thumnail bar script to enable that. (add "this" to the actions)
                      3.) I was only setting up the first segment with thumbs where I should have set up both since one is always behind the mask. If it weren't, it wouldn't appear to be looping.

                      Here is my current (unfinished) code, if you're interested:
                      • 8. Is something wrong with this code?
                        Bill O
                        Haven't read the entire thread but I wanted to give you a heads up on your use of onEnterFrame. There is no need to use the onEnterFrame function if you are going to delete it after the first run (delete this.onEnterFrame) - just declare the statements.

                        OnEnterFrame is for recursive function execution at the movie's frame rate, and the delete statement would usually appear at the end of a conditional 'if' clause to kill the execution of the function when the condition is met.

                        To understand better, create a new Flash movie with one layer and one frame. On frame 1, layer 1 put in the following actions:

                        //counter starting point
                        var theCount:Number=0;
                        //count to 100
                        this.onEnterFrame=function(){
                        //add 1 to count
                        theCount++;
                        //trace count
                        trace ("Count now is: "+theCount);
                        //conditional statement to release the function
                        if (theCount==100){

                        trace("the counting is finished!");
                        //kill the function
                        delete this.onEnterFrame;
                        }
                        };
                        stop();

                        Then test the movie in Flash and watch your output window. It will count to 100 and stop. You can make it count faster or slower by changing the movie's frame rate. Notice that it still executes the function even though you specifically declared a stop statement in the main timeline.

                        Your code should read like this:
                        • 9. Re: Is something wrong with this code?
                          aniebel Level 2
                          thanks Bill, I thought that I had to have some sort of event handler for it to occur. I changed it and it works fine!
                          • 10. Re: Is something wrong with this code?
                            Bill O Level 1
                            Clarity is bliss in A.S. ! ;-]
                            • 11. Is something wrong with this code?
                              Bill O Level 1
                              onEnterFrame is a great tool though..,
                              • 12. Is something wrong with this code?
                                Bill O Level 1
                                double post whoops!