• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

How do I change a custom cursor to the default using the Animate CC 2017 flash code?

New Here ,
Jun 17, 2017 Jun 17, 2017

Copy link to clipboard

Copied

I have a small flash game where, for a section, I need a sniper scope custom cursor. After this section I want to return to using the default cursor. Does anyone know the code needed to do so, as the code snippets within animate and other discussions haven't been able to help me.

This is the current code I'm using to create the cursor (animate code snippet with my cursor name "scope1"):

And this is the closest I have been to resolving it so far:

Thank you for any and all help,

Rob.

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 17, 2017 Jun 17, 2017

If there is no other code than what you showed, the timeline would have gone quickly onto the Mouse.show() frame. You would normally have a stop() somewhere, and only go on to the Mouse.show() when you're finished with the custom cursor.

Also, if there is anything inside the scope sight that might trap the mouse click you ought to set mouseChildren to false.

Here are scripts I just tested, and the initial frame:

scope1.mouseEnabled = false;

scope1.mouseChildren = false;

scope1.visible = true;

scope1.a

...

Votes

Translate

Translate
LEGEND ,
Jun 17, 2017 Jun 17, 2017

Copy link to clipboard

Copied

If there is no other code than what you showed, the timeline would have gone quickly onto the Mouse.show() frame. You would normally have a stop() somewhere, and only go on to the Mouse.show() when you're finished with the custom cursor.

Also, if there is anything inside the scope sight that might trap the mouse click you ought to set mouseChildren to false.

Here are scripts I just tested, and the initial frame:

scope1.mouseEnabled = false;

scope1.mouseChildren = false;

scope1.visible = true;

scope1.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

stage.addEventListener(MouseEvent.CLICK, clicked);

function fl_CustomMouseCursor(e: Event) {

  scope1.x = stage.mouseX;

  scope1.y = stage.mouseY;

}

function clicked(e: MouseEvent) {

  stage.removeEventListener(MouseEvent.CLICK, clicked);

  scope1.removeEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

  play();

}

Mouse.hide();

stop();

and on a frame after that, which is reached because to the play() line:

Mouse.show();

scope1.visible = false;

stop();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

This is perfect and works completely. I can't thank you enough for the super quick response and fix. You've just made me and my lecturer very happy.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

LATEST

Always a good thing to make lecturers happy!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines