Actionscript 3 :: Preventing Mouse Events 'except' For A Specific Button / Movieclip?
Feb 3, 2010
Is there a way to block mouse events except for a specific MovieClip or Sprite? i.e. I know that to prevent ALL mouse clicks, I can write something like:[code]
I have a few swf's that are loaded into a base file using levels. These clips can be cycled through by means of a setInterval function or when the user clicks the next or previous button. However, when the user hovers over a defined 'hit' area which is ultimately a blank movie clip, the setTimeout call is then canceled. This works fine, except that now the 'hit' clip - being above everything - prevents the movies below accepting hit states, and if I move it to below everything else, when one mouses over any element in the loaded movie, it then acts as though the user has mouse out of the hit area.
Is there any way to have this 'hit' clip do its job simply by determining if the mouse is over it, but without using an onRollOver function or equivalent?
In a project i'm doing I have a custom cursor, using the start drag command and mouse.hide. the issue being that the movieclip being dragged is blocking the mouse from initiation mouse events properly.
I'm working on a Flex 3 app, implemented in Actionscript 3 and MXML, that includes an embedded video player, which is essentially a black box--I load it as a SWF from another site on demand, and I don't have access to its source code. It does, however, inherit from Sprite.The problem is that, when focus is on the Flash app, the video player is somehow receiving and processing keyboard events, even when the player itself isn't in focus.So when users are typing text elsewhere in the GUI, if they hit the space bar, the video pauses.
I've tried intercepting key events in the Sprite's parent, and setting tabEnabled = false, tabChildren = false, and buttonMode = false on the Sprite, but nothing seems to work. It's as if the Sprite is getting keystrokes through an alternate Event path.how I can prevent the player from receiving keyboard events or input events entirely? It's fine with me if no input events reach the player, since I've implemented my own,separate video controls.
Currently I'm trying to learn AS3/CS4. And today I discovered a problem I never had in AS2. I have a button which is below a movieclip. This movieclip has no buttons inside or something like that. So the roll over from the button shouldn't be overruled I thought. This is not true. The roll over, out and click doesn't work on the button anymore. How can I get the button to work again (without removing the movieclip of course). I uploaded a file so you don't have to make it yourself.
I'm not sure why it says that when I export the movie. I read that it may be because the actionscripts in the keyframe and not in the move, though that isnt the case here. Below is the code for my button.
on (release) { getURL("JavaScript:liveChat();"); }
I was following a tutorial off a site to build my title menu. I followed everything to the T and the ActionScript 2.0 is giving me 2 of the same errors Mouse events are permitted only for button instances, on 2 of my layers. below is the action script2 code
1. invisible button layer
on (rollOver) { gotoAndStop (1); }
2. ECHOTRAK BUTTON
stop (); on (rollOver) { gotoAndStop (2); }
my question is how do i make my button for my drop down menu work. an instance is a label correct if so were does it exist in this code. I believe its telling me I'm missing my frame labels to be included somewhere in this code the site i used was on this site
I was following a tutorial off a site to build my title menu. I followed everything to the T and the ActionScript 2.0 is giving me 2 of the same errors Mouse events are permitted only for button instances, on 2 of my layers. below is the action script2 code1invisible button layeron (rollOver) { gotoAndStop (1); }
i'm using cs4 flash, i made a button that covers the entire movie (it's a gateway page) here is the AS is used:
on (release) { getURL('02.html', '_self'); }
here is the error i get from flash Mouse events are permitted only for button instances i did this for another movie, and it worked fine. the movie acts like a button when i mouse over it, but i click and release and i get nothing.
I created a dropdown menu from a tutotial I found on the net but when I place it inside a scene so that I can use it has errors which were not there when I tested the movie clip. It keeps going mouse events are permitted for button instances only. This is the same clip that I can't link my scenes to.
I have some buttons that work fine, but when I put a movie clip above them, the stop to react to the mouse. Is there a code to make the mouse to be ignored by that MC?
I'm listening for MOUSE_MOVE events.They are sent and received just fine unless the middle mouse button is held down. I don't get any more MOUSE_MOVE events until the middle button is released.Is this an issue with Flash, or something to do with my specific ouse/computer configuration (bluetooth Mighty Mouse on Lion)?Are there any known workarounds?Here is a sample project to demonstrate the problem.Left click and drag traces mouse move events, but middle click only shows middle mouse down and middle mouse up.
**Error** Scene=Scene 1, layer=poga, frame=1:Line 1: Mouse events are permitted only for button instances on (release) { Total ActionScript Errors: 1 Reported Errors: 1
But the animation works fine . I created a button , to reaplay the animation again when i press it.
Code: on (release) { gotoAndPlay(1); }
Why it give me this error ? I have Action script 2.0 and 1.0
I have a display object that is set to mask another display object. I add a mouseEvent listener to the mask to listen to mouse events. It does not receive the mouseEvent unless I set its buttonMode property to true.
If the display object is not a mask, it receives mouseEvents with its buttonMode set to false.
Here is some fast example code. On the stage I have a circle that masks a square. if buttonMode of the mask is set to false, it won't receive mouseEvents.
Code: circle.addEventListener(MouseEvent.CLICK, onClick); square.mask = circle; //if I set buttonMode = false, the mask (circle) won't respond to clicks. circle.buttonMode = true;
I created a button that has a movieclip in the rollover state. When you rollover the mouse, the movieclip will animate to appear as if the button will scale from a small to a large button even though it is the movieclip that is playing and not the button itself. But I also want to add a keyboard code to play the rollover instead of the mouse. I learned to write actionscript to play different scenes with the code below, but I'm not sure if I can play a button rollover with the same code.
stage.addEventListener(KeyboardEvent.KEY_DOWN, key_pressed); function key_pressed(event:KeyboardEvent):void { if (event.charCode==49) { gotoAndPlay(1,"scene"); }
if I attach two movie clips MC1 and MC2 on the stage.MC1 has a simple button also. MC2 is transparent.First I attach the MC1 and then I attach MC2. Both on the stage. So obviously, MC2 is added over the MC1. In this situation, I cannot click the button which is place in the MC1.If Im not wrong, in AS2, if the MC2 is transparent, the button in the MC1 can still respond to the mouse events.
I have a banner with big invisible button covering the stage and underneath it I have movieclips which must respond to mouse events. But I can't get through invisible button. I only get button events and cant interact with movieclips underneath it. Here's simple code:
invisibleBtn.addEventListener(MouseEvent.CLICK, onTopClick); bottomMc.addEventListener(MouseEvent.MOUSE_OVER, onBottomOver); function onTopClick(e:MouseEvent):void{
I have a button that is called to the stage using AS. When the user releases that button, a global variable is populated and the pageShell movie clip is removed and re-attached using the new variable info. When I run the movie, I get the following in the output panel: **Error** Mouse events are permitted only for button instances on (release:<name>){ I'm not sure why this is happening because the symbol being used (<idname>) is a button.
I have an external swf I created, I used the Document Class to place assetts from the library onto the stage. I have a few Movie Clips I set the buttonMode to true on and added a few MouseEvents for when they're clicked on or rolled over to load content and make a few draggable.
It works perfectly in that swf, but since most of my assets are in the library and exported on Frame 1 I can't really use an internal preloader on it. So what I did was create an external swf that all it is is a loader that I add to the stage that loads the first swf I created.
That works perfectly for getting it on the stage, but the Movie Clips no longer are recognized as buttons and the mouse events aren't working anymore.
Is there anything I can do to change this?
Here is the code I'm using to load the external swf:
Code: var a:URLRequest = new URLRequest("timeline2.swf"); var b:Loader = new Loader(); b.load(a);
(This is within a Document Class external Manager.as)(Game controls are called in Controls.as and successfully assigned to Manager.root via addEventListeners within Controls)
I'm trying to run a function when after a specific amount of time of the mouse being idle a movieclip plays, then when the mouse becomes active again a different movieclip plays. I have gotten my code work for the most part, but the last function runs over and over as the mouse is moving. I want it to run once, so the movieclip plays once.
Right now all the sounds (78 of them) on my guitar play using the roll_over event but that doesn't give the user much control over what sound is played.
The actionscript im using to play my sounds is this;
I want to have a Sprite with an child TextField, but without the textfield triggering or preventing any mouseover events from its parent.
An example would be a world map where each country has a label with its name. For smaller countries, the label would naturally exceed the country's borders. However, the label should not get in the way of mousing over whatever is beneath it (i.e. neighbouring countries).
Just wanted to ask if there is any advantage for either using mouse click event or touch tap events, when writing apps for mobiles or tablets (for the iphone especially)?
I know that both of them should work fine, but in term of performance, is anyone better? Are there any things I should be aware of when choosing either?
By the way am using actionscript3 to implement the app.
I have an animation that I want to start when clicking on the flash window. However, I've also have some buttons on the stage. If I add an event listener for MouseEvent.CLICK on the stage, then it 'eats up' the events and the buttons don't work.
I've tried some tricks, by adding some invisible buttons on top of the real ones, and use the MOUSE_OVER event to selectively enable/disable the mouseEnabled flag for the stage, but didn't work because it complains that the property or method doesn't exist (which I find odd).
What I am trying to do is get a button to make a movieclip go to a specific frame. I have a movieclip that plays a set of frames up to the 100th frame, and then I tell it to go back to and play frame 1 again. However, at about 105, I have another set of frames that I want to play at the push of a button. How would I go about doing this?
What I want to do is have one movieclip that has many frames and turn that into a button and then make different instances of the button and have those instances display a certain frame of the underlying movieclip.
I'm using actionscript 1.0 and 2.0 on flash Pro 8 and keep getting an error when I test the movie. Here is the error:
[Code]...
I've tried to create this rollover navigation...starting over 6 times already. Is there different language / coding for 1.0 and 2.0? I don't understand what I'm doing wrong.
I have a fullscreen projector using fscommand ("fullscreen", "true"); Fullscreen works fine. However, I have 2 movie clips that I don't want to resize with the rest of the movie. (They are non-vector images that look crappy when resized.) Is this possible? If so, do you know what code I need to use? I'm using AS3.