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();
}
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.
Copy link to clipboard
Copied
I mean so I can click the button on any layer.
Copy link to clipboard
Copied
One way to accomplish this is to use an invisible button and place it on top of all layers.
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.
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.
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.
Copy link to clipboard
Copied
Its a vector overlay. This project requires mostly vectors.
Copy link to clipboard
Copied
Like I said - Sprites with shapes. Did you try it?
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!
Copy link to clipboard
Copied
That's great. But ActionScript was not buggy - it was your code.
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.
Copy link to clipboard
Copied
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.