A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to follow mouse pointer just in certain area ?

  1. #1
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487

    How to follow mouse pointer just in certain area ?

    Hello everyone !

    I have another little issue... I'm trying to make my mouse pointer changes it's look from the arrow into something else, let's say simple circle. No morphing, nothing, just simple circle.

    I don't have problems with accomplishing that, since I followed this tutorial:

    POINTER FOLLOW TUTORIAL

    ...and everything works great. So, where is the problem ? Let's start then... I'll start with this screenshot:



    Let's say I have one central movie (grey area in the screenshot), and few buttons up there that should invoke dropdown menus... let's forget about those now, because those are already fixed and working fine... MENU number 5 is what I'm interested in. When I press MENU 5 button, I get another small MC (black area in the screenshot) that is nested inside main MC (grey area).

    What I'm trying to accomplish is, when I enter that black area, nested MC, I want my mouse pointer to change into simple circle. And when I move my mouse pointer, it should stay as circle, but only while I'm inside black area boundaries. Of course, arrow shouldn't be visible any more... but I think I can do that with Mouse.hide(); command. As soon as I get out of black area, mouse pointer should become standard arrow again.

    Is it possible to do that in a simple way ? I'm aware there is no simple way for anything in life, but please try to keep it as simple as possible since I'm still beginner. Also, some FLA example if possible, would be very much appreciated. I'm just guessing that some masking should be used in this case, but I'm not that proficient in this...

    Thanks to everybody in advance !
    Everybody have a wonderful and productive day !

    Cheers !
    Last edited by Thankful; 06-07-2005 at 03:42 PM.

  2. #2
    designer
    Join Date
    Jun 2005
    Posts
    12
    usw this code on the black mc:

    on (rollOver) {
    Mouse.hide();
    // your mouse follow code;
    }

    on (rollOut) {
    Mouse.show();
    }

    You could also use an if/else statement so that the new cursor would show only when the x and y positions were in a certain area.

  3. #3
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Hello Benek and thanks for the prompt respond !

    I had to create a transparent button as large as that particular area (black box). Then I added this code:

    on (rollOver, dragOver) {
    Mouse.hide();
    startDrag("CIRCLE", true);
    }

    on (rollOut, dragOut ) {
    Mouse.show();
    stopDrag();
    }


    Also, I added dragOver and dragOut commands as well...

    Of course CIRCLE is instance name of the simple circle sign that I wanted to show instead of pointer arrow when mouse howers over black area. Also, symbol behaviour for that circle is set as MC. Here is the finished example:

    :: Drag Circle over certain area ::

    Thanks again, it helped a lot, and I hope it will help some other people as well !

    Cheers !

  4. #4
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    But, now I have another little issue... On the top of that black area called MENU 5, I have additional button that suppose to open something else (not relevant in this case anyway). Problem is, button doesn't respond now, since I had to place another "big" button all over the black box area, so mouse pointer can turn into circle only when you hover over that particular area...

    I guess, better way would be to use big MC instead of the button (button that covers black area right now), but I don't know if I should change that code slightly, since it's not the same for buttons and MCs...

    Any idea ?

    Thanks again !

    EDIT: Stupid me... hehe... I added exactly the same action (code):

    on (rollOver, dragOver) {
    Mouse.hide();
    startDrag("CIRCLE", true);
    }

    on (rollOut, dragOut ) {
    Mouse.show();
    stopDrag();
    }


    ...to that button inside black area, and it works perfectly... of course, the big button that covers black area and "reads" mouse pointer state is one layer below the main button that should invoke another menu on the screen...
    Last edited by Thankful; 06-07-2005 at 07:12 PM.

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