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?

Similar Messages

  • 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 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.

  • Linux - The custom cursor is looking bad

    Creating a custom cursor using png 32x32 images. The images are displaying perfect as a cursor on Windows and Mac but, on Linux the image is bad. Below I am pasting code to test the things by using some png image.
    import java.awt.*;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.net.URL;
    import javax.swing.*;
    public class UserCursor {
         private void initComponents() {
              JFrame jf = new JFrame("Cursor Test");
              jf.setLayout(new BorderLayout());
              final JButton jb = new JButton("Change Cursor");
              jf.getContentPane().add(jb,BorderLayout.NORTH);
              jf.setSize(200, 200);
              jf.setVisible(true);
              final Cursor cur = createCursor();
              jb.addMouseListener(new MouseAdapter(){
                   public void mouseEntered(MouseEvent arg0) {
                        jb.setCursor(cur);
         private Cursor createCursor() {
              Cursor userCursor=null;
              Toolkit toolkit = Toolkit.getDefaultToolkit();
              URL icon = getClass().getResource("images/someImage.png");
              Image image = new ImageIcon(icon).getImage();
              userCursor = toolkit.createCustomCursor(image, new Point(0, 0), "My Cursor");
              return userCursor;
         public static void main(String args[])
              UserCursor uc= new UserCursor();
              uc.initComponents();
    }

    Kanni wrote:
    Toolkit.getBestCursorSize(....)
    I tried using above suggestion to solve my cursor problem. It didn't work for me.
    ThanksSo how did you try this. Did you use the result of this function to choose a suitable cursor glyph? Did you use it to scale the original using an Affine Transformation?
    How can anyone give any further help if the only feedback you provide is "it didn't work" .

  • Change custom cursor size

    does anybody know how to change a custom cursor's size? we have created a custom cursor using the toolkit, but we can't seem to resize it so that the cursor is bigger.

    Read the API on java.awt.Toolkit
    createCustomCursor() creates a cursor of whatever size the system can handle. Generally, this is 32x32 for Windoze systems. toolkit.getBestCursorSize() will return a closest supported size for some (w,h) suggestion. You have to draw your image on a BufferedImage using the graphics object, then submit the BufferedImage object to toolkit.createCustomCursor()
    Jason

  • Using custom cursor

    I want to use a cursor from file in my page. How can I do
    this?
    I've found:
    <style>
    <!--
    BODY{
    cursor:url("3dwmove.cur");
    -->
    </style>
    but works only in IE and for all page not only for a link for
    example.

    You can't. Custom cursors are a pain for your visitor, many
    (most? all?)
    of whom will not want to download and install something from
    a site.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Flesky" <[email protected]> wrote in
    message
    news:ehi23v$653$[email protected]..
    >I want to use a cursor from file in my page. How can I do
    this?
    >
    > I've found:
    > <style>
    > <!--
    > BODY{
    > cursor:url("3dwmove.cur");
    > }
    > -->
    > </style>
    >
    > but works only in IE and for all page not only for a
    link for example.
    >

  • Netbeans 6.1 won't use customized cursor .

    Hi , Have you guys tried the Netbeans 6.1 ?  If you have ever used netbeans ,you know what I am talking about.
    I wonder if anyone has encountered the same problem . when I expand the tree node in the project window or file window , the cursor changed into an waiting cursor , that normal ,but the waiting cursor isn't my customized cursor ,but the xorg's default black watch, I have the same problem when testing on windows , the waiting cursor in netbeans is the windows default large ugly one .
    why netbeans don't use my customized cursor instead of the system default one ? Do the developers of netbeans think all the linux users use the black watch cursor ?
    Have you encountered the same issue ?

    I just noticed the same issue with an Airport Express 802.11n (2nd) with version 7.6.3. I configured the primary and the secondary radius server on the Airport Express.
    With the primary radius server running WLAN login with WPA2/Enterprise worked fine.
    I then stopped the primary radius server and tried to repeat the WLAN login again and it failed. In the secondary radius server log there was no trace at all even when I started the radius server in debug mode.
    Because the Airport Express is in another subnet than the two radius server I enabled logging on my router firewall. I found only four retries for the primary radius server.
    This proves your result that the secondary radius server is never used.

  • Custom cursor

    I thought this was simple. I need some custom cursors.
    Created the cursor as a movieclip object on a new layer's first
    frame and on its actions I have
    onCLipEvent(load) {
    this.startDrag();
    when the movie loads, the custom cursor moves alright except
    its some distance from the standard cursor so its of course not
    working as expected and if I hide the cursor it will be unusable.
    Tried setting the movieclips _x to mouse x and that did not help
    either. What amd I missing?

    jgn2006 wrote:
    > Thanks Erick and kglad for your quick responses. Erick
    your suggestion seems
    > to work very well. Better than using a mouse listener. I
    had tried adding
    > that to a mouse listener and there seems to be a split
    second of delay between
    > mouse movement and my custom cursor.
    Peter already said.. using the global function
    updateAfterEvent he will
    work like you wants. The problem is caused by FPS, the
    updateAfterEvent
    function updates the coordinates of the mc independently of
    FPS.
    //Mouse.hide();
    mcCursor.onMouseMove = function():Void{
    this._x = _xmouse;
    this._y = _ymouse;
    updateAfterEvent();
    Regards,
    Erick Souza
    www.ericksouza.com

  • 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

  • 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!)

  • 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.

  • 16.0.3: custom cursor for third party plugin missing

    We are using a third party plugin which has its own cursor (probably 16x16 png), and after upgrade to AI 16.0.3 on Mac OS 10.8, iMac, the custom cursor just gone, currently it ues system cursor (a black arrow).
    Any detailed info about this upgrade may cause the problem?

    So, here's what happened. In the 16.0.3/16.2 update, Adobe broke sAIUser->SetCursor(). Any plug-in that was using this call to display cursors will no longer be able to change their cursors on Mac. Cursors did not break on Windows. There are two options for developers; either change to platform cursors or wait for Adobe to issue a fix (I do not know, however, if one is planned). Hot Door has already changed to platform cursors and will be issuing an update later this week. There is a discussion on StackOverflow for those interested in the programming solution.

  • Custom Cursor point style on XY graph

    Is there is a way you can change the point style of a cursor on an xy graph to somthing custom, possibly an image or somthing else. Basicly Id like to have very many point styles, but more then just whats in LV, Id want some that actually look different.
    Thanks,
    -Mark

    Hi Mark,
    You can use an event structure to detect when the mouse enters or leaves the XY graph. When the mouse enters you can set the cursor using the "Set Cursor" VI and when it leaves you can unset the cursor using the "Unset Busy" VI. You can create a reference to a custom cursor beforehand using the "Create Cursor from file" VI. Unfortunately none of the VIs that I mention here are available with the base package.
    I've attached an example program written in LV7 on Windows. (note: you need a .ani or .cur file for the cursor you wish to use)
    Hope this helps,
    Neil
    Attachments:
    XY_Cursor.vi ‏83 KB

  • 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!

Maybe you are looking for