A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: [MX] custom cursor with errors

  1. #1
    astridatflash
    Join Date
    Aug 2002
    Posts
    12

    [MX] custom cursor with errors

    Hi - with the help of tutorials, I have been able to create a custom cursor. My file has two areas "areaLeft" and "areaRight". These should eventually be buttons that scroll images. When mousing over each area the cursor is supposed to be replaced by a left or right arrow (see http://www.fluidesign.com/fluid.html.....work....click on any project)

    Now, the left area is (almost) working, but when mousing over the right area, the cursor doesn't get replaced. The arrow is attached, but the cursor still visible. The cursor also doesn't disappear when outside of either area (which it should and does when I delete the right area).

    Also, when moving fast from left to right the output error " Error: A 'with' action failed because the specified object did not exist." comes up.

    Since I'm not an action scripter and don't understand enough about the code - and even though am glad got that far - I can't figure out how two solve these three issues.

    1) arrrow is supposed to disappear when outside of areas
    2) on right area: cursor should be invisible / replaced by arrow
    2) Error: A!?

    Help would be greatly appreciated. Thanks!!!

    Here the code (I am also attaching the file).

    areaLeft.onMouseMove = function() {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    if (!isAttached) {
    Mouse.hide();
    _root.attachMovie("cursorLeft", "cursorLeft", 1);
    isAttached = true;
    updateAfterEvent;
    }
    with (cursorLeft) {
    _x = _root._xmouse;
    _y = _root._ymouse;
    updateAfterEvent;
    }
    } else {
    if (isAttached) {
    Mouse.show();
    cursorLeft.removeMovieClip();
    isAttached = false;
    updateAfterEvent;
    }
    }
    };
    areaRight.onMouseMove = function() {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    if (!isAttached) {
    Mouse.hide();
    _root.attachMovie("cursorRight", "cursorRight", 1);
    isAttached = true;
    updateAfterEvent;
    }
    with (cursorRight) {
    _x = _root._xmouse;
    _y = _root._ymouse;
    updateAfterEvent;
    }
    } else {
    if (isAttached) {
    Mouse.show();
    cursorRight.removeMovieClip();
    isAttached = false;
    updateAfterEvent;
    }
    }
    };
    Attached Files Attached Files

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    rather than using 1 variable - isAttached,
    use 2 variables - isAttachedR and isAttachedL

    areaRight.onMouseMove = function() {....isAttachedR...}
    areaLeft.onMouseMove = function() {....isAttachedL...}

  3. #3
    astridatflash
    Join Date
    Aug 2002
    Posts
    12
    Aaah!!! PERFECT!! Working!! Thank you so much!!

  4. #4
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Also, you're using updateAfterEvent; wrong.

    You only need one in each onMouseMove function (I usually put it at the end of the function), and you need to put brackets in it to make it actually call the function. For example:

    PHP Code:
    onMouseMove = function() {
    cursor._x _xmouse;
    cursor._y _ymouse;
    updateAfterEvent();
    }; 
    http://www.birchlabs.co.uk/
    You know you want to.

  5. #5
    astridatflash
    Join Date
    Aug 2002
    Posts
    12
    Thanks!! Now it acutally DOES something :-)

  6. #6
    astridatflash
    Join Date
    Aug 2002
    Posts
    12

    one more question

    Any idea why the hand shows up when moving from left to the right?? (it updates again when ouside of the area) - file attached
    Attached Files Attached Files

  7. #7
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    the hand shows because you have a button layer.

    i have attached a file (mx2004) for you to look at -

    the button is replaced by an onMouseDown event
    the arrows are attached to an off-stage position

    hope this helps you on your way

  8. #8
    astridatflash
    Join Date
    Aug 2002
    Posts
    12
    shoot! Can't open the file :-( Have MX (version 6.0). Both sides have buttons underneath but only the right one shows the hand!? Any other way to send me that FLA? Otherwise I'll work from your notes. Thanks!!!

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    mx6 file attached

  10. #10
    astridatflash
    Join Date
    Aug 2002
    Posts
    12
    Oh wow! I'm not getting the easy way out here and need to dig deeper into this action scripting stuff :-0 thanks so much and have a great weekend :-)

  11. #11
    astridatflash
    Join Date
    Aug 2002
    Posts
    12
    Hey Modified Dog, can one hire you?? :-))

  12. #12
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    mail me direct at -
    jackleaman{@}btinternet.com
    remove{} to send

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center