8 Replies Latest reply on May 18, 2007 10:52 AM by kglad

    Targeting issue

    Xcelsia Level 1
      Hi there,

      I am making a website which includes sliding pages and a popup menu.

      The sliding pages are in their own movie clip and the buttons to control this slide are located in a main menu movie clip both running in the main timeline.

      I can control the slider using the following, if the buttons are located on the main timeline directly:

      _root.buttonName.onRelease = function() {
      endX = 985;
      andY = 0;
      };

      for example.

      When trying to use the buttons in the movieclip 'menu' the targeting selection gives me:

      _root.menu.buttonName

      but in conjunction with the above:

      _root.menu.aboutpage.onRelease = function() {
      endX = 985;
      andY = 0;
      };

      I have no luck.

      Would realy appreciate if someone could shed some light.

      Thanks.
        • 1. Re: Targeting issue
          kglad Adobe Community Professional & MVP
          in a.s. 2, if you have any mouse handlers targetting _root.menu all mouse events (that you intend for children of _root.menu) will be intercepted by _root.menu and the child objects will not respond.

          to remedy, use a hitTest for one of the generations or target the child generation with your mouse handlers.
          • 2. Re: Targeting issue
            Xcelsia Level 1
            Thanks for the response.

            I have tested the movie with some of the menu buttons and some of the buttons on the main timeline. I can still control the ones on the timeline so dont think that the slider movieclip is cathcing all.

            I have pasted below the code that i have tried. I have double checked instance names etc and all seems fine.

            onClipEvent (load) {
            _x = 1735;
            _y = 0;
            spd = 20;
            }

            onClipEvent (enterFrame) {
            _x += (endX-_x)/spd;
            _y += (endY-_y)/spd;


            _root.menu.homepage.onRelease = function() {
            endX = 1735;
            endY = 0;
            };

            _root.menu.aboutpage.onRelease = function() {
            endX = 935;
            endY = 0;
            };

            _root.menu.servicespage.onRelease = function() {
            endX = 135;
            endY = 0;
            };

            _root.menu.gallerypage.onRelease = function() {
            endX = -665;
            endY = 0;
            };

            _root.menu.productspage.onRelease = function() {
            endX = -1465;
            endY = 0;
            };

            _root.menu.contactspage.onRelease = function() {
            endX = -2265;
            endY = 0;
            };

            }
            • 3. Re: Targeting issue
              Xcelsia Level 1
              Forgot to mention, this code is on the pages in the movieclip 'slidingpages'. 'Slidingpages' is in its own layer in the main time line.

              i.e.,

              Root - - Slidingpages
              - menu
              • 4. Re: Targeting issue
                kglad Adobe Community Professional & MVP
                you have a path reference problem with endX and endY unless your clipevents are attached to the movieclip that contains those mouse handlers.

                to check, use a trace("handler "+endX) in one of those handlers and trace("clipevent "+endX) in your enterFrame handler.
                • 5. Re: Targeting issue
                  Xcelsia Level 1
                  Sorry for being a bit of a Flash novice, but if it works with _root i dont understand wht there would be a problem with the endX and endY.

                  I have basically followed this tutorial:

                  http://www.aevision.com/tutorials/flash_sliding_pages2.htm

                  The only difference being that rather than having my buttons on the root tiimeline as in the tutorial, they are are within a movieclip menu that i am having popup on rollover.

                  Would it be better to use attachmovieclip for the menu movieclip rather than to have it in the timeline and keyframed? Could i then use:

                  _root.menu_mc.buttonName.onRelease?
                  • 6. Re: Targeting issue
                    kglad Adobe Community Professional & MVP
                    what's the output of those trace statements?
                    • 7. Re: Targeting issue
                      Xcelsia Level 1
                      All sorted now.

                      Thanks for your help kglad.

                      The problem was that one of the instance names was duplicated so even though the instance and movieclip were specified, there was confusion as to which instance was the target.
                      • 8. Re: Targeting issue
                        kglad Adobe Community Professional & MVP
                        you're welcome.