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

A button that clicks on any layer even with filters on top?

New Here ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

Hey guy. Im new to actionscript. The button click works, but the current project I have is colored by overylays on top. Apparently the AS code only works if there aren't any layers on top so far.

Is there a way to tell it to code on the top or any layer?

Im using this code BTW.


stop();

instanceName.addEventListener(MouseEvent.CLICK, functionName);

function functionName(event:MouseEvent):void

{

play();

}

TOPICS
ActionScript

Views

552

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

Enthusiast , Dec 14, 2015 Dec 14, 2015

What are the overlays? If they are png's or sprites with shapes in them you should be able to simply set mouseEnabled to false on them, and the underlyng button should work.

overlay.mouseEnabled = false;

Also look at mouseChildren.

Votes

Translate

Translate
New Here ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

I mean so I can click the button on any layer.

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 ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

One way to accomplish this is to use an invisible button and place it on top of all 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
New Here ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

I agree, but again limited on what code to use for that or how to go to reference it.

Basically the button is actually a character where you click an object and then it does something thing. Im working within symbols.

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
Enthusiast ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

as Ned says, make an invisible button that lies on top of the symbol so it registers the interaction. You would set it up as a normal button just as if it were within the symbol your creating.

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
Enthusiast ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

What are the overlays? If they are png's or sprites with shapes in them you should be able to simply set mouseEnabled to false on them, and the underlyng button should work.

overlay.mouseEnabled = false;

Also look at mouseChildren.

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 ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

Its a vector overlay. This project requires mostly vectors.

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
Enthusiast ,
Dec 15, 2015 Dec 15, 2015

Copy link to clipboard

Copied

Like I said - Sprites with shapes. Did you try it?

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 ,
Dec 17, 2015 Dec 17, 2015

Copy link to clipboard

Copied

Hey guys, my teacher helped me out anyway and he did use the parent and child code. AS was being buggy but its fine now. Thanks for your 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
Enthusiast ,
Dec 17, 2015 Dec 17, 2015

Copy link to clipboard

Copied

That's great. But ActionScript was not buggy - it was your code.

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 ,
Dec 17, 2015 Dec 17, 2015

Copy link to clipboard

Copied

Well yes and no. See what happen was, I consulted my friend about how to place the button in front and that part worked. When I added more buttons on there, thats where AS broke down a bit. The instance name and the code was exact, but the arm only played the sound and stopped animating.

So i took it to my teacher, and he couldn't figure out why. So just  he just reattached all the code to the symbol and did the parent child thing. That worked. And then I coded the button for going back to  the previous scene. For Some reason AS at that point and time just only decide to restart the scene and play the sound when clicking that button.

And then when I got home and uploaded my SWF file to my Deviant art website, it worked for some reason. That was what I feel AS is buggy. Sometimes it isn't the code but the program sometimes feels a bit glitchy, or sometimes I also get confused only because the amount of symbols I used. So far Flash isn't great for organization for its symbols and that probably what messed me  up a bit.

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
Enthusiast ,
Dec 17, 2015 Dec 17, 2015

Copy link to clipboard

Copied

LATEST

That's a bit hard to follow but... for one thing Scenes are best avoided. They've never worked very well and any good Flash dev will tell you they are more trouble than anything. I think part of your problem is your newness - once you really 'get' Flash I think you'll find you can organize your library (symbols) quite well.

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