Mousedown

Alright, I did some searching around but couldn't find anything really similar to my situation (I was suprised) and with my google search some guy had the same problem, but the solution was a link that is now broken.
How do I make a script on my button that says "If the mouse is down, something happens?"
I don't want it to be on release, but so that it does one thing when the mouse is held down, and another if the mouse is released.
I tried many things, but they all ended up in some error code, so help would be appreciated
Thanks
Spaghetee

Really depends upon what you mean by this. People often confuse onMouseDown/onMouseUp with onPress/onRelease. The mouse versions just listen for the mouse going down and up, whereas onPress/onRelease check to see if the mouse has been clicked up/down ON a specific movieclip or button.
So, make two movieclips called myClip0 and myClip1
myClip0.onPress=tracePress;
myClip1.onPress=tracePress;
myClip0.onMouseDown=traceDown;
myClip1.onMouseDown=traceDown;
function tracePress(){
trace(this._name+" was pressed.");
function traceDown(){
trace("The mouse goes down and "+this._name+" knows it.");
And you will see how the traces are different depending upon if you click down on one of the clips or not. So hopefully that may answer any first bit of your question. I'm going to assume that you want the onMouseDown. So just do what you want to happen:
var home:MovieClip=this;
home.onMouseDown=startDown;
home.onMouseUp=stopDown;
function startDown(){
//do what you want;
function stopDown(){
//stop what you want
Now you might want something to happen continuously while the mouse is down. Not sure what that might be, but you could use an onEnterFrame, then your functions might look like this:
function startDown(){
home.onEnterFrame=doAbunch;
function stopDown(){
delete home.onEnterFrame;
function doAbunch(){
trace("I'm doing something over and over until you let go!");
So try that out and come back if you have questions.

Similar Messages

  • How can I make a button that will work on iPads? (animate only on Mousedown)

    I am making an interactive page in Adobe Edge Animate. It will double as a low-mem website and also as an iPad page and is part of a larger flash website which is highly animated.
    This website sports two kinds of buttons; the ones linking to a label in the timeline and the ones linking to a URL.
    The problem is that I do not want the buttons to work on mouseover because that will be completely useless on iPads and similar devices. That is why I want the thing to animate on mousedown.
    What I did initially was to load the on and off states of the button to my timeline and made them into a symbol, after that I made two labels inside of that symbol; one for the on state and one for the off state. Below the first label there is a "sym.stop("ONstate");" action  and then my off-state button graphic has a mousedown "sym.stop("skipON");" action. Then comes the tricky part, I wanted to reference the label on which it should land in a onclick action on a root level. It didn't work at all. I used "_root.stop("label");". As you can see my programming abilities are extremely poor, I'm a graphics guy.
    Next, I decided to leave the mousedown action inside the symbol and do the onclick action on the main timeline, which did work for the most part, however it behaved weirdly. First off, the mousedown action worked perfectly, but not at the same time with the onclick action; You would click on the mousedown thing and it would stop on the frame and then you would need to click it a second time to go to the label.
    There must be either something  I'm doing wrong or this function is not supported by the Edge Animate beta. But my programming abilities are so poor to pinpoint the real cause of the problem.
    Can anyone help me please?

    Hi, redcrowdesign-
    Part of the problem is that you're using ActionScript syntax in a JavaScript environment.  Instead of using _root, you can access the Stage object.  If your symbol is only one level down, you can use sym.getParentSymbol().stop("label");.  If you have a nested symbol, you may find sym.getComposition().getStage().stop("label"); more effective.
    That being said, you might want to rethink your UI model and focus your iPad interactions on the touch events, which are much more performant than the mouse events.
    Hope that helps,
    -Elaine

  • Can't get mouseDown event to work

    I have created some menus with rollover and click events and
    these work fine when previewed from Fireworks in a browser. However
    when I import them into Director the rollover works, but the
    onClick does not. When I look at the Lingo there is no reference to
    the onClick function. I have amended the code myself and it sort of
    works, though I am not sure how to get the correct member into the
    property.
    The code is below and the lines in bold are the one's i have
    added, any help with this would be appreciated.
    -- DESCRIPTION --
    on getBehaviorDescription me
    return \
    "ROLLOVER MEMBER CHANGE" & RETURN & RETURN & \
    "Change the sprite's cast member when the mouse rolls over
    the sprite." & RETURN & RETURN & \
    "PARAMETERS:" & RETURN & \
    "* Rollover cast member"
    end getBehaviorDescription
    on getBehaviorTooltip me
    return \
    "Use with graphic members." & RETURN & RETURN &
    "Swaps a sprite's cast member on rollover."
    end getBehaviorTooltip
    -- HISTORY --
    -- 22 October 1998, written for the D7 Behaviors Palette by
    James Newton
    -- Modified 7 January, 2000 by T. Higgins to include the
    isOKToAttach
    -- event handler along with removing some redundant error
    checking.
    -- 5 March 2000: Modified to match Fireworks button order
    -- and be D7 and D8 compatible for Fireworks Importer
    <jba>
    property spriteNum
    property mySprite
    property myStandardMember
    property myRollovermember
    property myClickMember
    on beginSprite me
    mySprite = sprite (me.spriteNum)
    myStandardMember = mySprite.member
    if myRollovermember = 0 then myRollovermember =
    member(mySprite.member.number+1)
    if myClickMember = 0 then myClickMember =
    member(mySprite.member.number+1)
    end
    on mouseEnter me
    mySprite.member = myRolloverMember
    end mouseEnter
    on mouseDown me
    mySprite.member = myClickMember
    end mouseDown
    on mouseLeave me
    mySprite.member = myStandardMember
    end mouseLeave
    on isOKToAttach (me, aSpriteType, aSpriteNum)
    case aSpriteType of
    #graphic:
    return TRUE
    #script:
    return FALSE
    end case
    end isOKToAttach
    on getPropertyDescriptionList
    if the currentSpriteNum = 0 then exit
    theMember = sprite(the currentSpriteNum).member
    theMemberNumber = theMember.number
    return \
    #myRolloverMember: \
    #comment: "Display which member on rollover?", \
    #format: #graphic, \
    #default: member (theMemberNumber + 1) \
    end getPropertyDescriptionList

    Your browser is responding to events generated by the HTML
    page. Director responds to events generated by Director. onClick is
    not a Director event, which is why you can find no documentation on
    it.
    I have never tried creating menus in Fireworks and then
    importing them into Director, so I don't know exactly what you are
    working with. If your "menus" are just a series of buttons, then
    you could try using the Mouse States behavior that you can find at
    http://nonlinear.openspark.com/tips/scripts/button/index.htm.
    This provides for rollover and mouseDown states, and also changes
    the cursor.
    You will need to add a separate behavior with an "on mouseUp"
    handler that will actually do something when the button is clicked.
    As far as modifying the Rollover Member Change behavior is
    concerned, try replacing the current getPropertyDescriptionList()
    handler with the following:

  • How to use mousedown applet function in swing?

    hai,
    i need to use the applet mousedown function in swing..
    is there any way to use it or any other alternative is available for this?
    if can provide me a sample code.

    >
    i need to use the applet mousedown function in swing..>There is no such class as 'applet' in the JRE, Swing has an upper case 1st letter, functions in Java are generally referred to as methods, and there is no 'mousedown' method in the JRE.
    OTOH a Swing JApplet inherits the mouseDown method from Component, and it was deprecated in Java 1.1. The documentation (JavaDocs) provides instructions on what to use instead.
    >
    is there any way to use it or any other alternative is available for this?
    if can provide me a sample code.>If can provide me cash. Short of that, you might actually need to do some research/coding of your own.
    As an aside. What does any of this have to do with Java 2D?

  • PreventDefault MouseDown on a mobile IconItemRenderer

    Hi,
    I trying to cancel the mouseDown on custom itemrenderer that extends IconItemRenderer when it's on a certain state.
    I add a state that named 'control'
                  _controlState = new State()
                                  _controlState.name = 'control'
                                  _controlOverride = new Array()
                                  var requestAddChild:AddChild = new AddChild(this,_requestIndicator)
                                  var controlAddChild:AddChild = new AddChild(this,_controlLabel)
                   var downEventHandler:SetEventHandler = new SetEventHandler(this,MouseEvent.MOUSE_DOWN)
                   downEventHandler.target = this
                   downEventHandler.handlerFunction = controlDownHandler
                   this.states.push(_controlState);
    and the controlDownHandler function follow
                   protected function controlDownHandler (e:MouseEvent):void {
                                            e.preventDefault()
                             e.stopPropagation()
                                            //dispatchEvent(new DataRequestEvents(DataRequestEvents.DATA_REQUEST,true))
    But the default MOUSE_DOWN event are not stoped. I've also tryed to simply add an EventListener.
    I've alos tried to simply add an event listener inside overriden method createChildren:
              this.addEventListener(MouseEvent.MOUSE_DOWN,controlDownHandler
              protected function controlDownHandler (e:MouseEvent):void {
                             if (!dragging){
                                  e.preventDefault()
                                  e.stopPropagation()
                                  //dispatchEvent(new DataRequestEvents(DataRequestEvents.DATA_REQUEST,true))
    But, in this case, i can't drag the list up or down
    Is there a way to reach this goal ?
    Thank for helping .

    Hi  Flex harUI!
    I've a list that display the 12 more recent news.
    My final goal is to add an itemRenderer at the end of the list that can call a service that get older news.
    1- The classic item render with default MOUSE_DOWN event. (call another view)
    2 -The added itemRenderer that preventDefault() and call the service
    Everything work fine exept that i can avoid the MOUSE_DOWN event on this particular renderer.

  • [svn:fx-trunk] 10925: Redo the implementation of dragging & selection being handled upon mouseDown in List .

    Revision: 10925
    Author:   [email protected]
    Date:     2009-10-07 18:52:06 -0700 (Wed, 07 Oct 2009)
    Log Message:
    Redo the implementation of dragging & selection being handled upon mouseDown in List. Evtim will fix up the behavior such that in a multi-select action, mousing down in a selected item will drag the selected set while mousing down in a non-selected item will select that item anew.
    QA: Yes, but don't include in those 3 tests till Evtim checks in, hopefully tomorrow
    Doc: No
    Checkintests: Pass
    Other tests: List tests pass, List D&D tests pass with 3 exclusions.
    Noteworthy for Integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as

  • Hover  and mousedown image on command button

    I have three images for every command button: mouseout, mouseover and mousedown. Could any one tell me how to implement in JSF?
    Van

    use Link to Action instead of button
    Regards
    AM

  • Photoshop button mousedown not working on mobile

    I am occasionally working on my business site in Muse, where I have a section of logos that use the Photoshop button feature.
    When you mouseover on the desktop, or click on mobile, a color version of the logo shows up as expected.
    I am using a similar function on a new site comp, using similar PSD files, with correct states applied, but the mousedown action will not work on mobile.
    In fact, in the name of science, I dropped one of the Photoshop buttons that works (from my personal site), and it won't work on the new site.
    I cannot see any difference here, but I'm not getting the same results. What am I missing? Thanks.

    The function works correctly here, in the "identity and branding" section:
    Home
    On this one, Pure and Frequensia are linked now, so please try any of the other buttons in reference to this question. Thanks.
    Index_B

  • [svn:fx-trunk] 12462: DropDownList could catch a mouseDown on the bubble and think it was a click outside the dropdown and end up dismissing the dropdown .

    Revision: 12462
    Revision: 12462
    Author:   [email protected]
    Date:     2009-12-03 12:08:55 -0800 (Thu, 03 Dec 2009)
    Log Message:
    DropDownList could catch a mouseDown on the bubble and think it was a click outside the dropdown and end up dismissing the dropdown.
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-24462
    Reviewer: Jason
    API Change: No
    Is noteworthy for integration: No
    tests: checkintests mustella/gumbo/components/DropDownList
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24462
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/DropDownCont roller.as

    My daughter has had her Razr for about 9 months now.  About two weeks ago she picked up her phone in the morning on her way to school when she noticed two cracks, both starting at the camera lens. One goes completely to the bottom and the other goes sharply to the side. She has never dropped it and me and my husband went over it with a fine tooth comb. We looked under a magnifying glass and could no find any reason for the glass to crack. Not one ding, scratch or bang. Our daughter really takes good care of her stuff, but we still wanted to make sure before we sent it in for repairs. Well we did and we got a reply from Motorola with a picture of the cracks saying this was customer abuse and that it is not covered under warranty. Even though they did not find any physical damage to back it up. Well I e-mailed them back and told them I did a little research and found pages of people having the same problems. Well I did not hear from them until I received a notice from Fed Ex that they were sending the phone back. NOT FIXED!!! I went to look up why and guess what there is no case open any more for the phone. It has been wiped clean. I put in the RMA # it comes back not found, I put in the ID #, the SN# and all comes back not found. Yet a day earlier all the info was there. I know there is a lot more people like me and all of you, but they just don't want to be bothered so they pay to have it fix, just to have it do it again. Unless they have found the problem and only fixing it on a customer pay only set up. I am furious and will not be recommending this phone to anyone. And to think I was considering this phone for my next up grade! NOT!!!!

  • ElementHost MouseDown Event not recognizing

    I've been looking for the solution to this problem for days but can't seem to find anything that works. I have an ElementHost on a page in my project that holds a graph of plotted objects. I'm trying to give the user the ability to zoom in/out and translate
    the graph to anywhere they want to view.
    To zoom in/out I successfully used  Private Sub ElementHost1_MouseWheel(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles ElementHost1.MouseWheel
    This works nicely, but I can't seem to make any Click or MouseDown event register. For example, Private Sub ElementHost1_MouseDown(ByVal eventSender as System.Object, ByVal evenArgs As System.Windows.Forms.MouseEventArgs) Handles ElementHost1.MouseDown (or
    .Click or .DoubleClick or .MouseHover or .MouseMove...). None of these subroutines will be entered when I click on ElementHost1
    I'm pretty new to this so I'm sorry if I'm missing something simple here. Also, when I create the same MouseDown event for the page the ElementHost1 graph is on, the page itself will register the mouse event happening but not when I'm clicking anywhere on the
    graph. Any suggestions or help would be greatly appreciated, thank you.

    I've been looking for the solution to this problem for days but can't seem to find anything that works. I have an ElementHost on a page in my project that holds a graph of plotted objects. I'm trying to give the user the ability to zoom in/out and
    translate the graph to anywhere they want to view.
    To zoom in/out I successfully used  Private Sub ElementHost1_MouseWheel(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles ElementHost1.MouseWheel
    This works nicely, but I can't seem to make any Click or MouseDown event register. For example, Private Sub ElementHost1_MouseDown(ByVal eventSender as System.Object, ByVal evenArgs As System.Windows.Forms.MouseEventArgs) Handles ElementHost1.MouseDown (or
    .Click or .DoubleClick or .MouseHover or .MouseMove...). None of these subroutines will be entered when I click on ElementHost1
    I'm pretty new to this so I'm sorry if I'm missing something simple here. Also, when I create the same MouseDown event for the page the ElementHost1 graph is on, the page itself will register the mouse event happening but not when I'm clicking anywhere on the
    graph. Any suggestions or help would be greatly appreciated, thank you.
    ElementHosts are for hosting WPF controls. WPF controls have their own events which are not the same as Windows.Forms events.
    I've never used an ElementHost. I am guessing that for whatever WPF control you are using you would need to use the events available for it.
    You don't mention what control the graph is used with. I suspect whatever that control is you will need to find the events for. WPF control events are different than Windows.Forms events.
    I don't see a graph specific control for WPF at the link below. And if you look at one of the controls at the link then look at the events for that control they pretty much are way different than events for Windows.Forms controls of the same type.
    https://msdn.microsoft.com/en-us/library/ms754204(v=vs.110).aspx
    La vida loca

  • Obj-C, NSView, Mousedown & Global Variables

    Hi Guys,
    I am able to get a response from a mouseDown event via:
    - (void)mouseDown:(NSEvent *)event;
    However whenever I try to return the value of a global variable, via NSLog, I am getting the initial value I declared the variable in the "- (void)awakeFromNib;" method.
    For example:
    Controller.h
    @interface Controller : NSView {
    NSString *a;
    - (void)blah;
    @end
    Controller.m
    - (void)awakeFromNib {
    a = @"test";
    [self blah];
    - (void)blah {
    a = @"green";
    - (void)mouseDown:(NSEvent *)event {
    NSLog(@"%@", test);
    The example above logs 'a' as "test", not "green".
    The xib file has an NSView object hooked up to the class "Controller".
    Can anyone shed some light on where I am going wrong here?
    Thanks!
    Adam

    Hi Jean-Piere, thanks for replying.
    Yes that was a mistake from typing the code into the forum post.
    It should say:
    Controller.h
    @interface Controller : NSView {
    NSString *a;
    (void)blah;
    @end
    Controller.m
    (void)awakeFromNib {
    a = @"test";
    [self blah];
    (void)blah {
    a = @"green";
    (void)mouseDown:(NSEvent *)event {
    NSLog(@"%@", a);
    "a" still logs "test" and not "green"
    any ideas?

  • Wav file on mousedown - need bug fix

    I have set a behaviour on the nav links to the left of my
    page which should make a sound on the mousedown command, but this
    only works in opera? Am using a mac and have tried IE 5.5, Safari
    and Firefox too with no luck. Not sure about IE6/7 yet.
    Does anyone have suggestions or bug fixes for this problem?
    Site: www.reholmes.netfirms.com

    Hello,
    Well, I looked through the example code I tried to break it down to the point where you could create a simple Play VI. Unfortunately, I don't have the PDA target, so I'm uncertain if the little example that I have attached will run or not. If not, I also took a screen shot so you can see what VIs I used. I'm pretty sure I only used VI's that I found on the example itself.
    Good luck.
    Attachments:
    Play_Wav_PDA.vi ‏55 KB
    Play_Wav_PDA.bmp ‏1029 KB

  • Detecting two  seconds on mousedown

    Hello:
    Can you help detecting when a mousedown has passed two
    seconds to show a
    menu.?
    Any sample please.
    Thank you

    Hi Arielle
    Sorry no script, but here is what I would do.
    Create a text field called, timerField.
    On mousedown
    Put 1 into timer
    In the global script write
    If timerField = 1 then
    And start the timer script.
    When the timer script = 2 seconds then make the menu visible
    or go to it, don’t forget to put 0 into timerField at this
    point to stop the timer script. Also put 0 into timerField on
    mouseup should the user decide not to access the menu.
    I’m sure someone else will provide a more elegant way,
    but this will work.
    Ron

  • Programmatically Raising a Mousedown or key down event

    How can I raise an event pretaining to a listbox such as mousedown or keydown in LabVIEW 7? I read that something like this is possible but I am struggling to find an example

    Try this one. When you click the Activate listbox event button, it programmatically generates an event for the listbox.
    Attachments:
    Listbox[1].vi ‏46 KB

  • Mac Dev: mouseDown event on NSSlider

    Hey Guys,
    I have hit a bit of a wall and would really appreciate some help.
    I have an NSSlider that I am using to control the jog speed of a QTMovie.
    I want the rate of the video to playback according to the slider value. This is easy to do.
    The problem is that I want the NSSlider to reset to '0' when the user's event "mouseUp" is completed.
    I can't seem to get this event to work, so I have subclassed NSSlider and implemented mousedown & mouseup methods, and added a delegate to the NSSlider subclass and connected that to my app's controller.
    It sort of works, but there is a massive delay on the slider - it slides fine, but the video rate doesn't change, and only does when I 'mouseUp' - basically it seems the mouseDown is called on the MouseUp.
    I hope some of that makes sense.
    Hopefully someone out there can help me out,
    Cheers,
    Adam
    my NSSlider subclass .m file:
    <code>
    @implementation TimeScrubberSlider
    @synthesize delegate;
    - (void)mouseDown:(NSEvent *)theEvent  {
    //          dispatch_queue_t myQueue = dispatch_queue_create("com.mycompany.myqueue", 0);
    //          dispatch_async(myQueue, ^{
      NSLog(@"mouseDown");
                        [super mouseDown:theEvent];
      if ([delegate respondsToSelector: @selector(doScrubTime:)])
                                  [delegate doScrubTime:nil];
                        [super mouseDown:theEvent];
    //          dispatch_release(myQueue);
    - (void) mouseUp: (NSEvent*) theEvent
      NSLog(@"mouseUp TimeScrubber");
              [super mouseUp:theEvent];
              [self setDoubleValue:0];
      if ([delegate respondsToSelector: @selector(doScrubTime:)])
                        [delegate doScrubTime:nil];
              [super mouseUp:theEvent];
    </code>

    Actually following is the sample code which i have tried on both mac and windows.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false" creationComplete="application1_creationCompleteHandler(event)">
    <mx:Script>
      <![CDATA[
       import mx.events.FlexEvent;
       [Bindable]
       private var hostName:String = HostObject.mainExtension;
       protected function MouseMove(event:MouseEvent):void
        tb.text = event.localX.toString();
       protected function MouseDown(event:MouseEvent):void
        tb.text = "mousedown";
       protected function application1_creationCompleteHandler(event:FlexEvent):void
        vb.addEventListener(MouseEvent.MOUSE_MOVE, MouseMove);   
        vb.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
      ]]>
    </mx:Script>
    <mx:VBox id="vb" height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
      <mx:TextInput id="tb"/>
    </mx:VBox>
    </mx:Application>
    Please do post some suggestion.

  • Continuous MouseDown

    I am trying to develope a custom Numeric Stepper using ZoomIn/ZoomOut images as scroller.
    Now I want to handle continuos MouseDown event. The problem is that the MouseDown event is triggered only once. But, I want a behaviour of MouseDown to be similar of  Flex NumericStepper. The longer we press and hold the scroller, the faster the numbers are increased. I tried using timer which starts on mouseDown and stops on MouseUp. But the problem is that, timer ticks at constant intervals and I cannot achieve the behavious of NumericStepper.
    Can anybody please help me out on this issue.

    On mouseDown, add 3 event listeners: (A) mouseup, (B) rollOut, and (C) enterframe.
    Until the user triggers the (A) mouseup, or (B) rollOut event, you can consider the mousebutton to be down and over the component.  While the button is down you can listen to the enterFrame event firing on each frame, or alternatively, you could use a timer to continously call a function.

Maybe you are looking for

  • Conversion of Scheduleline category from CP to CN in Sales order

    Hi all, I understood there is astandard functionlatity in SAP after deatching a stock from MTO order to other sales order and once quantity becomes less than 1 system automatically changes the Scheduline line category from CP to CN so that there will

  • No line item display after clering with F-03

    Dear Experts, After clearing with F-03 for rate differences, we had a doc number, but no line item display in that document. kindly advice. thank you

  • How to configure Test System

    Hello Guys, I want to some guidelines to install and configure the SAP NWCE as Test System. Any link or documentation would be encouraged. Regards, Naeem

  • Photo Upload Error

    Hi Experts, While trying to upload photo for PERNR through Tcode: OAAD, we are getting error as "HTTP error: 401 Unauthorized". Authorization was successful which we foud out through SU53. Please guide me on the issue. Regards, Madhu Sudhanan

  • Adobe premiere elements 10 audio sync bug (mpeg2)

    Hi Right im trying out diffrent video editing software and reviewing them. There is an annoying bug or flaw when it comes to importing mpeg2 files. The audio track becomes delayed about 1 sek after a while, its synced in the beginning and the get out