Custom cursor click

I'm using this to create a custom cursor and to use a mouse click event on a movieclip:
stop();
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,follow);
function follow(evt:MouseEvent)
          cursor_mc.x = mouseX;
          cursor_mc.y = mouseY;
volgendePijlClip.addEventListener(MouseEvent.CLICK, pijlEventClip);
function pijlEventClip(event:MouseEvent):void
          trace(1)
At first it didn't work for me, but I found out that was because the custom cursor was over its registration point. Which was made equal to the mouse's location. So when the mouse was clicked on the movieclip-button, it was actually clicking on the custom mouse cursor itself, so the click on the 'volgendePijlClip movieclip wasn't picked up on.
I solved it by moving the custom cursor slightly away from it's registration point, so it would appear slightly of mouseX/mouseY. Close enough to act as cursor, but away of the cursor enough so the hidden mouse cursor could pick up a click on 'volgendePijlClip'.
Was wondering if there still was a way for a custom cursor to be over it's registration point and have the hidden mouse cursor still pick up on clicking on objects beneath the custom cursor?

assign its mouseEnabled property to false:
cursor_mc.mouseEnabled=false;

Similar Messages

  • Custom Cursors- drawing bitmaps?

    Hello everyone,
    I went on to www.youtube.com and found a tutorial to set up
    custom cursor using the actionscript(2.0) on the actualt movie
    clip(which was my cursor):
    onClipEvent(enterFrame)
    _x=_root._xmouse
    _y=_root._ymouse
    And the actionscript on the acutal frame:
    Mouse.hide()
    This code sufficiantly replaced my mouse with my movie clip,
    but I noticed when i moused over my button, they did not show the
    same mouse over that I had with the normal mouse.
    Another thing I could like to acomplish is, when my custom
    cursor click anywhere in the flash movie, it overlays a bitmap(an
    image(a .jpeg)) on that instance of that flash movie. I've seen it
    done before in flash sites that allow that user to create things
    such as characters or art. I know it's posible, but I've searched
    all of the internet and have gained no fruit from it.
    If anyone would be so kind as to show me how to go this, or
    even simply point me to a link. I would be very greatful. If I do
    get it working, I'll be sure to share it with the community, as
    what I'm gonna use it for is pretty cool in my opinion.
    Thanks for your time and consideration.
    Peace,
    Mike.

    So I put the code clbeech seggusted in the actions frame and
    it didn't work.
    How do I insert a link to download my flash file so that
    someone can see waht's actually going on?
    Also,
    I'm having trouble with button events.
    I entered some code in the actions palette after clicking on
    the button in the stage. The code was:
    on (release) {
    gotoAndPlay(36);
    Simple enough right?
    Well the frames didn't play, it glitched for a second,
    teasing me as if it would, but didn't.
    I got this compilke error:
    Mouse events are premitted only for button instances.
    This was the error I got from clbeech's code after inserting
    it on the first frame in the actions layer.
    Expected a feild name '.' operator.

  • How to load and increase size of a custom cursor on a certain monitor (1st or 2nd)?

    In my application I need to load a custom cursor, make it big and display it on the my second monitor in a dual monitor setup to let user click with an additional mouse. I found this thread able to solve the first 2 questions, however the cursor only changes within the VI panel. I had tried but couldn't get a handle to the second monitor, in face, not my primary one as well since I'm not familiar with winapi. I also want to restrict when the user can use the second mouse and only in the second monitor if possible. By the way I am using windows 7 64 bit with Labview 9 32 bit.
    Thanks,

    Ishi,
    More than likely, you are going to have to use Windows OS APIs for this. It sounds like you would like to integrate your program at the operating system level, and will have to make calls to Windows to accomplish this in the proper manner.  You can make calls to Windows in LabVIEW through several methods. Check out this example that sets the position of the cursor via a Call Library Function Node to the Windows SDK.  
    http://zone.ni.com/devzone/cda/epd/p/id/2315
    Cheers,
    Aaron
    National Instruments

  • Adding a custom cursor to a panel

    HI, I am making a game where i want clicking a radio button to change the cursor image. I have figured out how to create a custom cursor, and even change the current cursor to it. The problem im having is i want to change it while the program is running. I can say somthing like frame.addCursor(cursor) but that sets it permenantly. What i would like is to add it to a panel during run-time. If anyone knows how i would go abou this i would be gratefull.
    Thanks

    Do u mean, upon selecting the radio button, the cursor must be changed to the customized one?
    If it is so,
    u add the snippet in the itemStateChanged() event....of the radiobutton
    i.e.,
    public void itemStateChanged(ItemEvent ie)
    if(ie.getStateChange() == ItemEvent.SELECTED)
    myPanel.setCursor(Toolkit.getDefaultToolkit().createCustomCursor(CursorImg, new Point
    (0,0), "MyCursorImg"));
    CursorImg - the image to display when the cursor is actived
    new Point(0,0) - hotSpot
    MyCursorImg - a localized description of the cursor, for Java Accessibility use
    else
    myPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }

  • Custom Cursors with AS3

    I used the code snippets to create a custom cursor and it works well.  What if I want that cursor to change when it's clicked?  Can I do that easy enough?  Thanks.

    you can use a stage mousedown listener to make it appear your cursor was clicked.

  • Custom Cursors with rollovers.

    So I know how to make a custom Cursor in flash Pro CS5 but if I want that custom cursor to change to something else of my own design when it's over specific objects how would I go about doing that?

    So here's the code for both both buttons and their rollover actions.  Like I said it works fine for one but not the other.  The forward button is fine, but when the back button is clicked it leaves behind a stamp of the rollover cursor.
    /* Mouse Over Event
    Mousing over the symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
       The code will execute when the symbol instance is moused over.
    backbtn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_2);
    function fl_MouseOverHandler_2(event:MouseEvent):void
    parent.addChild(backphoto);
    backphoto.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor_2);
    function fl_CustomMouseCursor_2(event:Event)
              backphoto.x = stage.mouseX;
              backphoto.y = stage.mouseY;
    Mouse.hide();
    /* Mouse Out Event
    Mousing out of the symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
       The code will execute when the symbol instance is moused out of.
    backbtn.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_2);
    function fl_MouseOutHandler_2(event:MouseEvent):void
    parent.removeChild(backphoto);
    Mouse.show();
    /* Mouse Over Event
    Mousing over the symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
       The code will execute when the symbol instance is moused over.
    Forwardbtn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler);
    function fl_MouseOverHandler(event:MouseEvent):void
    {stage.addChild(nextphoto);
    nextphoto.mouseEnabled = false;
    nextphoto.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);
    function fl_CustomMouseCursor(event:Event)
              nextphoto.x = stage.mouseX;
              nextphoto.y = stage.mouseY;
    Mouse.hide();
    /* Mouse Out Event
    Mousing out of the symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
       The code will execute when the symbol instance is moused out of.
    Forwardbtn.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler);
    function fl_MouseOutHandler(event:MouseEvent):void
    stage.removeChild(nextphoto);
    Mouse.show();

  • Custom cursor that follows mouse - JITTERS

    Hi again.
    I'm using this code to make my custom cursor follow the mouse, HOWEVER when it gets near to the mouth it goes loopy - and turns left and right in a fit. Can I put code in there for it to be smoother?
    The CODE is lower done highlighted in BLACK.
    Cheers
    // Remeber to add private to vars and public to functions that are used outside.
    import flash.display.MovieClip;
    import flash.media.Sound;
    import flash.events.Event;
    import flash.ui.Mouse;
    import flash.events.MouseEvent;
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    var v:Number=5;
    var varObject:String;
    var i:Number;
    var arrayObjects:Array;
    var soundClip:Sound;
    var randomnumber:Number;
    //public function game1SunnyWalk() {
    stage.addEventListener(MouseEvent.MOUSE_MOVE, myClickReaction);
    stage.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
    addEventListener(Event.ENTER_FRAME, onEnterFrame);
    // populate array and initiate variables i and varObject
    this.arrayObjects=["chocolate","icecream","pizza","hamburger","sandwich","egg"];
    this.i=1;
    this.varObject=arrayObjects[i-1];
    var clickPoint:Point = new Point();
    function myClickReaction(e:MouseEvent):void {
    clickPoint.x=this.mouseX;
    clickPoint.y=this.mouseY;
    function onEnterFrame(event:Event):void {
    var xDistance:Number=clickPoint.x-this.planeAndSunny.x;
    var yDistance:Number=clickPoint.y-this.planeAndSunny.y;
    var angle:Number=Math.atan2(yDistance,xDistance);
    this[varObject].y += 5;
    //trace(this[varObject].y);
    this.planeAndSunny.x+=v*Math.cos(angle);
    this.planeAndSunny.y+=v*Math.sin(angle);
    if (clickPoint.x>=planeAndSunny.x) {
    this.planeAndSunny.gotoAndPlay("right");
    //trace(Math.abs(xDistance));
    if (this.planeAndSunny.x>=clickPoint.x) {
    this.planeAndSunny.gotoAndPlay("left");
    //trace(Math.abs(xDistance));
    //if (Math.abs(xDistance)<=10) {
    //trace("works");
    //this.planeAndSunny.gotoAndPlay("static");
    //removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    function enterFrameHandler(e:Event):void {
    varObject=arrayObjects[i-1];
    // this property refers to the mc being referenced and as it's an array you also need the square brackets
    // I tried to hitTest only the STRING whereas you need to hitTest the object
    // ie: this refers to the array object and NOT the string.
    if (this.planeAndSunny.hitTestObject(this[varObject])) {
    //starts sound
    //init();
    // spins the object
    spin();
    trace(varObject);// BUT you can trace the STRING ie: No need to use OBJECT(STRING) - which would be the actual mc.
    removeEventListener(Event.ENTER_FRAME, enterFrameHandler);// ie: You can't do a hitTest on a string BUT on an object. (The array)
    //var soundClip:Sound;
    //function init() {
    //soundClip = new Sound();
    //soundClip.load(new URLRequest("sound/chocolate.mp3"));
    //soundClip.addEventListener(Event.COMPLETE, soundLoaded);
    //soundClip.addEventListener(ProgressEvent.PROGRESS, soundLoading);
    //function soundLoaded(e:Event) {
    //soundClip.play();
    function spin() {
    //tw.addEventListener(TweenEvent.MOTION_FINISH, spinStopped);// note than when you use addEventListener - the function called uses that event as an argument in brackets after the function name
    var tw:Tween=new Tween(this[varObject],"rotation",Strong.easeOut,0,360,2,true);
    var numturns:int=8;
    this[varObject].removeEventListener(MouseEvent.CLICK, spin);
    tw.begin=this[varObject].rotation;
    tw.finish=numturns*360;
    tw.start();
    i=i+1;

    you can easily attach the cursor between the specific layers you want using an empty movieclip and add your cursor movieclip to the emptyMC using the class name. Look at the screenshot and follow the code. it works
    and here is the code:
    import flash.display.MovieClip;
    var whytehand:MovieClip=new cur();
    emptyMC.addChild(whytehand);
    emptyMC.mouseEnabled = false;
    emptyMC.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor_5);
    function fl_CustomMouseCursor_5(event:Event)
        emptyMC.x = stage.mouseX;
        emptyMC.y = stage.mouseY;
    Mouse.hide();
    Thatz it!

  • CS3 Custom cursor acting wierd

    Hello, I am a student in an animation class; our current project is making a website portfolio.  I have discovered some sort of bug or something to that effect, inside of my custom cursor is a button, this button contains a click function.  When I click with the cursor the animation does play, but to a point.  The error occurs when the layer with the custom cursor is above the layer with the buttons.  Neither the rollover, nor the "go to" function work when the timeline's layers is arranged like so.  BUT when the custom cursor is in a layer below the buttons the buttons work fine, but the cursor's animation doesn't play when you click on them, and becaue the cursor is on a layer below the buttons it appears below the buttons when rendered out.
    Please help if you can,
    Thanks!~

    that's normal behavior.  mouse events are intercepted by the top-most interactive object.
    if you want help working-around that behavior, are you using as2 or as3?

  • Custom Cursors (Dynamic)

    I'm already familiar with the standard method of using the CursorManager to use a pre Embedded image to create a custom cursor. However, I'm looking to build a feature whereby a user can enter the name of a file in a text field and have it use the cursor manager to use that referenced file as a custom cursor. I've tried a significant number of techniques but none work perfectly. I can obviously just create an Image UI component and have it follow the cursor x and y coordinates. (and hide the original cursor) That, however, removes the capacity to click. Now the issue is that the CursorManager ONLY works with images you've embedded. There's no way to do that dynamically? Wouldn't it be much easier to allow you also load something dynamically? Such as CursorManager.loadCursor("my_cursor.png").
    Help?

    You can Google for all such things, but bear in mind that the more relatively useless third party 'haxies' you install, the more likely you are to make your Mac work like a Windows machine.
    i.e. NOT!

  • Mac Cursor click point

    It has bothered me for a long time that the click point on the mac cursor is on the inside of the cursor and not at the point like the windows cursor.  Is there any way to modify the cursor on a mac? I dont like the click point on OS X.  Maybe there is an app that can do it which i haven't seen yet, in which case please provide a link if possible.

    Pinpoint- Used to create animations around the mouse, and maybe custom cursors. But I'm ignorant of how to use quartz composer to make my own cursor to use in the app.
    MoundoMouse- Used to resize and move windows with mouse movements (w/o actually clicking the window) ...Might keep this one for the ‘window focus follows mouse’, reminded me of the old UNIX box I worked on for a few years. The mouse focus can be very handy.
    SteerMouse- Used to add more control to unsupported mouses and extra control over tracking/acceleration and cursor snapping to buttons. ...Might keep this one. Hopefully I can turn down the horizontal scrolling speed of the scrollball... always seems way to fast. Not sure as it needs a restart, and I'm converting vids...
    *...Sadly, none of these seem to have the feature I was talking about. Please let me know if I missed something.*
    However, thank you for your response!

  • Custom cursor disappears in context menu

    I am attempting to use a custom cursor from a PNG file.  I set the cursor to an embedded PNG file using CursorManager.setCursor().  However, when a right-click occurs and the context menu appears, the cursor disappears.  I found this example on the web that demonstrates the issue:
    http://www.switchonthecode.com/tutorials/flex-custom-cursor-tutorial
    Click on the show cursor button and then right click to show the context menu.  This seems to be an issue with PNG files but not SWF files.  Both examples in this Flex Quickstart article do not have this problem:
    http://www.adobe.com/devnet/flex/quickstart/controlling_the_cursor/
    Is there a workaround?

    Unfortunately you won't find a solution to this I suspect. In the DevNet example you are seeing the browser menu. In the Flex app you are seeing the Flash Player cursor. I don't think there is a way around this.

  • Custom cursor using image gets resized bigger

    I have created a custom cursor using the following code:
    ClassLoader cl = this.getClass().getClassLoader();     
    Toolkit tk = Toolkit.getDefaultToolkit();
    Image im = tk.getImage( cl.getResource("images/wallcursor.gif"));
    Cursor Custom_Cursor = tk.createCustomCursor(im,new Point(9,9),"Drawing wall");
    draftGrid.setCursor( Custom_Cursor );The cursor is loaded and it works, however - the image I use for the cursor is resized so it gets too big. Any clues on why this happens?
    btw; draftGrid is one of my own classes that extends JComponent.
    - bjorn

    Thanks for your replies guys.
    I tried your code KPSeal, and it works in resizing the cursor image back to its original size. However, a gray square of size 32,32 (which is returned by getBestCursorSize()) is shown round the cursor.
    Here is the updated code (yours hade some minor bugs)
    Image im = tk.getImage( cl.getResource("images/wallcursor.gif"));
    try {
           tracker.addImage(im, 0 );
           tracker.waitForID(0);
    } catch( InterruptedException ie ) {
           ie.printStackTrace();
    int w = im.getWidth(this);
    int h = im.getHeight(this);
    int pw = Toolkit.getDefaultToolkit().getBestCursorSize(w, h).width;
    int ph = Toolkit.getDefaultToolkit().getBestCursorSize(w, h).height;
    System.out.println("w="+w+", h="+h+" - pw="+pw+", ph="+ph);
    Image cim = createImage(pw, ph);
    cim.getGraphics().drawImage(im,0,0, this);                     
    Cursor Custom_Cursor = tk.createCustomCursor(cim,new Point(0,0),"Drawing wall");
    draftGrid.setCursor( Custom_Cursor );The System.out.println statement prints: w=18, h=13 - pw=32, ph=32
    If I try to do the createImage with w and h instead of pw and ph the same gray square (32,32) is created, and in addition the cursor's size is too big which was the probem to begin with ...
    - bjorn

  • Custom cursor using startDrag

    Hello everyone,
    I have a movieclip following my mouse to act as a custom cursor.
    I am using startDrag on the movie clip and mouse.hide()
    What I am trying to resolve is the following:
    I have several hidden simple button objects in the background of my flash movie. ( I am using these to detect when the user has the mouse in certain areas of the flash movie)
    When i go to move over these simple buttons, my custom cursor movieclip stops following the mouse cursor.  Normally my cursor would also then change to the Hand cursor, but i disabled that.
    Can anyone think of any method or hack that would make this work for me?  I would like my custom cursor following the mouse pointer at all times even when hovering over a simple button.
    thanks in advance.

    The cursor changes to hand cursor yet?
    When you say "single button Several hidden objects", the number is?

  • Custom cursor is too slow in FULL_SCREEN_INTERACTIVE

    My custom cursor is fast in window mode (even maximized) but not in fullscreen where it is really slow.
    Is there a solution to this?

    Dear Rob,
    Thanks for your answer.
    I have put together a simple test case (see attached zip file) and the custom cursor is still "too slow to be usable" in fullscreen mode. Run it and see that the cursor is fast in window mode. Then hit ctrl+enter to go into fullscreen and see how slow the cursor becomes.
    Code:
    package
    import flash.events.MouseEvent;
    import flash.events.KeyboardEvent;
    import flash.ui.Mouse;
    import flash.ui.Keyboard;
    import flash.display.StageDisplayState;
    import flash.display.MovieClip;
    public class Main extends MovieClip
    private var _mousePointer:MousePointer;
    public function Main()
    super();
    Mouse.hide();
    _mousePointer = new MousePointer();
    addChild(_mousePointer);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoved);
    private function goFullscreen(fullscreen:Boolean)
    if(fullscreen)
    stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
    else
    stage.displayState = StageDisplayState.NORMAL;
    private function onMouseMoved(evt:MouseEvent)
    _mousePointer.x = mouseX;
    _mousePointer.y = mouseY;
    evt.updateAfterEvent();
    private function onKeyboardDown(evt:KeyboardEvent)
    if(evt.controlKey && evt.keyCode == Keyboard.ENTER)
    goFullscreen(stage.displayState == StageDisplayState.NORMAL);

  • Custom Cursor and Drag Image in 1.4 DnD

    What is the proper way to provide a custom cursor and drag image in 1.4 DnD? Say we initiate the drag on a component that supports data transfer (such as a JTree).

    Well, this is strange. My app was locking up (100% CPU) when using DND from windows Explorer.
    I noticed that another part of the same appliction was working perfictly. The difference: JFrame .vs. JDialog. I switched the offending JDialog to a JFrame and all works perfictly now!
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
    I would like to switch back at some point, but my g.setXORMode() problem is a much bigger issue for us. (That is, once you enter the XOR mode, you can not go back!)

Maybe you are looking for

  • Error while loading Data into Essbase using ODI

    Hi, I am very new to ODI. I have installed ODI and working on Demo environment only. I havn't done any configuration. I am using Essbase Technology which is coming by default. I have created one sample outline in Essbase and a text file to load data

  • Macbook Pro mid 2012 15" (non-retina) graphics tearing

    Hello everyone, I would like to post my experiences using two identical macbook pros 2012 (non-retina, with nVidia GT650M 512MB) who presented the same graphics cards glitches and problems, and hopefully to obtain some information. Exhibit 1: My own

  • Does anyone know if there is a plan to flip the keyboard sideways when text

    Does anyone know if there is a plan to flip the keyboard sideways when texting? I know the keyboard can do it during entering of URLs in Safari and data in Safari but not when entering texts or emails.

  • Crash after split clip detect

    Speedgrade is crashing every time I'm trying a SCD. When I click "split into clips" it crashes. Sometimes it's working, but it's 3 times over 10, and only if there are a low number of splits. Not the first time that this happens when a client it's in

  • Downloaded Version vs Box Version

    I recently downloaded the trial version of Lightroom 1.1 and decided to purchase a license and ordered a boxed version. My question: is the boxed version and different fron the version I downloaded from Adobe Web site thus should I delete the downloa