ActionScript 3.0 :: Setting Bounderies For Mc Using MouseX?
Jan 12, 2010
I am trying to get a MC to stay within certain boundaries of the stage. I want it to appear as if it was in a rectangle. It moves along the x axis. Think of a paddle in a basic pong game.What this code does is moves the paddleMC to the left coordinate when the mouse is moved, then gets stuck there.Is there any way to set the boundaries for mc on the x axis when controlled by the mouse?here is my code.mcPaddle is the movieclip I'm trying to set the boundaries for.
ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, movePaddle);
function movePaddle(event:MouseEvent):void
I have a movieclip that moves on the x axis and is controlled by the mouse. I want to set boundaries for the movieclip so it won't go past a certain section on the stage.For example, say there is a rectangle on the stage and the paddle is supposed to appear to be inside the rectangle. I hope this makes sense.The movieclip is called mcPaddle. Here is my code.
ActionScript Code: stage.addEventListener(MouseEvent.MOUSE_MOVE, movePaddle); function movePaddle(event:MouseEvent):void
I have this mc that responds to mouseX , only the mc is very short in frames, it's only 25 frames long. This way the mouseX is only the first 25 pixels of my stage, so it only responds to that. Is there any way I can multiply this value to, let's say, 20 times?
public function update() { //making the character follow the mouse
[Code].....
mouseX isn't being changed by me (and can't be since it's read-only), there isn't any other code in this object since I've only just started with this project.
if I want to use mouseX and mouseY in my class whats the most effective way to do this? I know if I extend a class to Sprite for example I get this feature but could I get it with less... I know I could say this also and then I wouldnt need to extend Sprite but I dont know if this is a good idea....
I am making a map of the united states where I would like the map to pan to that state and then zoom into that state when that state is clicked. I have looked over a lot of tutorials, but they all seem to do a little more then I need. I would have thought it was a simple math equation using the mouseX and mouseY with the stage.stageWidth and stage.stageHeight, but I have no been able to figure out the math.
I'm a non-3D guy with a 3D problem to solve. I have a character moving around in 3D space (his Z value is fixed, like a 2D side-scroller with 3D graphics). He's supposed to follow the mouse. But because the mouse's Z is not the same as the character's, I obviously can't just set his Z to that of the mouse. I'm pretty sure I need to use the distance between the character and the camera when calculating the character's new X position. But I'm not the mathiest person around, and the wiki article on 3D projection ([URL]) made me a little dizzy. All I know is I need to do the inverse of what that article describes.
I'm not using any 3D engines. I've found posts about certain versions of PaperVision that actually have a method built into the Camera class to do exactly this (Camera.unproject()). I'm going to attempt to dig into that to see if I can pull out the formula that I need. But in the meantime I thought I would pick the brains of you brilliant Kirupians.
What I am trying to do here is control a movie clip with the mouse by setting the coordinates of one equal to those of the other. This is the code I have for that movie clip:
I get no errors whatsoever from this, but when I test it, I see the movie clip that I'm trying to control move with the general direction of my mouse movements, but completely offset from the mouse. Additionally, the movie clip flashes between four different positions constantly, and the output window traces the following four sets of coordinates even when I keep the mouse in one place:
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.
I have a rectangle on stage with the registration point in the top left and a custom rotation applied.Would it be possible when I click on it that it changes its rotation to 0 but with a rotation center point around mouseX and mouseY ?
I have an object that I want to go to the mouse's pointer location when it clicks on a button, but instead of it being instant I want it to have some sort of a delay, like a walking motion. I've got pretty far but I can't get the logic out of it.
ActionScript Code: game_area.addEventListener(MouseEvent.CLICK, moveCharacter); // moves the character to the specified click point in a delay
Not sure if I'm missing sth or is it just a bug. I have a movieclip on stage, it's a simple rectangle drawn with a rect tool (no stroke) I add an event listener to trace out the mouseX, works OK so far. When I increase its width the mouseX traces wrong values. Here's a sample code:
I've got a grid of images which are added to a imagecontainer(Sprite) in a class. When I click a button, the imagecontainer gets tweened(scaled) to 0.2 Now I would like to start dragging around the images. on mouse-down I add an enterFrame Event:
[Code]...
Unfortunately the image is never on the mouseposition but has a increasing/decreasing offset to the mouse pointer.The alternative, startDrag/stopDrag works perfectly, but I stll need the mouseX/mouseY for placing the image on a grid.I tried also parent.mouseX, no luck with that.Why is this happening? I thought mouseX/mouseY is always depending on the stage-dimension.
This might be irritating simple. I am trying to convert some code from actionscript to cocos2d. I am quite new to actionscript and would like to know if there is a cocos2d function for mouseX/mouseY. If not, what would be the equivalent.
I need to do something and I don't know if it's possible... in a proper way.
1 - I have an FULLSCREEN application that extends to two monitors in a Windows system. 2 - The graphic card is extending the single desktop to the two monitors, so the fullscreen fits everything correctly. 3 - Only one monitor is interactivity-enabled, with an interactive touch-sensitive foil on it, which works great. 4 - The second monitor is interactivity-disabled, it just displays stuff depending on what happens on the first monitor.
The Problem: The interactive foil on the interactivity-enabled monitor responds as if it is the *whole monitor*. But it only covers one monitor!! The *whole monitor*, are the two screens put together. I obviously can't cut the interactive foil in 2, and then stretch the two parts to fill a monitor each... So if one touches beyond 50% of the foil's width, the touch event will actually occur in the second monitor!
A fact for the solution is - if all Mouse Events occur with mouseX divided by 2, everything will work fine! How to make all Mouse Events's mouseX be divided by 2? Is there a way to do that in the core of the actionscript MouseEvents handling?
I need help with this drawing example. The problems I'm having are that the coordinate of the line being drawn always have an offset value to the mouseX, mouseY coordinates as intended, and the drawing automatically stops after a while for no reasons at all. I don't know what's wrong.
I'm having problems getting a hitTestPoint to run properly. It keeps throwing the same error no matter what I try. 1120: Access of undefined property mouseX.
I need the mc (thumbs) to fade in and once it has faded check to see if the mouse is over it in order to trigger other code. I need to run the test as soon as the tween is over regardless if there is/isn't a mouse event, which is why you'll see my attempts at using the ENTER_FRAME event.Here is the offending code:
ActionScript Code: TweenLite.to(thumbs, 1.5, {alpha: 1, onComplete:checkMouse}); function checkMouse():void[code]...........
This appeared as I was trying to use a mouseEvent to move an object.I placed the variables for mouseX and mouseY in the public class. I did the same for direction X and Y but there was no error message for those.
I want to set them up with packages but tried before and failed.At the moment, I've made a folder,
C:/flash/mbl
In there, I have all my classes that I want to reuse. what do I do next? I'm using Flash CS3, would also be useful to know how to do the same in Flex Builder 3.
not sure if this is technically "actionscript"but i didn't know wher eelse to post iti need to place an flv on top of a background image, and i want to set the flv to have an opacity of like 30%-
I have a bttn in my swf (which is embedded into my html page) and i want to be able to control the parameters of the pop up window the bttn generates. I have found a code generator at- this generator works when i input all my parameters and URL and test it, but when i place the code it provides onto the bttn in flash it fails to produce the same result me
on (release) {getURL ("javascript:NewWindow=window.open('https://secure.bellerockgaming.com/webchat/go_Max_New.asp?siteID=14&qu eueID=29&folder=BRE','Live
I am just about to pull my hair out - please help as I don't have that much hair to pull out. I created a flash file in Flash CS3 and was told I need to add a click tag for an agency who want to keep track of the click throughs for the ad.
I have created the invisible button layer and set up the 'hit' and tried and tried and tried to select the button and add some action script to it. (which I have seen three different codes to use)
Each time I export it or publish it I get the error message: mouse events are permitted only for button insances on release. I have read and understand I need to assign the code to the button and not the frame but for the life of me, I cannot figure out how to do that.
I select the button (which I have converted to a 'button') and F9 or left click to get the Actions panel and once I am there and try to use the '+' to add code, it automatically shows 'Current Select/Frame 1 in the left side of the Actions panel. I get that it is adding the code to the frame but how do I get it to add the code to the button???
All now works exept the height doesn't seem to work; that is, if the text goes on for pages all of it prints to screen. I would like to contain it to 350 px and then have the user use the scrollbar.
fla files which is calling default page . but it's not able to find the default page.. my default.aspx page is in root directory ,and my fla file is in ../capture/image.fla . here is my code