CS6 - Custom Cursor & Button's icon

I am trying to display a custom cursor when mouse is moving on a button which has icon.
But the button's icon is always in front of my cursor image.
How to make my cursor image on top?
Belows is my code. Please tell me what's wrong.
Thank you!
<mx:Application... creationComplete = "init()>
private var MyCursor:Shape = new Shape();
private function init():void{
    // draw custom cursor
    MyCursor.graphics.clear();
    MyCursor.graphics.lineStyle(2, 0xFF0000, 1,true);
    MyCursor.graphics.drawCircle(0,0,6);
    MyCursor.graphics.moveTo(-3,-3);
    MyCursor.graphics.lineTo(4,4);
    MyCursor.visible = false;
    // add to the layer
    CursorLayer.addChild(MyCursor);
private function ShowCustomCursor(e: MouseEvent):void
    Mouse.hide();
    MyCursor.x = e.stageX;
    MyCursor.y = e.stageY;
    MyCursor.visible = true;
private funtion HideCustomCursor(e:MouseEvent):void
    Mouse.show();
    MyCursor.visible = false;
<mx:UIComponent id = "CursorLayer" x ="0' y="0" width ="1000" height = "1000" blendMode="layer">
<mx:Button id="btnTest" x="50" y="5" width="28" height="20" buttonMode="true"
icon="@Embed(source='assets/btnTest.png')"
mouseFocusEnabled="true"
mouseMove="ShowCustomCursor(event)"
mouseOut="HideCustomCursor(event)"
tabEnabled="false"
useHandCursor="true"/>

that's because your cursor is sporadically moving over your interactive objects interfering with their mouseevents.
to remedy, disable the mouseEnabled property of your cursor.

Similar Messages

  • Import Icon on Custom Tool Button

    Hello,
    I have a script to add an icon to a custom tool button.
    When the script is run from the console in Adobe Professional 9, the tool button with the icon is added to the toolbar.
    The tool button needs to be installed on user's computers with Adobe Reader X.
    The script was placed as folder level javascript on a user's computer as well as the jpg file for the icon.
    When Adobe Reader X was opened the following error was thrown:
    TypeError: this.importIcon is not a function
    1:Folder-Level:App:Button.js
    Can any one please provide assistance on how to get the tool button with the icon to show in Adobe Reader X?
    This is the folder level javascript:
    this.importIcon("myIcon", "/C/temp/myIcon.jpg", 0);
    var oIcon = util.iconStreamFromIcon(this.getIcon("myIcon"));
    app.addToolButton({
    cName: "myButton",
    oIcon: oIcon,
    cExec: "console.println('My Button!');",
    nPos: 0
    Thank you very much.

    That code can't work in a folder-level JavaScript since importIcon is a method of a document.
    You should instead include the button icon image data in the script. If you want to see how to do it, you can get the following product: http://www.windjack.com/product/acrobuttons/

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

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

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

  • Custom cursor - dynamically change colour

    Since I failed to gain access to [Embed]ed SWF file to change
    its properies from within Flex :-(
    has anyone got any ideas how to create a custom cursor and
    dynamically change its colour.
    Let's say we have a brush or a pencil cursor and we want to
    change the colour of its tip, when a certain coloured button is
    pressed with it.
    Thank you.

    Use sym for your element.
    sym.$("button").css({'cursor':'pointer'});

  • 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 TOC button in Captivate 4?

    Hi all,
    I'm using Captivate 4 with imported PowerPoints. I'd like to use the Captivate skin's built-in TOC without using the playbar (and its available TOC button). However, that leaves me with only the teensy little grey TOC tab/slider thingy in the upper left corner to open/close the TOC, which doesn't seem to be large or distinct enough to get my users' attention.
    I'd like to add a larger custom TOC button that opens and closes the TOC overlay from the slide footer, but can't find anything to point my button at so as to make that happen. Any suggestions?
    If this has been addressed already, apologies, I didn't find it.

    Hello and welcome to the forum,
    In Captivate 5 you can change this icon. For CP4 I believe someone created a widget, am looking for it later on and will be back when I find it.
    Lilybiri

  • Quality Custom Cursor (Dukes)

    I have created my own Custom Cursor that is displayed while a long task is running (in a different thread) to show the user that the program is busy.
    Cursor search1 = myToolKit.createCustomCursor(myToolKit.getImage("Resources/Images/Cursor1.png"), new Point(0, 0), "Search1");Sun says:
    Note that multi-frame images are invalid and may cause this method to hang.
    So I created a Timer that changes the icons every 500ms to give the impression of a slow animated cursor.
    This works, however,
    There are three problems:
    1. The time between changing frames is not 500ms, it seems to be very jumpy. It is running in a different thread so I thought it wouldn't be a problem. Is there any way to regulate this?
    2. The size of the cursor seems fixed, can I change it? (The size of the Image I use for the CustomCursor does not seem to make a difference)
    3. The quality appears really bad. I am using a png file that looks really clear at 100% size in Photoshop. Should I use a particular format?
    Thanks for any help
    Charlie

    Thanks very much for the quick reply.
    I have done a bit of testing on your suggestions..
    1. You could try upping the priority of that thread.Seems to work (sort of), think I'm just going to leave it!
    2. Depends on your OS. See Toolkit.getBestCursorSize.Whatever size I give it, the bestCursorSize comes out as 32x32. Do you know if any other sizes are supported or if I can override it e.g. 64x64? Using XP (Can I change the settings in the OS?)
    Would it just be best to resize my image files then?
    3. See Toolkit.getBestCursorSize API doc.Thanks!
    Think I'll give you the Dollars unless someone else comes up with a great answer soon
    Charlie

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

  • Custom Chrome and Custom Cursor problems

    Howdy, I've got a small problem with chrome and cursors.
    I've created my main application window with the chrome set to Custom-Opaque
    I've got my custom frame, window controls etc. all wired up and working nicely.
    I've got my cursor manager swithing the cursor to resize-arrows when you get close to the window edges.
    Here's where I run into a couple problems:
    The cursor is only visible within the bounds of the window--unlike the system chrome which gives the resize cursors outside the window bounds. Any way to use the system cursors? or another idea?
    When I resize the window, the custom cursor stays right where the MOUSE_DOWN event occured, and doesn't move with the mouse anymore. The window does resize though... Any suggestions?
    Thanks in advance!
    -Ted

    I have the same problem but I extend the WindowsLookAndFeel. I know of a way to fix this but it seems unbelievable that this is the only way. Here is how I did it: In your custom look and feel class add this method. Call the super version and then add the icons that are missing to the UIDefaults table. Of course your code would have MetalLookAndFeel where my example has WindowsLookAndFeel. Hopefully someone will come up with a better solution. I plan on raising a bug in the bug parade for this.
    protected void initComponentDefaults(UIDefaults table)
              super.initComponentDefaults(table);
              table.put("DesktopIcon.icon", LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/DesktopIcon.gif"));
              table.put("Tree.openIcon",LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/TreeOpen.gif"));
              table.put("Tree.closedIcon",LookAndFeel.makeIcon(WindowsLookAndFeel.class, "icons/TreeClosed.gif"));
              table.put("OptionPane.errorIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/Error.gif"));
              table.put("OptionPane.informationIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/Inform.gif"));
              table.put("OptionPane.warningIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/Warn.gif"));
              table.put("OptionPane.questionIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/Question.gif"));
              table.put("Tree.leafIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class,"icons/TreeLeaf.gif"));
    Hope this helps.

  • Custom mouse button reliability

    Hi everyone, I'm having two problems with my custom cursor, which basically works. The script below is on the first frame, which is a preloader frame The first problem is that after I click on two of the buttons leading from the home frame to other frames, a few of the other buttons will disappear upon returning to the home frame, which doesn't happen otherwise, and doesn't happen for the many other functioning buttons that are set to work in the same way. When I don't use a custom cursor, all of the buttons work. My second problem is that I'd like the cursor outline to change color on rollover for all buttons without having to specify which ones, and so I tried using SimpleButton.prototype, but I obviously made a mistake, because it doesn't work. Based on trial and error, I marked in bold the lines that seem to be causing issues. Do you see the errors?
    Thanks,
    Jonathan
    Mouse.hide();
    var cursor:Sprite = new Sprite();
    cursor.graphics.lineStyle(.25, 0x000000);
    cursor.graphics.beginFill(0xFFFFFF, .5);
    cursor.graphics.drawRect(0,0,15,15);
    cursor.graphics.endFill();
    cursor.visible = false;
    import flash.events.Event;
    import flash.events.MouseEvent;
    function mouseMove(e:MouseEvent):void
    if (!cursor.visible) cursor.visible = true;
    cursor.x = e.stageX;
    cursor.y = e.stageY;
    function cursorframe(event:Event):void
        addChild(cursor);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
    cursor.mouseEnabled = false;
    cursor.mouseChildren = false;
    setChildIndex(cursor, (numChildren - 1));
    addEventListener(Event.ENTER_FRAME, cursorframe);
    function mouseOff(evt: Event){
        cursor.visible = false;
    this.stage.addEventListener(Event.MOUSE_LEAVE, mouseOff);
    SimpleButton.prototype.addEventListener( MouseEvent.MOUSE_OVER, onMouseOver);
    SimpleButton.prototype.addEventListener( MouseEvent.MOUSE_OUT, onMouseOut);
    function onMouseOver(theEvent:MouseEvent):void
    cursor.graphics.lineStyle(.25, 0xFF00FF);
    function onMouseOut(theEvent:MouseEvent ):void
    cursor.graphics.lineStyle(.25, 0x000000);

    fix one problem at a time.  see if the following stops your problem with disappearing buttons:
    Mouse.hide();
    var cursor:Sprite = new Sprite();
    cursor.graphics.lineStyle(.25, 0x000000);
    cursor.graphics.beginFill(0xFFFFFF, .5);
    cursor.graphics.drawRect(0,0,15,15);
    cursor.graphics.endFill();
    cursor.visible = false;
    cursor.mouseEnabled = false;
    cursor.mouseChildren = false;
    import flash.events.Event;
    import flash.events.MouseEvent;
    function mouseMove(e:MouseEvent):void
    if (!cursor.visible) cursor.visible = true;
    addChild(cursor);
    cursor.x = e.stageX;
    cursor.y = e.stageY;
    function mouseOff(evt: Event){
        cursor.visible = false;
    this.stage.addEventListener(Event.MOUSE_LEAVE, mouseOff);

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

Maybe you are looking for

  • Is there a way to connect two analog mics recording in stereo to the iPad for recording?

    I currently use an M-Audio Mobile Pre to connect two microphones to my MacBook Pro via USB. If I wanted to use my iPad (or even iPhone) instead, is there a way to get the stereo input into the iPad? Would the Line 6 Sonic Port sold via Apple work? Wo

  • Problems with Maths (decimals) In java calculations

    In a normal calculator type in (27.8 / 3) * 12 = 111.2 Do this in Java and I get 111.20000000000002 This is causing a problem in my calculations, is this a known bug and how can i get around it ? Friendly Regards Steven

  • Some questions on itunes

    Hi all, I have an iphone and ipod classic. Recently, I had to re-format my HDD due to motherboard failure, and I forgot to retrieve the itunes library backup and iphone backup before I re-format. Now I have already installed itunes and loaded back my

  • Async-Sync scenario with out using BPM

    Hi All, With SP19 we can implement File-RFC-File scenario with out using BPM. But can any one suggest how can I implement the following File-RFC-File scenario without using BPM. My input file has five elements. A1,A2,A3,A4,A5 The RFC (BAPI) needs A2

  • ABR delta

    Hi Experts, I am using 2LIS_02_ITM. It uses ABR images for 0recordmode. I found in psa for a certain PO, the image is Blank which means After image.There is no other images. I like to clarify what does this mean. Does it mean that this is a new recor