20 Replies Latest reply on Nov 12, 2006 10:16 AM by kglad

    movie clip draggable button

    atmadaenygma
      Here is the code I have so far. it has been driving me nuts in my attempt to make my homepage the problem is it will not read the gotoAndPlay command to take the overall movie to frame 5 and then stop. seems easy and not overwelming but no matter what i do it does not work.

      here is the code please help.

      //about button commands
      var mcAbout:MovieClip;
      mcAbout.onPress = function(){
      startDrag("mcAbout");
      }
      mcAbout.onRelease = function(){
      stopDrag();
      }
      var mcAbout:MovieClip
      mcAbout.onRollOver = function(){
      mcAbout.gotoAndPlay("rollover");
      }
      mcAbout.onRollOut = function(){
      mcAbout.gotoAndPlay("rollout");
      }
      mcAbout.onMouseDown= function(){
      mcAbout.gotoAndPlay(5);
      }
        • 1. Re: movie clip draggable button
          kglad Adobe Community Professional & MVP
          onMouseDown methods execute each time the mouse button is pressed, no matter where the cursor is located (as long as flash has focus).
          • 2. Re: movie clip draggable button
            atmadaenygma Level 1
            focus? sorry what do you mean by focus?
            • 3. Re: movie clip draggable button
              kglad Adobe Community Professional & MVP
              i mean once you click on the stage of your swf, it has focus. if you click on your desktop, your swf won't have focus.
              • 4. Re: movie clip draggable button
                atmadaenygma Level 1
                Hmm. no that doesnt seem to do anything, focus seems to be correct. I did a trace and it acts as a button correctly in the trace. I am wondering maybe I do not give enough time to load page completely or something. I saw that somewhere but I do not know how to fix stuff like that.

                I was wondering though is there a way to set up a double click command for the button kinda like the OS'es have to open new programs? I would prefer this page to act just like a OS.
                • 5. Re: movie clip draggable button
                  kglad Adobe Community Professional & MVP
                  do you only have one button? is mcAbout the only button that goes to its frame 5 when the left mouse button is pressed?
                  • 6. movie clip draggable button
                    atmadaenygma Level 1
                    Currently I am working with just one button thats SUPPOSED to go to frame 5 but it does nothing.

                    my design tree is as follows.

                    mcAbout ->about me and my resume. 2 tags hoping to use another movieclip button system to make them work in one frame
                    mcEmail -> contact and maybe a form. 1
                    mcGalleries ->print portfolio, my html websites, and my flash websites. (it is my hope to be able to do this using the xml connector and writting my own xml pages which will most likly lead to more questions if the tutorials dont help lol.) 3 tags in one movie clip i hope
                    mcIdoors-> will go to a movie that explains the product (that i will be making as a swf. file) and a paypal account.

                    there will be no home page so to speak with some comments just a page that you know wil lead to more things as you explore the website.

                    The website is supposed to be kept as simple as possible although my protfolio is quiet extensive. the overall goal is to have extreme ease of use, while keeping a very hard to do look to it. so that people who look at it will want it and know they cant just do it with a template website program.

                    and i want to thank you Kglad for being so responive to my posts.
                    • 7. Re: movie clip draggable button
                      Thepoor13
                      quote:



                      //about button commands
                      var mcAbout:MovieClip;
                      mcAbout.onPress = function(){
                      startDrag("mcAbout");
                      }


                      mcAbout.onPress=function(){
                      startDrag(this,true);
                      }
                      • 8. Re: movie clip draggable button
                        kglad Adobe Community Professional & MVP
                        then you really want to direct the _root or main timeline to frame 5? (if so, use _root.gotoAndPlay(5) ) or do you really want to direct mcAbout to its frame 5?

                        and i'm pretty sure you don't want to use onMouseDown.
                        • 9. Re: movie clip draggable button
                          atmadaenygma Level 1
                          You are right, I do not want to use on mouse down what I would like to do is have a double clikc thing but did not see their is no code for onDoubleMouseClick or something.

                          I jsut tried out your root and it worked thank you so much this has been driving me NUTS. my tutorials said nothing about roots. either that or I just did not get that far yet.

                          but thanks again.

                          and stay tuned I have the kinda personality that will get stuck again very soon.
                          • 10. Re: movie clip draggable button
                            kglad Adobe Community Professional & MVP
                            lol. you're welcome.
                            • 11. Re: movie clip draggable button
                              atmadaenygma Level 1
                              Ok here is my next question,

                              I put double click buttons in the search and several things came up. most of the things that were written were for the button symbol. I was told no tto use button symbols but instead use movie clips because they can do everything a button symbol can do and that a button symbol were just reprogrammed movieclips, but here is my question.

                              now that the button works and everything, it needs to be set up just like the windows xp OS in dragging were you would like then doing a double click.

                              how will can I write a double click for my movie clip button?
                              • 12. Re: movie clip draggable button
                                atmadaenygma Level 1
                                Ok here is my next question,

                                I put double click buttons in the search and several things came up. most of the things that were written were for the button symbol. I was told no tto use button symbols but instead use movie clips because they can do everything a button symbol can do and that a button symbol were just reprogrammed movieclips, but here is my question.

                                now that the button works and everything, it needs to be set up just like the windows xp OS in dragging were you would like then doing a double click.

                                how will can I write a double click for my movie clip button?

                                I googled it and it seems to need true and false statements but there was no direct code just to install in my system is there a way or place to dl premade actionscript?
                                • 13. Re: movie clip draggable button
                                  kglad Adobe Community Professional & MVP
                                  add the code you want to the single and double click sections:

                                  • 14. Re: movie clip draggable button
                                    atmadaenygma Level 1
                                    Man i wish i could just do this for a living and focus,

                                    anyway sorry for not responding had to work, work.

                                    I posted the website with your code and everything here is were you can see the website: http://www.bluelikethecolor.com/

                                    as you can see everything seems to be working just fine on rollover but when you press down it does drag but not correctly. as i am sure you can see. it drags but the mouse seems to slip of and then drag with the mouse way off. at times.

                                    the double click works but not exactly how I want it to work. it needs to be more tight.

                                    but so far it is exactly how i want the page to look and I think when done it will make a great showcase for my portfolio. thanksso much for your help.
                                    • 15. Re: movie clip draggable button
                                      atmadaenygma Level 1
                                      oh i forgot to post my code to get what it does:

                                      //mcAbout double click feature
                                      mcAbout.onPress = function() {
                                      clearInterval(mcAbout.clickI);
                                      mcAbout.clickI = setInterval(clickF, 300, mcAbout);
                                      clickF(mcAbout);
                                      };
                                      function clickF(mcAbout) {
                                      if (prevClickI == undefined) {
                                      prevClickI = mcAbout.clickI;
                                      } else {
                                      if (prevClickI != mcAbout.clickI) {
                                      gotoAndPlay (5);
                                      } else {
                                      startDrag(mcAbout);
                                      }
                                      clearInterval(mcABout.clickI);
                                      prevClickI = undefined;
                                      }
                                      }
                                      //mcabout stop drag
                                      mcAbout.onRelease = function(){
                                      stopDrag();
                                      }
                                      //mcAbout rollover
                                      var mcAbout:MovieClip
                                      mcAbout.onRollOver = function(){
                                      mcAbout.gotoAndPlay("rollover");
                                      }
                                      mcAbout.onRollOut = function(){
                                      mcAbout.gotoAndPlay("rollout");
                                      }
                                      • 16. Re: movie clip draggable button
                                        kglad Adobe Community Professional & MVP
                                        there, at least, two problems. first, there's a logic issue.

                                        if you want to start dragging your button with one click you'll need some way to stop dragging it and you can't use the onRelease handler because it may execute BEFORE the single click code executes.

                                        to understand this you must understand something about any and all techniques to detect and differentiate between a single and double click. by necessity, for a single click to be detected by a button that must check for a double click, some period of time must elapse before the button can conclude that it's been clicked once. it can't execute it's single click code during that time or it may execute that code and then find a 2nd click has arrived in time to qualify as a double click and you wouldn't want your button to execute its single and double click codes.

                                        therefore, if a user clicks and releases your button in normal rapid succession your button will execute its stopDrag() before its startDrag() resulting in your button being dragged.

                                        so, for a button that you want to sometimes drag and sometimes have execute other code, you should not use a single and double click technique. you should use one that detects a press and hold (startDrag) versus a press and release (execute single click code).

                                        and the second error, you misspelled mcAbout in clickF():

                                        • 17. Re: movie clip draggable button
                                          Tilly3434 Level 1
                                          Hey all,

                                          Dont want to crash in on the party because you guys are going back and forth well but i checked out ur site and just had one question. How the hek do u click off that bugger once you click on it?? I tried a few times and it just kept following me...

                                          Just thought i would put the question out there for you if you needed to work out more code for it??

                                          A
                                          • 18. Re: movie clip draggable button
                                            kglad Adobe Community Professional & MVP
                                            read my post just above yours, tilly.
                                            • 19. Re: movie clip draggable button
                                              atmadaenygma Level 1
                                              Ok I think I understand what you are talking about in the logic issue. I believe I will have to drop the drag feature for now and figure out how to make a press and hold action.

                                              I am going to see if I can make one and how to do that. looking through all this code really gives me a head ache, and thanks for catching the error on my mcAbout button. i double checked everything I guess I need to do a triple check for codes like this.

                                              After reading about double click it doesnt seem like a favorite of many flash coders so I will need to do something else to make the button a easy to use button. And I can't think of anything yet. so what iwill do is make the buttons stationary and make the other items draggable such as pictures and non buttons hopefully that will be a cool little gimmic.

                                              Thanks for your help I am guessing there is no pressand hold button and I am sure I will have some more questions.

                                              I saw somewhere someone make a real cool water ripple effect that distorted the image were ever you put the mouse. I think I would like to make something like that.
                                              • 20. Re: movie clip draggable button
                                                kglad Adobe Community Professional & MVP
                                                correct, there is no press and hold. you have to code for that.

                                                again, you would code an onPress to start checking what happens in the subsquent 300 milliseconds or so. if there's a release in that time, you have a single click (do whatever). if there's no release during that time, you have a press and hold (initiate a startDrag() ).