AS3 check movieClip click with label content - actionscript-3

I'm new in ActionScript 3 and I have a problem that I couldn't solve.
The situation is that I have a question (simple text) displayed in a Label and to answer this question, I have to click on a MovieClip.
How can I check that the MovieClip clicked is the correct answer (especially that I have a lot of them)?

Related

User interface flash AS 3.0

since the Site seems to be pretty buggy i have to post my question below. Sorry for the inconvenience.
Hi guys
I'm new to flash and i want to create a GUI for my little game.
How can i create a start window where I can select stuff like how many objects to spawn or move speed of my character.
My first idea was to hide everything else on the stage until I click start.
Would that be right. Is the a better way. how to do this anyway.
And where do i put my GUI script. Stage or extern class.
Place your start button in the first frame and put your other elements in second frame. On click of the start button gotoAndPlay to next frame.

Adobe Flash CS5.5 Actionscript 3 Buttons within movieclips cause swf preview and debugger to freeze

To say i am new to actionscript 3.0 is an understatement. But i am still trying to use it anyway. At the moment i am trying to create an interactive movie, with each frame in the main timeline containing a movieclip, and the movieclips containing the choices are the ones with buttons.
The issue here is simple, when the first button comes up the video freezes, and it seems like i can click the button but nothing happens when its clicked.
I have tried searching for a solution but it seems the only thing that comes up are ways to get the player to freeze when a button is clicked, sort of the opposite of what i'm looking for :)
The code at this point is really simple:
import flash.events.MouseEvent;
import flash.display.MovieClip;
this.Choice1R.addEventListener(MouseEvent.CLICK, ButtonHandler1);
function ButtonHandler1(e:MouseEvent){
MovieClip(this.parent as MovieClip).gotoAndPlay(3);
}
A simple stop(); tag is inside every keyframe in the main timeline to allow the movieclips inside to play, and that's about it. Every layer containing a button at this point looks sort of like this. Choice1R is in this case the instance name. If anyone can think of a reason why this would cause the swf file to freeze, any help would be appreciated.
Note: The sound keeps on playing as normal. No idea why.

ActionScript 3 Check Which MovieClip is in a Certain Direction

Allright so I am making a little program that allows a user to click a block which then moves into an open space (for simplicity's sake let's assume there is one).
How could I check which MovieClip is to the immediate right/left/bottom/top of the movie clip?

Detect control overlapping in Flex 4 while an object is moving?

I have this small project HERE. Right now it barely does anything but make the character move.
I move the character by using <s:Move>. Now as you can see on the link to my project page, it moves to where you point the mouse and click. I want to be able to stop the character from moving if it hits another object or in this case, the "tree". Is there a script in AS3 that will let me detect collisions or controls that are overlapping each other?
If my question is a bit lacking information, please comment back here and I'll update it with more details as you need.
Please and thank you!
All DisplayObjects have a a method called hitTestObject(obj:DisplayObject) that tests when one object overlaps another. You can read about it in the Tree class, DisplayObject class, or any class that extends DisplayObject.

How to click through a display object in Flash with AS3?

I am creating a photo editor app where, at some point, the photo you edit is supposed to be dropped between two layers of DisplayObjects (a background image and an image mask.)
There is a problem, though. When the image you are editing is dropped between the background and the image mask layers, it becomes unclickable, and therefore gets stuck there, with no chance of dragging it again. (The photo editor uses TransformManager library.)
I am looking for a way to allow you to select the image you are editing no matter if there is another DisplayObject on top of it. And that probably means finding some way to click through the image mask.
Is there a way to do that?
I tried setting mouseChildren = false on imageMask, but that didn't have the desired effect.
Many thanks.
I had similar problems and I managed to solve it by using both
displayobject.mouseChildren = false;
and
displayobject.mouseEnabled = false;
on the object that you want to click through.
How about this?
mask.mouseEnabled = false;
You can always attach a Mouse Click listener to the container, and then either use GetObjectsUnderPoint and check for your object or do a hit test and see if the mouse position is over your intended object.
The hit test would look something like this !this.YourPhoto.hitTestPoint(stage.mouseX, stage.mouseY, false)
b
If I understand your problem, this handy class should solve it:
http://www.mosessupposes.com/utilities/InteractivePNG.html
Take a look at what senocular does here, specifically in the handleUpdate method. Basically: getting a list of everything under the mousePoint to find your object.
I think I stumbled upon similar problem, although in as2.
In flash when you position movie clip over movie clip, and the movie clip on the top has any mouse events implemented, it captures all mouse events so they never reach occluded movie clip.
The solution is not to have any mouse events for the top movie clip and have the movie clip positioned at the bottom capture mouse event and redirect some of them to the top movie clip (you can check mouse position with hitTest to determine if they should be redirected).
i had a strange bug i used;
movieClip.mouseEnabled = false;
but wasn't working for some reason.. was driving me crazy!! as i have used it so many times before. tried lots of different things nothing worked then i deleted the MovieClip and the created a new one and worked.. so the MovieClip's contents must have been corrupt or something as it had a old dynamic Text Area box embedded within the MovieClip.
hope this helps someone out there..