10 Replies Latest reply on Sep 9, 2006 5:25 PM by timsaw

    Target MC problem

    junkerjorg
      I hope I can explain this well enough for someone to help. I am working on a project that is using a lot of frame labels in various MC's. I am trying to target a specific frame label in a specific MC. I have done this a hundred times before but for some reason I can't get this to work. My hierarchy goes like this; scene1 > pages1 > pages2. Inside of pages two there are 4 frame labels, p1, p2, p3, p4. I wrote my code like this

      on (release) {
      _root.pages1.pages2.gotoAndPlay("p2");
      }

      and it refuses to work. The button I am trying to link from is located in scene1 - page_home, MC - arrow, button instance. The MC I am trying to target is on the main timeline but doesn't appear until it is told to play that frame label. I hope this is all making sense. Anyone have any ideas??
        • 1. Re: Target MC problem
          aniebel Level 2
          If I understand you correctly, you are saying that inside Scene 1, you have a mc with the instance name of "pages1" and inside that mc, you have another mc with the instance name of "pages2". In "pages2" you have 4 frame labels. Is this correct?

          I noticed that Flash didn't like "MC-arrow" so try changing it to "arrow_mc" or something like that. (looked like "arrow" was a reserved word but I can't find that in the documentation)

          On the main timeline in either frame 1 or the frame where the arrow_mc resides, have you tried:
          • 2. Target MC problem
            junkerjorg Level 1
            That is correct, the only thing is the buttons are button instances not MC's. In my description I was saying that pages_home is a movie clip and arrow is a button instance. I did try giving the button an instance name and coding it from the _root and it still doesn't work. This is boggling my mind and I hope to find a solution. It will be a great learning experience!!

            I might add that there is a lot of things this one button controls. The entire script for this button is as follows;

            on (rollOver) {
            gotoAndPlay(2);
            num = 3;
            _root.menu1.item3.gotoAndPlay("s1");
            }
            on (releaseOutside, rollOut) {
            gotoAndPlay(11);
            _root.menu1.item3.gotoAndPlay("s2");
            }
            on (release) {
            if (_root.link<>num and _root.animation == 1) {
            _root.animation = 0;
            _root.link_prev = _root.link;
            _root.menu1["item"+_root.link].gotoAndPlay("s2");
            _root.link = num;
            _root.play();
            _root.pic7.play();
            _root.pages1.pages2.gotoAndPlay("p2");
            }
            }
            • 3. Re: Target MC problem
              aniebel Level 2
              Ok, so if your "pages_home" is a movie clip, is the instance name the same? Assuming that all your clips and buttons have instance names, the code should work. I'm unsure of where "pages_home" fits into the mix . Is that a movie clip name or movie clip INSTANCE name? The code is the same whether it's a movie clip or a button. As you can see, I've only edited the instance name to reflect that "arrow" is a "button" but that's not critical so long as the instance name matches.

              arrow_btn.onRelease = function(){
              this._parent.pages1.pages2.gotoAndPlay("p2");
              };
              • 4. Re: Target MC problem
                timsaw
                Hi Junkerjorg,

                I am trying to do something similar and had a question. I am a newbie to flash but have programmed in C and assemble for years...

                In your code...

                on (release) {
                if (_root.link<>num and _root.animation == 1) {
                _root.animation = 0;
                _root.link_prev = _root.link;
                _root.menu1["item"+_root.link].gotoAndPlay("s2");
                _root.link = num;
                _root.play();
                _root.pic7.play();
                _root.pages1.pages2.gotoAndPlay("p2");
                }
                }

                Question - if I wanted to load an external movie (.swf) file how would you code that in the code example above?

                I am new and have read some of the docs on action scripts, but it appears that there are several ways to do it. Didn't know if you or someone that has more experience then I could help head me in the right direction.

                Thanks!

                Tim
                • 5. Target MC problem
                  junkerjorg Level 1
                  Tim.....there are several different ways to load externally. I think the easiest is to have an empty movie clip with the instance name of container and give instance names to your buttons like b1, b2, etc. then write the code from the _root to say

                  b1.onRelease = function() {
                  _root.container.loadMovie("external.swf");
                  }
                  • 6. Re: Target MC problem
                    timsaw Level 1
                    Junkerjorg,

                    Ok thanks...

                    One more question... About the placement... How does it determine where to load the new mc as far as position on the stage?

                    I see that there are some commands for X and Y but wasn't clear how it determined placement or if I even needed to assign X and Y values...

                    Thanks!

                    Tim
                    • 7. Target MC problem
                      junkerjorg Level 1
                      ANIEBEL -

                      Ok........pages_home is a movie clip of the home page contents. It is on the main timeline and frame labeled "p1". Pages1 is also a movie clip on the main timeline and it is labeled "p3". Because of the multiple uses of "p" on frame labels I have renamed all of the labels inside of pages2 to pp1, pp1....etc. So, the button that is trying to target pages1.pages2 resides in a movie clip on the same timeline. Hope this makes sense so far! I do understand what your saying and I have tried it that way. If it would help I could give you a link to the .fla but it is a huge file, 15MB. That way you could look for yourself at how everything is structured. If thats something you'd like to do please allow me to contact you privately. Thanks for your help!
                      • 8. Re: Target MC problem
                        timsaw Level 1
                        Jukerjorg,

                        Ok excellent... I appreciate your time and help in answering what is basic stuff, but I really am new to flash and I am trying to get up to speed quickly.

                        You can contact me via email - do I post it here or is there another way?

                        Thanks again,

                        Tim
                        • 9. Target MC problem
                          junkerjorg Level 1
                          Tim.......real quick, I edited that last post because I put loadMovieClip and it should be loadMovie. I have movie clip issues of my own and I guess their on my brain. As for the x and y if you use a container it determines the position for you. I place the container in the upper left and the postition all my stuff in the external swf. And my last post about posting an fla was for Aniebel, who is trying to help me with an issue. There are some really good tutorial out there on loading external swf's if you wanted to search them out. Check out Kirupa's forum!! kirupa.com
                          • 10. Target MC problem
                            timsaw Level 1
                            Junkerjorg,

                            OK thanks! I will give it a try and see what happens...

                            Thanks so much for all your thoughts and input...

                            Blessings!

                            Tim