Need To Disable MouseX And MouseY
I'm at my wit's end.
I made this site http://michaelbierman.net for a friend.
I used layers of movie clips.
If you click on "people" for example, you get a dynamic conveyor belt-like nav with thumbnail photos. I used actionscripting to control the mouseX and mouseY properties on that layer. Click on a photo. A layer of bigger photo comes up over it. My problem is that the nav under the large photo still moves an buttons underneath it can still be clicked -- not a good thing.
I want the big photo to come up and the conveyor belt layer to disable the mouseX and mouseY logic. Somebody please teach me how to do this!!!
You can analyze my .fla by downloading it: http://halfalien.com/flashkit/conveyorbelt.fla.zip
HELP!!!
Thanks in advance, Sean
FlashKit > Flash Help > Flash ActionScript
Posted on: 09-10-2005, 02:37 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MouseX And MouseY
nevermind....I figured it out. mouseX and mouseY does give the reading on the stage, not the underlying symbol.
Edited: 06/29/2007 at 09:42:11 AM by tag_digital
MouseX And MouseY
Say I wanted to make sure that my mouse was within a certain "square area" of the movie... how would I detect that and then execute a function?
ActionScript Code:
if(mouse is within this area)) { trace("BOOM!");} else { trace("You are not within the bounds!");}
DisplayObject MouseX, MouseY, ... MouseDown?
DisplayObject's have MouseX and MouseY getters. This is very helpful sometimes.
Is there a way to easily query input state variables such as MouseDown or KeyDown?
If not, I suppose I need to add listeners for these events, which is fine.
I am just wondering:
why MouseX and MouseY get special treatment without a listener;
if there are other getters for input data without listeners that I don't know about in other parts of as3.
Absolute And Relative MouseX, MouseY Positions
I am making a jigsaw puzzle type of game.
I realize that startDrag() and stopDrag() are the best ways to drag objects (puzzle pieces, in my case) around.
However before I realized this (I am a n00b, BTW) I was using a Timer class and getting the mouse position and setting my piece's position to it as follows:
Quote:
this.x = mouseX;
this.y = mouseY;
This was causing the piece to roughly follow the mouse but it was also jumping wildly across two ends of the stage.
I then discovered what was happening: (mouseX, mouseY) appears to be the position of the uppermost object that is enabled to receive mouse events. So while I thought I was supposed to get the mouse position relative to the stage I was in fact getting the mouse position relative to the piece if I was over it. The code snippet above would then cause the piece to jump to whatever (small) values those represented, like (10, 10) relative to the stage. Then on the next timer event the mouse would be above the stage (because the piece was off in never-never land) and (mouseX, mouseY) would return the stage coordinates, and the above code would result in the piece jumping back under the mouse.
Anyway, I finally solved it with the use of startDrag() and stopDrag(), but not after I had lost nearly a full day. So I'm posting this as a warning, in case it may be of help to someone and prevents them from wasting oodles of time, as happened to me.
I tend to learn by doing but I guess it's also helpful to read a lot beforehand as well.
Flash Player 9/Firefox - Mac, MouseX/mouseY Bug
I've been doing a bunch of experiments using mouseX and mouseY to alter positions of different MovieClips on the stage. I have found everything works perfectly on a PC, but no matter what browser or what Mac I try it on, when I click off of the browser window my mouseX and mouseY locations jump into the millions. Which cause my MovieClips to immediately go off stage.
If I keep my mouse back on the stage for a few seconds they eventually right themselves, but I am finding this to be a huge problem since no one on a Mac can view these files properly if they click off of the stage.
There are definitely other people who have experienced this before, including this guy, who was contacted by Adobe themselves. But that was in September that the issue was known and supposed to be solved. Anyone have any idea if there is a solution to this problem, or have heard of any developments regarding this bug?
It's extremely frustrating, and I haven't been able to work up a decent workaround in the past few days I have been trying to solve it. Thanks in advance!
edit: Also, if you have a Mac and want to try and reproduce the bug yourself, the link below is just one of the many instances I have where this bug occurs.
http://www.thundertech.net/brandon/tilter.html
Edited: 05/12/2008 at 04:08:30 PM by BmBrAnDX
MouseX , MouseY Detection Beyond Stage Boundry?
Hi there,
I've just started dabbling with AS3 coming from Director. Is there a way to
detect the mouse x , y values beyond the edge of the stage? When tracing
mouseX, mouseY on enterframe event the values stick at the last position
within the stage when the mouse roams beyond the stage boundry.
An vague example of usage would be if you had a big movie clip as a custom
cursor, and wanted it to smoothly disappear beyond the stage edge.
Thanks for your help :)
Richard Smith
Background Image Moves Based On MouseX & MouseY
I have a background image which is a movieClip called "skyBg"
I want make that movie clip move in opposite direction...based on movieClip movement.
Here is my idea...
Code:
stage.addEventListener(Event.Enter_Frame, skyMove);
function skyMove (e:Event):void
{
var xDist:Number = (mouseX * 2) / (stage.stageWidth * 0.5);
var yDist:Number = (mouseY * 2) / (stage.StageHeight * 0.5);
skyBg.x = xDist;
skyBg.y = yDist;
}
If anyone can elaborate on this that would be great..
thanks
[F8] MouseY Stop
Hello,
Does anyone know how to adjust the bellow code so when I move my mouse along the Y axis it stops the movie clip menu. Any suggestions?
I got this from a tutorial:
PHP Code:
mouseX = _xmouse;
menuX = menu._x;
mouseY = _ymouse;
menuY = menu._y;
if (mouseX > 550) {
diff = (mouseX-550)/15;
}
if (mouseX < 600) {
diff = (600-mouseX)/15;
}
if (mouseX <= 600 && menuX <= 274) {
setProperty("menu", _x, menuX+diff);
}
if (mouseX >= 600 && menuX >= -1620) {
setProperty("menu", _x, menuX-diff);
}
if (menu._x >= 274) {
menu._x = 274;
} else if (menu._x <= -1620) {
menu._x = -1620;
}
gotoAndPlay(2);
Follow MouseY Question
hi peeps i wanna ask if there is a better way to code this function
ActionScript Code:
function mouseMoveX (event:MouseEvent):void {
num02N.y = mouseY-140;
num01N.y = mouseY-70;
num00.y = mouseY;
num01P.y = mouseY+70;
num02P.y = mouseY+140;
}
i want my num02N, num01N and the rest of the other stuff to follow my mouse's Y coordinate. is there a better way of coding this line instead of typing each movie clip? same goes for the +70, +140 etc.
is there a way to make a double loop? something like this
ActionScript Code:
while (a < 100){
runtimeCombo.addItem( {label: "Example#" + a } );
a = a + 1;
}
oh and how can i add some delay to these guys (num00, num01N and num01P etc) when following my mouse's Y coordinates
How Do You Track Just The MouseY Movement?
Trying to build a scroller that functions when you mouse over a container and scrolls only when the mouseY position changes. Right now, all I know of is the "mouseMove" event which tracks both the mouseX and mouseY. Also ... any links or tutorials on this sort of script would be helpful. thanks!
MouseX
hi,
i copy and paste this script
ActionScript Code:
package{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
public class dist extends Sprite{
public function dist ():void{
init();
}
private function init():void{
var square:Sprite= new Sprite();
square.graphics.beginFill(0xFF0000);
square.graphics.drawRect(20, 20, 100, 100);
square.graphics.endFill();
addChild(square);
square.addEventListener(MouseEvent.CLICK, traceCoordinates);
}
private function traceCoordinates(event:MouseEvent):void {
trace(mouseX);
trace(square.mouseX);
}
}
}
i can get the first trace "mouseX" position, but when i add "square.mouseX" it gives an error "1120: Access of undefined property square."
how can i solve this ?
thank you
MouseX And Mouse Y
hi,
i need some help with this:
i would like to creat an effect, which makes it look as though that when one turns a TV knob, the picture within teh screen changes itself. I thought about making a MC with a TV knob turning itself from 0-360 degrees, and putting a hotspot over it to tell it that when the mousex and mousey is at a certain position, it should go to a certain frame and play. But the problem is i have no idea how to start writing teh script...can anyone help? Or does anyone know of a good example?
Thanks a million
chen nee faulhaber
Very Odd Problem With MouseX
Hello Everybody
I'm Actionscript 3.0 newbie and I have little problem here, I would be very pleased if you could help me here is code that can be found in my .fla file
Code:
var hand:Zombie_hand = new Zombie_hand();
addChild(hand);
and this is in my .as file
Code:
package {
import flash.display.MovieClip;
import flash.filters.BlurFilter;
import flash.filters.DropShadowFilter;
import flash.events.Event;
import flash.events.MouseEvent;
public class Zombie_hand extends MovieClip {
private var _filters:Array;
private var mid_x:int;
private var mid_y:int;
private var speedxnew:int;
private var speedynew:int;
private var speedxold:int;
private var speedyold:int;
private var speedarray:Array;
public function Zombie_hand () {
speedarray = new Array();
speedarray.push (speedxnew,speedxold,speedynew,speedyold);
this.addEventListener (Event.ADDED_TO_STAGE, init);
}
public function init (e:Event):void {
stage.addEventListener (Event.ENTER_FRAME, onFrame);
stage.addEventListener (MouseEvent.MOUSE_MOVE, onMove);
}
private function acceleration ():uint {
speedarray[0] = mouseX;
speedarray[2] = mouseY;
for (var i:int = 0; i<3; i++) {
if (speedarray[i] < 0) {
speedarray[i] * -1;
}
}
var mid_x:int = Math.abs(speedarray[0] - speedarray[1]);
var mid_y:int = Math.abs(speedarray[2] - speedarray[3]);
var abs:uint = Math.sqrt(mid_y*mid_y+mid_x*mid_x);
speedarray[1] = speedarray[0];
speedarray[3] = speedarray[2];
return abs;
}
private function onFrame (e:Event):void {
_filters = new Array();
var getBlur:uint = acceleration();
var blurfilter:BlurFilter = new BlurFilter(getBlur,getBlur,3);
var shadowfilter:DropShadowFilter = new DropShadowFilter(10);
_filters.push (blurfilter);
_filters.push (shadowfilter);
this.filters = _filters;
}
private function onMove (e:MouseEvent):void {
trace(mouseX);
this.x = mouseX;
this.y = mouseY;
}
}
}
Every time I move with the mouse i would normaly get something like 500,495,490,485,480 but i keep getting 500,210,495,205 etc. At the begining the isnt such difference between these numbers but after some moves with my mouse it will grow up .Please help me
Thanx for eventually responses.
MouseX Problems
Hey there,
I'm new to AS3 and programming in general actually. I've ran through the basics of AS3 and now for more practice I am working on translating some AS2 tutorials into AS3.
While working on something really simple I discovered some problems with mouseX. My code is error free, but I'm not getting the results that I want with the code in question.
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.events.Event;
public class Character extends MovieClip {
public function Character() {
addEventListener(Event.ENTER_FRAME, moveCharacter);
}
public function moveCharacter(event:Event) {
this.x = stage.mouseX;
}
}
}
I have a movieclip positioned on the stage already, and all I want is for my MC to follow my mouse. This may be more due to what I'm doing in Flash itself, but it only works the way I want to if I have the crosshair on the MC positioned exactly in the middle of the very left side of my stage. If I put the MC in the middle, it moves left and right with my mouse, but it's way off to the right of where my mouse is. What exactly am I doing wrong?
Thanks for the help!
Sprite X Same As MouseX
Hi, I have sprite in my script and I want to make its x-axis to be same as my mouse x-axis, but when I am using sprite.x = mouseX; I got unexpected results.
P.S I want to do that with AS 3.0.
Thanks for the help.
Very Odd Problem With MouseX
Hello Everybody
I'm Actionscript 3.0 newbie and I have little problem here, I would be very pleased if you could help me here is code that can be found in my .fla file
Code:
var hand:Zombie_hand = new Zombie_hand();
addChild(hand);
and this is in my .as file
Code:
package {
import flash.display.MovieClip;
import flash.filters.BlurFilter;
import flash.filters.DropShadowFilter;
import flash.events.Event;
import flash.events.MouseEvent;
public class Zombie_hand extends MovieClip {
private var _filters:Array;
private var mid_x:int;
private var mid_y:int;
private var speedxnew:int;
private var speedynew:int;
private var speedxold:int;
private var speedyold:int;
private var speedarray:Array;
public function Zombie_hand () {
speedarray = new Array();
speedarray.push (speedxnew,speedxold,speedynew,speedyold);
this.addEventListener (Event.ADDED_TO_STAGE, init);
}
public function init (e:Event):void {
stage.addEventListener (Event.ENTER_FRAME, onFrame);
stage.addEventListener (MouseEvent.MOUSE_MOVE, onMove);
}
private function acceleration ():uint {
speedarray[0] = mouseX;
speedarray[2] = mouseY;
for (var i:int = 0; i<3; i++) {
if (speedarray[i] < 0) {
speedarray[i] * -1;
}
}
var mid_x:int = Math.abs(speedarray[0] - speedarray[1]);
var mid_y:int = Math.abs(speedarray[2] - speedarray[3]);
var abs:uint = Math.sqrt(mid_y*mid_y+mid_x*mid_x);
speedarray[1] = speedarray[0];
speedarray[3] = speedarray[2];
return abs;
}
private function onFrame (e:Event):void {
_filters = new Array();
var getBlur:uint = acceleration();
var blurfilter:BlurFilter = new BlurFilter(getBlur,getBlur,3);
var shadowfilter:DropShadowFilter = new DropShadowFilter(10);
_filters.push (blurfilter);
_filters.push (shadowfilter);
this.filters = _filters;
}
private function onMove (e:MouseEvent):void {
trace(mouseX);
this.x = mouseX;
this.y = mouseY;
}
}
}
Every time I move with the mouse i would normaly get something like 500,495,490,485,480 but i keep getting 500,210,495,205 etc. At the begining the isnt such difference between these numbers but after some moves with my mouse it will grow up .Please help me
Thanx for eventually responses.
Dynamic Text As MouseX
If i have this dynamic text calle locationx
How should i write to make the locationx always beeing mousex
[CS3] Run Function With MouseX Movement
Ok my title is not very descriptive. I want to create an event handler that operates must like a mouse over. I want the stage split in half. When the mouse is on the left: run this function, if mouse is on right run this function. So this is what I have.
var splitSection:Number = stage.stageWidth/2.
Then I have functions with if statements asking if mouseX is less than or more than the split. Simple.
Although, all I know for now to use is an addEventListener(MouseEvent.MOUSE_MOVE). Well just like it says it runs the function every time I move the mouse. How do I get it to just play each function once. I basically want roll over/roll out functionality without creating a blank button or movie clip to act as my boundaries.
I hope I make since. I really appreciate the people that help me. I run into about a thousand problems a day (most of which I figure out myself through tutorials or google) but you guys really save my life sometimes. Thanks.
How To Display MouseX In Text Box?
I have dynamic text box on the stage with instance name Text_box..how would it show the mouseX position? I tried several things but cant get the right code.
Code:
var m:Number = stage.mouseX;
m.addEventListener(Event.ENTER_FRAME, showX);
function showX (event:Event):void{
text_box.text = m;
}
About as close as a noob can get without a little help..
[F8] Nesting MouseX = _xmouse; Function
hi Guys,
I am trying to create a horizontal scrollable movie clip thats works in a nested movie clip
At the moment I am using this code and it only works in the root. Do you know how I can fix it to work in a nested clip?
Here is the original code
Cheers
Nesting MouseX = _xmouse; Function
hi Guys,
I am trying to create a horizontal scrollable movie clip thats works in a nested movie clip
At the moment I am using this code and it only works in the root. Do you know how I can fix it to work in a nested clip?
Here is the original code
Cheers
Changing .width And Getting .mouseX Present A Problem
Can someone shed some light:
I am changing a MovieClips .width from 400px to 100px. However, when I use .mouseX to find the current mouse position of the MovieClip, I get a number that presumes the MovieClip is still 400px wide. However, I am expecting a number between 1 and 100px.
I just can't seem to figure this one out. Does anything have an answer as to how I could get a number between 1 and 100px after resizing?
Thanks!
Here's my code:
Code:
thing_mc.width = 100; //originally 400px wide
thing_mc.addEventListener(MouseEvent.CLICK, update_thing);
function update_thing(evt:Event):void {
trace(evt.target.mouseX); //results vary from 1 to 400px
}
Disable Right Click(how To Disable 'settings' Item?)
Hi all,
I am trying to disable the standard menu coming on right click.The codes like:
newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
this.menu = newMenu;
It's working but still the 'settings' and 'debugger'(disabled) are coming.Can't we hide
whole the menu or disable the 'settings' item? Please help...
Can I Get The MouseX From One Class's Stage From Inside A Different Class?
I'm working on a first time game using Flash CS3 ActionsScript 3.0 that has a crow class placed on the stage of a main gameStage class. I need to access the mouseX coordinate from the stage of the gameStage class from inside my crow class. I'm attempting to do it via a getter function but seem to be having trouble tracking down the exact proper syntax to avoid errors. Is there any chance I could get an exact syntax example as apposed to hours of online research and study.................8-)
Disable Key
I'm an actionscript newbie, but I am doing my best. I'm trying to let a little man walk to the left and to the right. But at a certain point I want him to stop and it works allright, but the little man keeps bouncing back from the xpos. I want him actually to stop. Is there some way I disable the key-function, so my little man stops hitting his head into the wall?
This is the little script I used to make my man walk into the wall at the left and at the right side...
setProperty ("_root.muis", _x, "xpos");
if (Number(xpos)>=200) {
setProperty ("_root.muis", _x, "199");
} else if (Number(xpos)<=20) {
setProperty ("_root.muis", _x, "21");
}
Is there some way i can set the keypress to false? Forgive me for asking such a simple question to you, the divine flash-guru's...
How To ...disable
how do you disable a button once it is clicked?
ex
if i click on A and a B is place next A through a loadmovie
( A )
( AB )
now if i click on A again it will load the movie again
and start from the A and then go back to the AB
how do i disable the click after i use it once
so i dont have to use an unload movie?
on (release) {
}
on (release) {
loadMovieNum ("tryrim.swf", 1);
}
Disable Esc Key
HI....
I want to know how to disable the ESC key in Flash ( standalone player or projector not EMBEDED)..
I use FLASH 5... and plz if it is possible in another version i would like to know
thanks
Disable Tab Key
Hi all,
I want to disable the [tab] in f5. How do I do so?
The movie will be loaded in! Do i have to disable it in that movie or in the loader or in both?
thanks in advance
andylatte
Disable F5 Key
Can anyone tell me if there is a way to disable the F5 key within flash 5?
I have the javascript and I can catch the key in Flash and HTML but I can only disable it when the focus is on the HTML page, not on my flash object.
Please can anyone help??!!??
Disable Key
Is there a way to disable a keyboard key after you press.
As in, if you press and hold, it will only execute the action for that key once.
on (press, keyPress "<Left>") {
\somehow disable the key
this.gotoAndPLay("walk");
}
Thanks for your help.
How To Disable
hi, how can i disable the right mouse click in flash mx. can someone give me just a simple action script. thanks
Disable Esc Key?
Is there a way to disable the esc key for a flash movie, ie. if a full screen projector movie was playing on someones computer and they pressed escape, nothing would happen?
Tab Key Disable?
I have a CD-Rom built ready for production but i'v found a "glitch" that happens when the tab key is pressed. Is this an accessiblity action? and is there a way to turn it globally off? I've looked through the publish settings and can't find anything.
Thanks in advance for any help
Disable KEY
Hello
I am currently making a game that is based around the BOMBERMAN series. And i was wondering if anyone knew how to diable a button.
EG. To lay a bomb u have to pucs control. I want it so once a bomb has been layed CONTROL does nothing (is disabled) untill the bomb has been destroyed or has come to it's final MC frame.
Thank you to anyone who can help me. It will be VERY MUHC appreciated.
Disable ?
well firstly i would like to say i am a big noob at actionscript , really dont know nothing about it ( i am more on the design side of things ) , i have this question - made buttons in flash and did tell target to a movieclip that opens like a text in a page untill here its all good , now the problem is that whenever your on that pressed button you can still press on it and activate that page again and not like in normal webpages where it comes disabled , how can i program this in action script plz help me !!
Disable MC?
How do I disable a particular MC if one MC is running?
Disable Tab
Hi,
I have a small program with 4 buttons used for moving a movieclip(test10). I dont want the user to use tab to access these buttons. So I tried to disable tabbing using the tabEnabled property.
this.tabEnabled = false;
on (release) {
setproperty (_root.test10, _x, _root.test10._x-5);
}
I inserted the above code in all the buttons, but still the tabbing didn't stop and also the buttons weren't working as it is supposed to be.
If I remove the code "this.tabEnabled = false;" then the buttons are working as it is supposed to be along with tabbing.
I have attached the movieclip for better understanding.
Any suggestions on how to disable tab for a button or movielcip.
-sharvan
Disable All Within An Mc
Hi - is there any way of disabling all the buttons within a particular movieclip?
thanks in advace....
How Do I Disable This
I'm making a game on flash, and i send the swf's to my friends. My friends like to cheat so they press Control+right or Control+left to skip levels, and it screws up the sound and makes other problems. Is there a way to disable the Control+right or Control+left keyboard shortcuts?
Disable Me
Okay let me see if I can explain this correctly. I have a button that starts a animation by jumping to the frame. Now I want to disable that button once it is pressed so the user cannot press the button in the middle of the animation and start it over. Any ideas??? Actionscript or anything else.
Thanks in advance
Dim And Disable All?
Hey gotoandlearn community :D
I believe I've seen this on some DHTML-driven sites. I'm basically looking to dim and globally disable all buttons. Here's what I mean:
I'm scripting a RIA and the first thing being done in the movie is checking to see if the user has a Flash Shared Object on their computer. If they do, they get logged in etc, if not, a window pops up with stuff.
Well I know how to check for the shared object stuff, but how would I 'pop up' a movieclip, would it be standard attachMovie?
From there, how would I dim the stage and everything on it? I have Fuse installed but I'm a total n00b at using it so I figured a standard onEnterFrame function would do. To tell the truth, I LOVE Fuse and I'm trying to learn it now. Is there a better way to do it? If so how?
After that, how would I globally disable all buttons except those in my movieclip?
I know this is a lot, but hopefully it's an easy answerer. Everyone's help is extremely appreciated: you all have been so helpful in these forums and it's directly because of lee's tutorials and these forums that I am where I am concerning flash... so thanks :)
- TK
HELP PLEASE Disable Ctrl-Alt-Del
I am trying to disable ctrl-alt-del keys. I am finding that using onclipevent(keydown) and key.getcode will work with the individual key presses but I am unable to find commands that work with combination key presses..so that the ctrl-alt-del keys can't be used.
Can anybody help me please!
Disable All Buttons?
Hi folks
Is there a command you can use to temporarily disable/enable all the buttons in a movie clip? I feel it should be possible, but my actionscript knowledge ain't harcore enough.
Thanks a lot
Can FlashGurus Disable This..
Is there any way to directly disable any buttons in flash?
There are popular workarounds like putting that button in a movie clip on 1st frame and placing disabled state grafx on 2nd frame.
But in my case it's not a feasible solution.
Problem is that, I'm using popup help/instruction windows in my movie, placing these windows on top level, but as normaly happens, all buttons behind these windows (although buttons are not visible) still remains active and shows hand cursor. Which I want to avoid anyhow. There are N number of dynamic buttons in my movie, hence I can't use above given solution.
Another workaround is placing dummy button above my actual buttons, until popup window is still open.
But then also it'll show hand cusror, and user will feel that there is something clickable.
So, is there any way to directly disable any buttons in flash?
How Do You Disable A Button?
Quick question pls:
When I make a button invisible (cover it up) it still seems to respond.
What is the standard technique to deal with this?
Many thanks
[Edited by mediahype on 08-28-2001 at 07:15 PM]
|