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

hide(); isn't a function

Explorer ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

I'm creating a custom mouse cursor for my file. For that, I imported a PNG, converted it to Movie Clip, added an instance name and used the default code snippet to create the cursor. However, when exporting, Animate is giving me as error: hide(); is not a function.

/* Custom Mouse Cursor

Replaces the default mouse cursor with the specified symbol instance.

*/

stage.addChild(cursor);

cursor.mouseEnabled = false;

cursor.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

function fl_CustomMouseCursor(event:Event)

{

cursor.x = stage.mouseX;

cursor.y = stage.mouseY;

}

Mouse.hide();

//To restore the default mouse pointer, uncomment the following lines:

//cursor.removeEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

//stage.removeChild(cursor);

//Mouse.show();

That's the complete code that Animate code snippet contains (cursor is the instance name of the required movie clip). I haven't edited anything from it.

The exact error:

TypeError: Error #1006: hide is not a function.

at Untitled_1_fla::MainTimeline/frame1()

(Untitled-1 is the file name).

I guess, this has to do something with the default mouse cursor not hiding. Basically, a user sees both, the default as well as custom cursor.

Also, my cursor is turning into a white square at some parts.

For example, this is my custom cursor:

Here it turns to white square for no obvious reason:

Here's my file (FLA and SWF): https://drive.google.com/drive/u/0/folders/1jfyvRCX22TW0DMyOBrmWaCFq3d-wfnWA

Views

729

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

Community Expert , Dec 20, 2018 Dec 20, 2018

disable advanced layers (modify>document>untick 'use advanced layers').

info about advanced layers: https://helpx.adobe.com/animate/using/timeline-layers.html#advanced-layers

Votes

Translate

Translate
Community Expert ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

disable advanced layers (modify>document>untick 'use advanced layers').

info about advanced layers: https://helpx.adobe.com/animate/using/timeline-layers.html#advanced-layers

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
Explorer ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

Turning off Advanced layers worked. Thanks.

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
Community Expert ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

you’re welcome.

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
Community Expert ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

Hi.

I did some tweks in your FLA:

Audi_Edited.zip - Google Drive

There were some conflicts going on.

You called your instance Mouse and also set the class name for the symbol with the same name (Mouse).

But AS3 happens to already have a top-level class that is also called Mouse.

Mouse - Adobe ActionScript® 3 (AS3 ) API Reference

So when you called Mouse.hide() the Flash Player assumed that you were referring to your custom class and not to the default Mouse class. And your Mouse class doesn't have a method called hide.

Try to always start your instance names with lowercase letters and then use uppercase letters in the following words. This is called camel case. For example: myCursor or battleTank.

Another thing... You're using a sequence of bitmaps that is causing your FLA and the output SWF to be very heavy. Please consider using a video component in the background instead.

About the cursor glitch, my best guess is that when you imported your artwork from CorelDRAW, some incompatibility happened. Consider recreating that artwork in Animate CC. I did that in the FLA above so you can see.

I also removed the bitmaps but you can of course add them back in your side.

I hope this helps.

Regards,

JC

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
Explorer ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

Thanks for the explanation. I had thought that there might be some issue with that file of mine and so, I recreated another one with the name cursor this time. That was a coincidence that my guess was correct.

I will try to switch to the video thing.

I'm not sure why that glitch should happen when importing PNG, no matter if it's from CorelDRAW or anywhere. I have no problems creating it in Animate, but, I had used Mesh tool in Corel which doesn't exist in Animate. I suppose I can deal with it if it's working. Thanks.

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
Community Expert ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

Oh I see.

No problem.

It's because I based my answer on the thread you deleted a few minutes ago when you were still using Mouse as an instance name and also as a class name.

About the glitch, maybe try to save the PNG in Photoshop first if you don't want to redraw in Animate.

Have a nice weekend.

Regards,

JC

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
Explorer ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

Sorry to say, working with Photoshop didn't work too. Seems like recreating is the only option. I hope that works, at least.

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
Explorer ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

LATEST

Well, yesterday, after my last message, I turned my system off. Today, I just tried using the Trace option to trace my PNG and maintain the colours and that worked. Now the cursor doens't turn to a white square. I wish I would get some more information on this weird thing, but, nevermind. Thanks a lot for the help!

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