10 Replies Latest reply on Aug 9, 2007 7:22 AM by csgdon

    load movieclip

    csgdon Level 1
      Hey, hopefully someone can help me out. I'm having a problem getting the load movieclip script to work. Here's my situation, I have a swf file that I want to load into another swf, I have this test file that I'm working on, I created the swf that I want to pull in. no problem. I attach the load movie script to a button I pull from the UI Components and when I test the movie it works, plays the swf file just right. I create, say a oval for example, make that a button and attach the script and test the movie, nothing! Not sure what I'm doing wrong. I can attach .fla file if need be. Thanks for any help.

        • 1. Re: load movieclip
          Rothrock Level 5
          Really don't know what the oval has to do with loadMovie. Welcome to the forums BTW.

          Generally it is a good idea to attach your code – not the whole project, just the most basic piece you need to get the problem to work/not work. You would be amazed at how many folks (myself included) sometimes think we are telling flash to do one thing when really we are telling it something quite different.

          The darn thing does what we tell it, not what we want!
          • 2. Re: load movieclip
            csgdon Level 1
            Well, the oval was just for a test to represent a button. What I have is actually a map of the US, each state I have as a rollover button that changes color when you mouse over, I want to also load a swf file when you click the state. I get an error when I try to attch the load movie AS to it. Now when I drag a button say from the UI Components to the stage and add the AS it works fine, I just want to add the script to each of the states. Thanks.
            • 3. load movieclip
              _name Level 1
              stick all of your "states" in an array, your swf's in another. make sure that the order of your "states" in your first array coincides with the order of your swf's in the second (i.e. state 0 from your first array will pull swf 0 from your second). it should look something like this:
              • 4. Re: load movieclip
                Rothrock Level 5
                You still didn't share the code you are trying to use to load the movie. It is really difficult to tell what is wrong when you don't show what you are actually doing.
                • 5. Re: load movieclip
                  csgdon Level 1
                  I'm sorry about that. I am not great with scripting so I apologize for any seemingly stupid questions.

                  Again what I have is a .fla file of the US. Each state is on a layer and is a button with states to change color when you mouse over & click. I don't think I need an array as stated below because as of now all the sates are going to open the same swf file, so I only have one swf file I'm bringing in. I have an empty movie clip container on a layer that I'm opening the swf file in. Below is the script I'm using, again when I put this script on a button from the library and test the movie it opens the swf file fine, like it should. Here is the script:


                  Thanks again for any insight.

                  • 6. Re: load movieclip
                    Rothrock Level 5
                    Hey no problem. Nothing to apologize for and remember, "There are no stupid questions, just stupid people asking question." :) (That is totally meant as a joke!) We all have to start someplace.

                    First, I don't think there is a click event for movieclips. There is for the UI components, but for movie clips or button instances you would use Press or Release. I haven't used that kind of coding since 2001, so I'm not quite familiar with the exact capitalization. See, this is something that without seeing the code we would go around for hours on!

                    But there is a more important issue – IMHO – and this is you are using the old (From Flash 5 days) style of coding event handlers. The approach given by _name above is much more modern, easier to use and maintain, and just plain better. David Stiller who helps out here a lot has a great entry in his blog about it. Check this link out:

                    • 7. Re: load movieclip
                      csgdon Level 1
                      Rothrock, thanks for all the info just delving into flash really. I'm going to check out the link you gave, hopefully someone else out there can maybe provide antoher solution., but you were most helpful.

                      • 8. Re: load movieclip
                        csgdon Level 1
                        Rothrock, I have to come back and thank you, you gave me the answer in your response. I just changed click to press in the script and it worked like a charm. THANK YOU AGAIN!!!

                        • 9. Re: load movieclip
                          Rothrock Level 5
                          Glad that helped. And certainly it is a fine solution if you don't need to go much further with Actionscript.

                          But if you start needing to do more, really think about moving to the more modern way. We will be here to help!
                          • 10. Re: load movieclip
                            csgdon Level 1
                            Thanks, that's about the extent of it for now. Do you have anymore good reference or resources I can check out for scripting. Thanks again. Wish all forums were this helpful.