20 Replies Latest reply: Mar 12, 2012 7:12 AM by kglad RSS

    Stop the buttons becoming click-able but still hover

    andersonOllie Community Member

      Hi guys,

       

      I have a flow chart, the Flash works perfectly, no problems, however i am using the multiple screens on Powerpoint slides in a program called Articulate (a simple program to house things like this as a whole media object on a website etc).

      The only issue with this is that i need to add links on top of each button on the page, which link to other slides in the presentation. So not hyperlinks in the Flash code, slide-hyperlinks in Powerpoint.

       

      The Flash code should be enough to make the shapes have hover states, but not be a 'button', if that makes any sense? The hyperlink shapes i add on afterwards in Powerpoint should be the clickable areas with the cursor turning to a hand, but the Flash code by itself should just have a hover state with the cursor staying as an arrow.

       

      Does that make sense?

       

      Here's the code -

       

      var tl:MovieClip=this;

       

      for(var i = 1; i < 30; i++){

      tl["mc"+i].ivar=i;

       

      tl["mc"+i].onRollOver=function(){

      tl["but"+this.ivar].gotoAndStop(2);

      }

      tl["mc"+i].onRollOut=function(){

      tl["but"+this.ivar].gotoAndStop(1);

      }

       

      }

       

       

      Thanks!

      Ollie

        • 1. Re: Stop the buttons becoming click-able but still hover
          andersonOllie Community Member

          To really simplify;

          I'd like the buttons on the flow chart i've made to keep the hover function (changing colour) but not be click-able.

           

          Ollie

          • 2. Re: Stop the buttons becoming click-able but still hover
            prodigalmaster Community Member

            See if the mouse it hitting the button, then change the state of the movieclip if it is hitting or not.

             

            onMouseMove = function () {

                      if (buttonMovieClipName.hitTest(_xmouse, _ymouse, true)) {

                                trace("hitting");

              // add code here

                      } else {

                   trace("not hitting");

                   // add code here

              }

            };

            • 3. Re: Stop the buttons becoming click-able but still hover
              Ned Murphy MVP

              If you d not assign onRelease functionality to the movieclips they will not react tio being clicked.  To keep them from displaying the hand cursor you can set the useHandCursor property to false

              • 4. Re: Stop the buttons becoming click-able but still hover
                andersonOllie Community Member

                Thanks for the help!

                 

                Ned i have utilised the useHandCursor function and have got it to work for individual movieclips (eg  mc7.useHandCursor = false;), how can i set it for ALL movieclips? In my original code above the 'mc' is what i want to effect with the HandCursor. I have tried using;

                 

                movieClip.useHandCursor = false;

                mc.useHandCursor = false;

                 

                and a few other variants but nothing works so far.

                • 5. Re: Stop the buttons becoming click-able but still hover
                  andersonOllie Community Member

                  Prodigalmaster i don't follow exactly, i'm no Flash expert.

                  The 'add code here' sections, what do i add there? I presume one is my original code?

                   

                  I suppose maybe this is more complex than i first stated, i have tested my problem with the new removed cursor, for mc7 for example, in Articulate (the program we are using to house the flash objects) and it still doesnt link, even though the cursor stays as default (arrow).

                  My code has no 'onRelease' function so i don't know exactly what is giving them the button properties.

                   

                  I'd like the flow chart shapes to change colour when hovered but have no button properties i suppose?

                   

                  This is a working example before some recent changes were made, i don't know if it is any help -

                   

                  for(var x = 1; x < 8; x++)

                  {

                  var currentBut = eval("but"+x);

                  currentBut.onMouseMove = function(){

                  if(this._xmouse > 0 && this._xmouse < this._width && this._ymouse > 0 && this._ymouse < this._height){

                  this.gotoAndStop(2);

                  }

                  else

                  {

                  this.gotoAndStop(1);

                  }

                  };

                  }

                   

                  Thanks both!

                  • 6. Re: Stop the buttons becoming click-able but still hover
                    Ned Murphy MVP

                    It would be something along the lines of changing this portion of the code you showed to add that line...

                     

                    for(var i = 1; i < 30; i++){

                    tl["mc"+i].useHandCursor = false;

                    tl["mc"+i].ivar=i;

                     

                    tl["mc"+i].onRollOver=function(){

                    tl["but"+this.ivar].gotoAndStop(2);

                    }

                    tl["mc"+i].onRollOut=function(){

                    tl["but"+this.ivar].gotoAndStop(1);

                    }

                     

                    }

                    • 7. Re: Stop the buttons becoming click-able but still hover
                      andersonOllie Community Member

                      That's great Ned, that has sorted the arrow symbol for each of the movie clip shapes!

                      Still the problem of the links not working in Articulate though (essentially Microsoft Powerpoint slides packaged together).

                       

                      As i said, i think it's something to do with the movieclip button functionality, rather than just force removing the handcursor.

                       

                      One of those beautiful Flash moments where one small detail leaves you pulling your hair out

                      • 8. Re: Stop the buttons becoming click-able but still hover
                        andersonOllie Community Member

                        Bump.

                         

                        Anyone got a fix for this? It's driving me crazy!

                        • 9. Re: Stop the buttons becoming click-able but still hover
                          Ned Murphy MVP

                          I thought you said the other buttons are not part of the Flash file.  If that's the case, then there isn't much you can do in the Flash file to fix the other file.  The only thing I can see that might be the problem is that the Flash buttons might block the other buttons, thus rendering them unusable.  If that's the case, then you might need to rethink your approach.

                          • 10. Re: Stop the buttons becoming click-able but still hover
                            andersonOllie Community Member

                            That's probably right Ned, damn.

                            The other code i posted up though is a working Flash file someone im workign with has used in the past. That code allows the clear buttons to work over the top of the Flash but still uses the hover colour change of the Flash code.

                             

                            Here it is again -

                             

                            for(var x = 1; x < 8; x++)

                            {

                            var currentBut = eval("but"+x);

                            currentBut.onMouseMove = function(){

                            if(this._xmouse > 0 && this._xmouse < this._width && this._ymouse > 0 && this._ymouse < this._height){

                            this.gotoAndStop(2);

                            }

                            else

                            {

                            this.gotoAndStop(1);

                            }

                            };

                            }

                             

                            If you guys can't help then i'm definitely re-thinking it

                            • 11. Re: Stop the buttons becoming click-able but still hover
                              andersonOllie Community Member

                              Can anyone see anythign in the above code that would take out the functionality of a movieclip button?

                              • 12. Re: Stop the buttons becoming click-able but still hover
                                kglad MVP

                                (ned's stumped because you're posting confusing info.  what does this hover-stuff have to do with your links in articulate?)

                                • 13. Re: Stop the buttons becoming click-able but still hover
                                  andersonOllie Community Member

                                  Sorry, it's a confusing problem

                                   

                                   

                                  To strip this down...

                                  I'd like to see if there was a way of removing any 'button' (clickable) functionality from my movieclips. So they are not usable at all, but still are effected when hovered.

                                  I think this is what is interfering with the Articulate usability.

                                   

                                  The last code i posted is a working code i received from a colleague doing the same thing. He has made everything in Flash and bundled it into Articulate in the same way and his works correctly. eg his flash objects dont block the Articulate links.

                                  There is no issue with Articulate, it is just something i need to edit in the Flash code. Essentially making the objects unusable (there purely as images) which indicate when hovered.

                                   

                                  I'm hoping the codes i have provided will lead to an answer.

                                   

                                  Thanks guys, sorry if this makes no sense it's hard to explain as i'm not an expert.

                                  • 14. Re: Stop the buttons becoming click-able but still hover
                                    kglad MVP

                                    I'd like to see if there was a way of removing any 'button' (clickable) functionality from my movieclips. So they are not usable at all, but still are effected when hovered.

                                    yes, delete your buttons' onRelease and/or onPress handlers.  for example,

                                     

                                    delete yourbutton.onRelease;

                                    • 15. Re: Stop the buttons becoming click-able but still hover
                                      andersonOllie Community Member

                                      Thanks kglad, i hope we're on the right track!

                                      This is the code im using and there doesn't appear to be a onRelease or onPress handle etc.

                                       

                                      var tl:MovieClip=this;

                                       

                                      for(var i = 1; i < 30; i++){

                                      tl["mc"+i].ivar=i;

                                       

                                      tl["mc"+i].onRollOver=function(){

                                      tl["but"+this.ivar].gotoAndStop(2);

                                      }

                                      tl["mc"+i].onRollOut=function(){

                                      tl["but"+this.ivar].gotoAndStop(1);

                                      }

                                       

                                      }

                                       

                                       

                                      The code my colleague sent me that does work is as follows, do you think it could be HOW the code is written eg there must be a hand full of ways to do this type of thing and maybe i've just gone down the wrong route with the tl["but"+... etc?

                                       

                                      for(var x = 1; x < 8; x++)

                                      {

                                      var currentBut = eval("but"+x);

                                      currentBut.onMouseMove = function(){

                                      if(this._xmouse > 0 && this._xmouse < this._width && this._ymouse > 0 && this._ymouse < this._height){

                                      this.gotoAndStop(2);

                                      }

                                      else

                                      {

                                      this.gotoAndStop(1);

                                      }

                                      };

                                      }

                                       

                                      I think this shall be my last attempt

                                      It seems to be confusing everyone

                                      • 16. Re: Stop the buttons becoming click-able but still hover
                                        kglad MVP

                                        if:

                                         

                                        var tl:MovieClip=this;

                                         

                                        for(var i = 1; i < 30; i++){

                                        tl["mc"+i].ivar=i;

                                         

                                        tl["mc"+i].onRollOver=function(){

                                        tl["but"+this.ivar].gotoAndStop(2);

                                        }

                                        tl["mc"+i].onRollOut=function(){

                                        tl["but"+this.ivar].gotoAndStop(1);

                                        }

                                         

                                        }

                                         

                                        were the only code you were using the above movieclips would not respond to a mouse click, on the rollover and rollout.  do your movieclips respond to a click?  if yes, there's code elsewhere causing that. 

                                         

                                        use movie explorer to find that code.

                                        • 17. Re: Stop the buttons becoming click-able but still hover
                                          andersonOllie Community Member

                                          This is the only code (aside from 'stops') in the entire document.

                                          The shapes don't respond to clicks, but the cursor was turning to a hand when hovering. Is that normal? The cursor has been forced to stay as a cursor now, and not turn to a hand when hovering but i think the functionality causing it to turn to a hand is still there...

                                          I just don't know what that reason is.

                                          Sorry for having such a ridiculously difficult issue...

                                          • 18. Re: Stop the buttons becoming click-able but still hover
                                            kglad MVP

                                            ned already showed you how to stop the hand from turning to a cursor on rollover in message 6 and you acknowledged that he solved that problem.

                                            • 19. Re: Stop the buttons becoming click-able but still hover
                                              andersonOllie Community Member

                                              That was fixed a while back by Ned yes, the cursor doesnt turn to a hand anymore but i wondered if the functionality of the HAND is still there hiding underneath?

                                              Such a difficult thing to explain when you don't fully understand.

                                              • 20. Re: Stop the buttons becoming click-able but still hover
                                                kglad MVP

                                                if you're asking whether the buttons are still undergoing a rollover and rollout, the answer is yes.  if you want to remove their rollover and rollout, use:

                                                 

                                                for(var i = 1; i < 30; i++){

                                                delete tl["mc"+i].onRollOver;

                                                delete tl["mc"+i].onRollOut;

                                                }