ActionScript 3.0 :: Mask Mouse Events Only Received In Button Mode?
Jun 2, 2011
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 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);
i would like to add some mouse events to the mask (which is masking something else below) and because i cant add it to the mask, what would be the best solution?
i was thinking of creating one more movieClip same size and position as the mask, but i would need to put it below everything else because the content that mask is masking should also receive mouse events...
I am loading a movie clip dynamically to the stage where I have a static fullscreen button (Flash component). After clicking the fullscreen button and in Full_Screen mode the static full screen button works without a problem, but the dynamic button event seems not to trigger at all. I wanted to attach a fla file, but mine is way over 300KB.
Here is what the file does: The script loads an external flv and loads cuepoints from an XML which trigger a dynamic button to appear on the stage at a certain time and to disappear after 5 seconds. When clicking the dynamic button the text on the button should change to "You clicked button 1". The problem is this works fine in Normal Stage mode, but in Full_screen mode only the static full screen button works the dynamic button doesn't trigger at all.
Here is the code from the fla: PHP Code: import fl.video.*; import fl.video.FLVPlaybackCaptioning; import fl.video.FLVPlayback; import fl.video.MetadataEvent; import flash.events.Event; import flash.net.URLLoader; [Code] .....
I'm guessing the answer to my question is no, and the solution lies in the hitTest method. But just to be sure . . . if I create a new movie clip and then drag that movie clip over other movie clips that have MOUSE_OVER listeners is there anyway that those clips will get the mouse over?
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 have a startDrag function set up on a loader and mask that when the mouse is down on the loader it drags, when not it doesn't. There is also 2 buttons that control whether mask1 or mask2 is used. What i would like however is when the mouse is down - the area of the loader outside of the mask is visible but only by about 10/20% alpha, that way the user can see where all the image is while dragging. Is this possible? Full code can be seen below and i have attached the zip with the .fla file:
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?
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 created a drawing board using a tutorial that uses a main as file and the png encoder in cs5.5. I am creating this as an exe file to be run from a cd and am not sure how to resize the mask on the board to the size of the stage if I use fullscreen mode or allow user to resize projector by dragging corner.Due to my limitations with scripting I was unable to add the mask to the main.as file but have added it to an actions layer in the drawing board movie clip is that correct?[code]
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.
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;
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).
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.
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 have a movie clip I am using as a button (instance name btn1) and I added an event listener to it (using the following line): btn1.addEventListener(MouseEvent.MOUSE_OVER, animate1); the function "animate1" triggers some small animation when the mouse is over the movieclip. my problem is that the animation is triggered both on mouse over and mouse out events.
It has been awhile since I have worked in flash.Right now I am working on something where I would like a panel to disappear when someone mouses off the stage.stage.addEventListener(Event.MOUSE_LEAVE, leaveHandler); It usually works fine but if I move my mouse really fast it doesn't fire. I have also tried the same thing using a custom invisible button that surounds the perimeter of the stage and I have tried ROLL_OVER and MOUSE_OVERand again, if I do it too fast my event doesn't fire (I am using trace)I can't find anything on the net about this - is this typical of flash that if you move your mouse too fast you break it? Do I need to increase my frame rate (I would really rather not because I have perfectly timed animations - I am at 30 frames per second)
I have a menu drawer at the edge of the screen that shows when the user rolls the mouse over it, but if the user overshoots it an moves the cursor slightly outside the browser window this is unfortunenatly registered as a mouse out.
I want to stop this by using event.MOUSE_LEAVE, but i need to use it as a condition not to triger a "leaveHandler".