Alternate click states

I have a project whose buttons animate pretty heavily on interaction. So, when you mouse over a button, it increases in scale, and has two states per button – i have figured that out with your help.
My next big question, pertains to the orange buttons found in the "let me" explore section of this site:
www.straightlinenyc.com/introduction/launch.html
If you mouse over the orange buttons (only the ones that pop alone, if they pop with another bubble somewhere, those are the wrong ones) it pops up with the appropriate words inside, as you see, when you click on these, they change to give you a definition of that word, and when you click again it goes back.
I guess my question is, should i use a boolean to accomplish this? the click state change makes sense to me, but the second click is kind of throwing me for a loop.
I just need some help in how to approach these? If i was not clear enough, just let me know, and i will try to be more specific.

Ok, as usual I said "great, thanks" too early. I am not quite getting the toggle functionality, so thought I would show you what I am trying to do, and someone could be a dear with the coding? Just watched a lot of tutorials, but not quite there.
My button instance name: btn_disCase
The frame labels I want to reference: clickOne, and clickTwo (these are the frame labels within the moviclip)
So yes, pretty much I want the button to toggle between these frames with the mouse click (while over the mc obviously). So, here was my attempt:
btn_disCase.buttonState = "on";
btn_disCase.addEventListener(MouseEvent.CLICK, disToggle);
function disToggle(e:MouseEvent){
     if(e.currentTarget.toggle){
     btn_disCase.gotoAndPlay ("clickTwo")
     else {
     btn_disCase.gotoAndPlay ("clickOne")
e.currentTarget.toggle=!e.currentTarget.toggle;
Obviously, it is pretty flawed, and honestly I am not sure what the ! stands for in your suggestions. Thanks.

Similar Messages

  • Conditional Click States

    Hello, I have a brief kind of hit state question, I have a button hit state called btnWorkH, below is the start of my code to make it functional. The idea being, that when someone clicks the button, I add a child to the top, to make it look like it has been clicked and is maintaining an alternate color. How would I code this so that it becomes a toggle? As, I need a click (once this action has been performed) that removes the child... just not sure how to write the condition for this.
    Thanks all!
    btnWorkH.addEventListener (MouseEvent.CLICK, workClick);
    function workClick (e:MouseEvent):void{
        addChild (workO);
        workO.x = 62.5;
        workO.y = 109.3;
        addChild (txtAmy);
        txtAmy.x = 105.1;
        txtAmy.y = 109.3;

    maybe i could be a bit more specific for this help, pertaining to Neds option:
    mc to be interacted with = btnWork
    it's hit area being = btnWorkH
    It's rollover / rollout / click states = workOver, workOut, and workClick (the last setting the link to the colored "stay" state)
    so, my attempt at your code would be as follows:
    var workClicked:Boolean = false;
    btnWorkH.addEventListener (MouseEvent.CLICK, workClick);
    function workClick (e:MouseEvent):void{
         if (workClicked){
         btnWork.gotoAndStop ("workClick");
         clicked = false;
         addChild (txtAmy);
         txtAmy.x = 00
         txtAmy.y = 00
    }    else{
         btnWork.gotoAndStop ("work");
         clicked =true;
         removeChild (txtAmy);
    (that last "work" being the normal rest state of the mc).
    I know this is flawed, still working on it, but just thought it may help me get this quicker to show you what I am seeing?

  • How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)

    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    3° Ive created buttons linking pages..
    - "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'
    - what should i do?
    5° Once i export it into Swf. how how can i visualize it? or put it online?
    Thank you for your time.

    stlbbl4u wrote:
    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    You should setup Object Styles - these can also include Paragarph Styles that can be triggered when the Style is selected.
    http://help.adobe.com/en_US/indesign/cs/using/WS5CEDB81A-0011-4dc9-9DE8-AC7AD4C80076a.html
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    I'm not sure what you mean - I don't do files with Animations
    3° Ive created buttons linking pages..- "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    Does it work properly when you export it to the finished file?
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'- what should i do?
    InDesign won't link directly to youtube videos. I think your best bet would be to use Downloader to download the video and embed them directly in Indesign.
    5° Once i export it into Swf. how how can i visualize it? or put it online? 
    Thank you for your time.
    You can look up how to embed a SWF file into your HTML - but it depends what you mean by "online" there's a dozen ways to get a file "online".

  • Button Click State - Broken?

    Just recently I'm noticing that there's something strange going on with button states.
    I've got an MSO set up as a slideshow with 4 images.
    I've got 4 buttons in a row below the image area.
    Normally the first button will be shown in it's 'click' state, to reflect the first image in the object state stack.  Now, however, this appears to be broken.  Sometimes the click state won't show up at all, while other times the 2nd button in the row is in the click state - yet the first image in the stack is presented.
    Anyone know what's going on?

    With the folio and article preview on the desktop it's working perfectly....just not the iPad version in the Content Viewer....
    also: When you jiggle the page in the Content Viewer, the click button state will show up. Hah!
    EDIT:
    Okay, I thought I had narrowed down the problem.  The issue would arise when I would change the object order in the stacks.  When I changed them back to appear in the same order as the images that were placed, the problem would go away.  However, when I rearranged the stack order again everything was still okay...the click button state would show up properly as usual.  ???

  • Bluetooth mouse alternate click mountain lion

    My magic mouse (bluetooth) right click (alternate click) stopped working after upgrading to Mountain Lion. I tried the following: verified that the mouse settings were correct, rebooted, and rebooted with shift key to be in safe mode. I tried logging in as a different user on my iMac.
    I tried using a USB mouse and the right click worked, so the problem seems to be associated with the bluetooth magic mouse.
    The mouse is not at fault: I rebooted from a Snow Leopard hard drive and the right click worked fine. I also tried the magic mouse with another mac and the mouse worked fine. 
    My guess is that there is a library/preferences file with an incorrect or corrupted setting. If so, which one (e.g., com.apple.Bluetooth.plist, com.apple.Bluetooth.plist.lockfile, other ...)? And is it OK to delete the file?

    Bump.

  • Duplicate action in click state to touchstart state

    Wishful thinking?
    I am creating an interactive map with lots of actions:
    San Diego Gaslamp Interactive Walking Map
    All the buttons have rollover, rollout and click actions.
    When using on a tablet, the touch action invokes the rollover state.
    So users have to click once to get the rollover state, then again to get the click state.
    THIS FIXED IT:
    I copied the code in the "click" state to a "touchstart" state and it worked properly.
    However, I have SO MANY buttons to change and was wondering if anyone had an easy way to do this.
    Any help would be greatly appreciated. Thanks!

    Hi,
    33,500 lines of code: it's a lot for smartphones and tablets.
    For instance, you can group events: oneTarget.bind( "click touchstart", function(){ sym.play(aLabel") } );
    It seems you can create your menu using sym.createChildSymbol().
    Can you send me your composition using a private message?

  • Roll over and click states don't work in CC Folio Preview

    I'm working to get all the settings right
    before i go much further in this project, which
    is a PDF version for Ipad. Any input appreciated...
    got to be simple...
    the link works but different states do not.
    "button 1" on release or tap go to next page
    appearance: diff. colors on normal, rollover, click set
    hidden until triggered checked but have tried both ways
    preview settings: auto, jpeg max

    Folio Preview is only for Digital Publishing Suite projects, not for PDF output.
    The best way to preview a PDF is to make the PDF and view the PDF in Adobe Reader or Adobe Acrobat.

  • Alternate sequece statement to bring it to initail value

    i have created sequence seq_1 and in after running the procedure i want to bring it to zero how should i .when i use this alter statement i am finding errror could u please help it what is the alternate sequece st to bring it to initail value
    ALTER SEQUENCE seq_1 MINVALUE 0;

    You can either drop and recreate and sequence.
    OR
    ALTER SEQUENCE seq_1 INCREMENT BY -<max_value_of_sequence>

  • Onclick gives issues in IE with comman link and works in alternate clicks

    We need the working of the onclick to be persistent here.
    But it is not.
    <h:column id="column11">
    <f:facet name="header">
    <h:outputText value="" id="readingCol"></h:outputText>
    </f:facet>
    <h:commandLink id="readingLink" onmousedown="return func_2(this, event);" action="#{pc_MeterSelect.doReadingLinkAction}" >
    <h:outputText id="text48"
    value="#{msgs.lnk_reading}"></h:outputText>
    <f:param name="meterID" value="#{varmeterRecords.meterID}" />
    </h:commandLink>
    </h:column>
         function func_2(thisObj, thisEvent) {
    //use 'thisObj' to refer directly to this component instead of keyword 'this'
    //use 'thisEvent' to refer to the event generated instead of keyword 'event'
    thisObj.onclick();
    }

    Can you explain better what is the problem?

  • Help with alternate sql statement?

    I have the following setup:
    create table sc_t1
    ( n1 number, n2 number, n3 number, constraint sc_t1_pk primary key ( n1 ) );
    create table sc_t2
    ( n1 number, n2 number, primary key ( n1 ) )
    organization index;
    insert into sc_t1 values ( 1, 2, 1);
    insert into sc_t1 values ( 2, 1, 1);
    insert into sc_t1 values ( 3, null, null );
    insert into sc_t1 values ( 4, null, null );
    insert into sc_t2 values ( 1, 11 );
    insert into sc_t2 values ( 2, 12 );
    insert into sc_t2 values ( 3, 13 );
    insert into sc_t2 values ( 5, 15 );
    I would like to see the following result:
    11      12      11
    12      11      11
    13           
    The following query achieves the result, but it joins sc_t2 three times. Is there a way have just one join because tables sc_t1 and sc_t2 will have 1,000,000+ rows.
    select b.n2 as r1
    , nvl2( a.n2, c.n2,null ) as r2
    , nvl2( a.n3, d.n2, null ) as r3
    from sc_t1 a
    join sc_t2 b on a.n1 = b.n1
    join sc_t2 c on nvl( a.n2, a.n1 ) = c.n1
    join sc_t2 d on nvl( a.n3, a.n1 ) = d.n1;
    I was hoping to pivot the result from the following query, but it returns only two instead of three rows per row in sc_t1:
    select a.*
    , b.*
    , row_number() over ( partition by a.n1 order by a.n1 ) as rn
    from sc_t1 a
    join sc_t2 b
    on a.n1 = b.n1
    or nvl( a.n2, a.n1 ) = b.n1
    or nvl( a.n3, a.n1 ) = b.n1
    /

    you MUST join it 3 times. if it's slow, make indexes
    select b.n2 as r1, c.n2 as r2, d.n2as r3
    from sc_t1 a, sc_t2 b, sc_t2 c, sc_t2 d
    where a.n1 = b.n1
    and a.n2 = c.n1(+)
    and a.n3 = d.n1(+)

  • Change state with timer as well as with mouse click?

    I would like to set up an image with two states, "State 1" and "State 2"
    I would like the button to toggle between "State 1" and "State 2" onMouseDown.
    But I would also like the button to alternate between "State 1" and "State 2" on its own every 3 seconds.
    Can you tell me how to set this up?

    This should get you started:
    http://www.playingwithfire.com/fun.html

  • No "clicked" button state?

    In DreamWeaver CS5 I want to add menu buttons to my home page and am using the insert Images: Rollover Image function. Looks great for original and rollover states but there is no provision for "clicked" state. How may I make my button act in a clicked state? I have the graphics for all three states. Is there a better way to handle menus buttons?

    Just to clarify, the link pseudo-classes are as follows:
    a {} /**all links**/
    a:link {}  /**unvisited**/
    a:visited {} /**visited**/
    a:hover {} /**on mouseover**/
    a:active {} /**onclick**/
    a:focus {} /**on tabkey**/
    Menu highlighting can be achieved with any anchor class name you desire -- "current"  "foo"  "whatever"   But a:active has a particular purpose.   This CSS Button Sprite Demo shows active & focus in action.
    http://alt-web.com/DEMOS/CSS-Button-Sprite.shtml
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • JTable display cell previous/last selected/edited/clicked value/JComponent

    I have a problem with the minesweeper I made,
    The game board is a JTable containing custom gadgets in the cells,
    The first game goes without problem, but I press the JButton starting a new game,
    I randomly refill the JTable with new custom gadgets,
    My problem is that the last cell I clicked in the JTable is still in the clicked state with the previous value and I cannot click or see the new custom gadget that ought to be there ...
    The custom gadgets extends JLabel and use custom AbstractCellEditor and custom TableCellRenderer, but I think it is not related to my custom gadgets,
    I work on OSX,
    Any hint to my problem's origin?
    Any solutions?

    My code included not related classes I eliminated to use only standard java classes,
    here is is the minimal code for my mine sweeper reproducing the problem on the third launch
    any hint? :
    import java.awt.Container;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.MouseEvent;
    import java.util.Random;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableModel;
    public class MyMineSweeper
       private class JTableCellRenderer implements javax.swing.table.TableCellRenderer
          private javax.swing.table.TableCellRenderer defaultRenderer;
          public JTableCellRenderer(javax.swing.table.TableCellRenderer aRenderer)
             defaultRenderer = aRenderer;
          public java.awt.Component getTableCellRendererComponent(javax.swing.JTable aTable, Object anElement, boolean isSelected, boolean hasFocus, int aRow, int aColumn)
             if(anElement instanceof javax.swing.JComponent)
                return (javax.swing.JComponent)anElement;
             return defaultRenderer.getTableCellRendererComponent(aTable, anElement, isSelected, hasFocus, aRow, aColumn);
       private class JTableCellEditor extends javax.swing.AbstractCellEditor implements javax.swing.table.TableCellEditor
          private javax.swing.JComponent component;
          private int theClickCountToStart = 0;
          public java.awt.Component getTableCellEditorComponent(javax.swing.JTable aTable, Object anElement, boolean isSelected, int aRow, int aColumn)
             component = (javax.swing.JComponent) anElement;
             return component;
          public Object getCellEditorValue()
             return component;
          public boolean isCellEditable(java.util.EventObject anEvent)
             if(anEvent instanceof java.awt.event.MouseEvent)
                return ((java.awt.event.MouseEvent)anEvent).getClickCount() >= theClickCountToStart;
             return true;
          public int getClickCountToStart()
             return theClickCountToStart;
          public void setClickCountToStart(int aClickCountToStart)
             theClickCountToStart = aClickCountToStart;
       private class Tile extends javax.swing.JLabel
          public class JTileMouseListener implements java.awt.event.MouseListener
             public void mouseClicked(MouseEvent e)
                if(isRevealed()==false)
                   reveal();
             public void mousePressed(MouseEvent e)
             public void mouseReleased(MouseEvent e)
             public void mouseEntered(MouseEvent e)
             public void mouseExited(MouseEvent e)
            public void reveal(int aY, int anX)
               Tile tile = ((Tile)theMapModel.getValueAt(aY, anX));
               if(tile.isRevealed()==false)
                  tile.reveal();
            public void changed()
               if(theNeighbourCount==0)
                  if(theX>0)
                     if(theY>0)
                        reveal(theY-1, theX-1);
                     reveal(theY, theX-1);
                     if(theY<theMapModel.getRowCount()-1)
                        reveal(theY+1, theX-1);
                  if(theY>0)
                     reveal(theY-1, theX);
                  if(theY<theMapModel.getRowCount()-1)
                     reveal(theY+1, theX);
                  if(theX<theMapModel.getColumnCount()-1)
                     if(theY>0)
                        reveal(theY-1, theX+1);
                     reveal(theY, theX+1);
                     if(theY<theMapModel.getRowCount()-1)
                         reveal(theY+1, theX+1);
                   setBackground(java.awt.Color.WHITE);
                else if(theNeighbourCount==9)
                   setText("*");
                   setBackground(java.awt.Color.RED);
                   System.out.println("no!");
                   theMap.setEnabled(false);
                else
                   setText(String.valueOf(theNeighbourCount));
                   setBackground(java.awt.Color.WHITE);
                setBorder(javax.swing.BorderFactory.createEmptyBorder());
                if(isFinished()==true)
                   System.out.println("victory!");
                   theMap.setEnabled(false);
                theMapModel.fireTableCellUpdated(theY,theX);
          private DefaultTableModel theMapModel;
          private int theX;
          private int theY;
          private short theNeighbourCount;
          protected boolean revealed = false;
          public Tile(int aYIndex, int anXIndex, short aNeighbourCount)
             theMapModel = (DefaultTableModel)theMap.getModel();
             theX = anXIndex;
             theY = aYIndex;
             theNeighbourCount = aNeighbourCount;
             addMouseListener(new JTileMouseListener());
             setOpaque(true);
             setHorizontalAlignment(CENTER);
             setBackground(java.awt.Color.LIGHT_GRAY);
             setBorder(javax.swing.BorderFactory.createRaisedBevelBorder());
             setSize(getHeight(), getHeight());
          public void reveal()
             revealed = true;
             theRevealedTileCount +=1;
             changed();
          public boolean isRevealed()
             return revealed;
       private JFrame theFrame;
       private JTable theMap;
       private int theMapSize = 10;
       private int theTrapCount = 5;
       private int theRevealedTileCount = 0;
       private void startGame()
          Point[] traps = new Point[theTrapCount];
          Random generator = new Random();
          for(int trapIndex = 0; trapIndex<theTrapCount; trapIndex+=1)
             Point newPoint = null;
             boolean alreadyTrapped = true;
             while(alreadyTrapped==true)
                newPoint = new Point(generator.nextInt(theMapSize-1), generator.nextInt(theMapSize-1));
                alreadyTrapped = false;
                for(int existingTrapIndex= 0; existingTrapIndex<trapIndex;existingTrapIndex++)
                   if(newPoint.equals(traps[existingTrapIndex])) alreadyTrapped = true;
             traps[trapIndex] = newPoint;
          TableModel mapModel = theMap.getModel();
          for(int yIndex = 0; yIndex<theMapSize; yIndex+=1)
             for(int xIndex = 0; xIndex<theMapSize; xIndex+=1)
                short neighbours = 0;
                int x = 0;
                int y = 0;
                for(int trapIndex = 0; trapIndex<theTrapCount; trapIndex+=1)
                   x = traps[trapIndex].x - xIndex;
                   y = traps[trapIndex].y - yIndex;
                   if(x==0 && y==0)
                      trapIndex = theTrapCount;
                   else if((x==1 || x==-1) && (y==1 || y==-1))
                      neighbours += 1;
                   else if((x==0) && (y==1 || y==-1))
                      neighbours += 1;
                   else if((x==1 || x==-1) && (y==0))
                      neighbours += 1;
                if(x==0 && y==0)
                   mapModel.setValueAt(new Tile(yIndex, xIndex, (short) 9), yIndex, xIndex);
                else
                   mapModel.setValueAt(new Tile(yIndex, xIndex, neighbours), yIndex, xIndex);
          theRevealedTileCount  = 0;
          theMap.setEnabled(true);
       private boolean isFinished()
          return ((theMapSize*theMapSize)-theRevealedTileCount)==theTrapCount;
       public MyMineSweeper()
          theFrame = new javax.swing.JFrame("mine sweeper");
          JPanel cp = new JPanel();
          theMap = new JTable(new DefaultTableModel(10,10)
             public Class getColumnClass(int column)
                return getValueAt(0, column).getClass();
          theMap.setDefaultRenderer(JComponent.class, new JTableCellRenderer(theMap.getDefaultRenderer(JComponent.class)));
          JTableCellEditor editor = new JTableCellEditor();
          theMap.setDefaultEditor(JComponent.class, editor);
          editor.setClickCountToStart(0);
          theMap.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
          startGame();
          cp.add(theMap);
          Action newGameAction = new AbstractAction("new game")
             public void actionPerformed(ActionEvent e)
                startGame();
          JButton newGameTrigger = new JButton(newGameAction);
          cp.add(newGameTrigger);
          theFrame.getContentPane().add(cp);
          theFrame.pack();
          theFrame.show();
       public JFrame getFrame()
          return theFrame;
      }

  • Set the state of an interactive button

    I would like to use interactiev buttons in my document, but set the state on each page so it seems like it is selected (similar to a web page). Is there a way to do this easily? I cannot seem to get it to stic when I export as a pdf. On screen it looks like the ocrrect state is active, but when I save as a pdf with interactivity selected, it goes away... Please help. I am attaching a pdf. I would like on the first page first button the state would be the "on click" state (reverse blue text on white), and then on page two the same

    I guess you should create two separate buttons, one for normal state, another for clicked state. Place them stacked, normal state on the top. Then you place a Hide Button action to it. When user clicks it, it hides itself and clicked state button becomes visible....
    (haven´t tried this, I just guess it could work....)

  • Button/multi state query

    Hello all
    I’m encountering a challenge which I believe has been discussed on these forums.
    This relates to pixelated, blurry text within buttons and multi-state objects.
    One solution to this issue is not using the objects containing text as buttons or multi-state objects. Instead, you insert shapes with no fill/stroke on top of text graphics and then grouping them.
    This ensures the text is sharp and clear.
    However, if you wish to have a roll over state, with a different fill/stroke/text colour as part of the roll-over state, then this poses problems as the shape serving as a button has to have no fill/stroke or text within them.
    Has around a work around for this problem?
    Many thanks
    H

    For clear buttons with click states, the easiest workaround is to place a dummy button over the image and change the stroke and perhaps even add a transparency fill. There is another more complicated workaround as well. For examples and instructions, see DPS Tips > Advanced Overlays > Sharp Buttons.
    http://contentviewer.adobe.com/s/DPS%20Tips/7f80a0ffed3a4ff08734bc905aac4a29/Advanced_Over lays/12_button_crisp.html

Maybe you are looking for