ActionScript 3.0 :: Can't Stop Dragging When Cursor Goes Off The Stage
Aug 29, 2010
I have a movieclip I'm dragging and dropping. When I drag the clip outside of the stage, it gets stuck in drag mode and when I bring the cursor back onto the stage it suddenly snaps back onto the cursors position and it continues to drag (basically screwing up my drag and drop sequence). What I'd like is for the clip to stop dragging and snap back to its original X and Y position whenever you drag it outside the SWFs stage. I tried to achieve this by adding a listener to the stage to listen for a MOUSE_UP event when the drag begins. But its not working and I keep getting errors.
Here is my code, it's all contained in a document class:
ActionScript Code:
//Add Event Listeners to MovieClip that is dragged
alarmLrg_mc.buttonMode = true;
[Code]....
Which I don't understand because dropClip isn't a property its a function. If anyone can explain how I need to modify my code to make the clip stop dragging or if I can constrain the drag so you can't drag it outside the stage in the first place that could perhaps work as well.
View 8 Replies
Similar Posts:
Aug 28, 2010
I have a movieclip I'm dragging and dropping. When I drag the clip outside of the stage, it gets stuck in drag mode and when I bring the cursor back onto the stage it suddenly snaps back onto the cursors position and it continues to drag (basically screwing up my drag and drop sequence). What I'd like is for the clip to stop dragging and snap back to its original X and Y position whenever you drag it outside the SWFs stage. I tried to achieve this by adding a listener to the stage to listen for a MOUSE_UP event when the drag begins. But its not working and I keep getting errors.[code]
Which I don't understand because dropClip isn't a property its a function. If anyone can explain how I need to modify my code to make the clip stop dragging or if I can constrain the drag so you can't drag it outside the stage in the first place that could perhaps work as well.
View 2 Replies
Oct 5, 2011
startDrag(); seems to stop dragging once the mouse leaves the stage. Is there a way to set it to still drag when off the stage. The exhaustive search I've tried only says things about capture the event for the mouse leaving the stage, not continue any dragging or animation, etc. In more detail, I have a "flashlight" type sprite that covers everything with black, and allows the user to see a small circle of stage. The center of the circle is where the mouse is. When the mouse goes over the edge, half of the circle (or more depending on how fast the mouse moved) is still visible. I need it to at least move off stage completely.
View 3 Replies
May 28, 2009
I have a magnify glass cursor for my portfolio website and it's working fine, except I need it to stop before it reaches the edges of the stage as when it is in a browser it "cuts off" the magnify glass and it looks weird, see on my site and move the cursor to the very right or left: [URL]. The code I have to control my glass is here and I just need to be able to add some x,y etc coordinates somewhere to stop it at certain points on the stage?
var moveGlass:Number;
magnifyingGlass.onPress = function() {
moveGlass = setInterval(startGlass,1); };
function startGlass() {
magnifyingGlass._x = _root._xmouse;
magnifyingGlass._y = _root._ymouse;
} magnifyingGlass.onEnterFrame = function(){
this.largeobject._x = (this._parent.original._x-this._x)*2;
this.largeobject._y = (this._parent.original._y-this._y)*2;
}
View 3 Replies
May 22, 2009
I need to stop my cursor from moving on certain points on the stage. I'm using a magnifying glass effect but in the browser this only show the glass up to the stage so I need to stop it moving past those points. You can see what I mean if you move the magnify glass to the very left or right here:
[URL]
this is the code I have for the magnify glass:
var moveGlass:Number;
magnifyingGlass.onPress = function() { moveGlass = setInterval(startGlass,1);};function startGlass() { magnifyingGlass._x =
[Code]....
View 4 Replies
Apr 21, 2007
my name is carrumbus I am a long time reader and first time poster and i have a problem I apologize in advance if this question to too simple and ridiculous for your brilliant minds It's very basic action script, but i cant figure out why it's not working
Basically, i have an empty stage, but for 2 objects a custom cursor (using the onclipevent mouse move, cursor hide, startdrag etc) and a movie clip of a little man (stick figure for now) all i want to do is, when i bring the cursor to the man and hold down on him, the cursor will goto frame 2, which will make it appear that the man i sitting on the cursor. at the same time the man symbol will be invisible and draggable. so that when i release the drag, the man will be put down somewhere else.
[Code]...
View 5 Replies
Jan 31, 2009
I've made a working custom cursor, but a separate mc which was a draggable object with the default cursor now ignores the custom cursor.
my code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, newCursor);
Mouse.hide();
rectangle2_mc.addEventListener(MouseEvent.MOUSE_DO WN, dragger);
rectangle2_mc.addEventListener(MouseEvent.MOUSE_UP , dropper);
[code]....
View 1 Replies
Jul 26, 2010
My application (AS3) uses Flash Player right-click zoom feature. However, when zoomed in I cannot drag when the cursor is over an image, navigation bar or active area.This makes the menu and several other pages impossible to navigate when zoomed in.The only option is for the user to zoom out and then zoom back in on the next area they want to look at.how default dragging can be enabled when cursor is over an image/ moviclip?
View 1 Replies
Dec 10, 2009
I have created an animation (see attached) where the stage can be dragged from left to right to reveal hidden areas off the edge of the stage. Unfortunately I need to add buttons containing links to websites within the dragable movie symbol and I can't work out how to do it.
View 2 Replies
Dec 11, 2009
I have the following code:
Code:
lights1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
lights1.addEventListener(MouseEvent.MOUSE_UP, dropIt);
lights1.buttonMode = true;
[code]...
I can start dragging the symbol no problem but no amount of clicking will get it to stop. Am I doing something wrong? Using Flash CS4 with ActionScript 3.
View 1 Replies
Jun 11, 2010
I've been searching various sites and forums for a solution to this, but have so far found none, so I was hoping to ask for some advice on the subject.Basically I have a movieclip of a photoframe, and I'd like it so when the user clicks the edge of the frame, they can drag it around, while clicking the photo inside the frame will open a new window and show the photo in full view.Originally I thought I could accomplish this simply by using:(Note: Framemc is the main movieclip, with another mc called "Photo" inside which is the picture)[code]But this leads to an odd problem: When dragging the frame it works fine, but the user can also drag the "photomc" around too (like, the frame stays in place and doesnt move with it), thus removing it from the frame.Is there a way to tell the code to move only certain parts of the mc and not others?
View 1 Replies
Feb 25, 2012
I have a function that recognizes the ESC key being pressed. At which point, I want to stop dragging all items.
I"ve tried this.stopDrag() but it wont override the MOUSE_DOWN event.
It there a way to force it to "drop" the item being dragged?[code]...
View 1 Replies
Feb 28, 2011
I have Sprites that I want to have move around when I click and hold them and stop when I release them. I have methods that add Event listeners to the Sprites:[code]My problem is: when I click on the Sprites, as soon as I move the cursor, the Sprite's registration point snaps to the cursor, and when I release the mouse the Sprite doesn't stop following the cursor. I initially thought it was a problem with pixel collision. I thought the cursor wasn't touching anything on MOUSE_UP, but that proved to be false after I experimented. I even replicated the exact same Event adding and handling methods by starting another project and found that I wasn't having this problem. The test Sprite was simply dragging and dropping like usual, not snapping to the registration point, and being dragged by the point I clicked.
The only difference I can see, and also my only suspicion, is that the Sprites in my original code are being added to a Sprite, which is then being added to the stage, whereas the Sprite in the test project is being added to the root DisplayObject. I'm thinking that somehow the Event propagating down to the container Sprite and dragging and dropping that without dropping the other Sprite. The weird snapping I'm seeing might be the cursor snapping to the object behind the other sprite. Another important thing: when I drop a Sprite on top of another Sprite, that Sprite stops moving like I want it to, but still trails the registration point.
View 1 Replies
Feb 15, 2010
I am looking for a way to "drag" several movieclips at a time and thereby create a panning effect on the entire stage. The movieclips are supposed to follow the cursor (a mask) on the X axis.
View 9 Replies
Mar 15, 2011
I have a frame-by-frame animation. I want to be able to click and drag on the stage back and forth and traverse through the animation. I.e. I want to click and drag from left to right to make the animation go forwards and right to left to make the animation go backwards. How would I achieve this? I am making an assumption that there will be some maths involved in calculating mouse position and traversing to the correct frame, but how would I do this?
View 2 Replies
Jun 1, 2005
I have a simple popup dialog box which exists in a movieclip within the timeline of a loaded movie. I would like to be able to drag this dialog within the bounds of the parent movie (i.e. global stage) and not be confined to the dialogs parent clip and ultimately parent movie.
Within my dialog_mc I have a clip called drag_mc which the user clicks to drag dialog (the specifics are below)
Path:
_root.site_mc.gallery_mc.dialog_mc
Registration point:
top left
[Code]....
View 1 Replies
Oct 8, 2009
What is the difference between dragging a movieClip to stage from the user interface and inserting it from code? What I mean is....I noticed that if I drag a movie clip from the library to the stage, give it an instance name ('xx'), I can access it from code using "this.xx". However, if I add the movieClip from code using:
var ch = new MovieClip();
ch.name = 'xx';
addChild(ch);
I cannot access it using this.xx, but I have to access it using this.getChildByName('xx');
View 2 Replies
Oct 10, 2005
How do i attach a movieclip to the stage without dragging it from the library.
View 6 Replies
Feb 8, 2010
Everytime I'm trying to drag an image from the library to the stage, the program crashes. I've been sending the crash logs to Adobe many times, but never got any solution from them.
In the log there a line that says:
<crash exception="EXCEPTION_ACCESS_VIOLATION" instruction="0x0c4feb66>
I'm working with 10.0.2, I thought the latest update will fix that, but it doesn't. Changing the UI from Essential to Classic doesn't help
View 6 Replies
Oct 2, 2011
Im trying to make a flash map game.Now i have got items in a Movieclip and want this Movieclip into a scrollpane component but i have got probs cause the dragging dont go outside of the scrollpane.
Here is my Code
container.mc_item.buttonMode = true;
container.mc_item.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
function onDown(event:MouseEvent):void {
[Code].....
View 1 Replies
Jul 2, 2010
is it possible for flash to detect off-stage mouse coordinates in order to continuously drag an object within its bounds while the mouse is moving outside of the stage? for example: i have a draggable red square on my stage. the stage is the bounds of the drag. if i drag the red square to the bottom of the stage and continue to drag outside of and around the stage, i'd like the red square to continue moving within it's bounds, following the mouse coordinates. currently, dragging halts as soon as i leave the stage and the red square only begins to move with the mouse coordinates if i reenter the stage bounds.
View 2 Replies
Jan 7, 2010
I am trying to get an object to follow the mouse cursor only when the cursor is within a certain range of the object.
I would also like the object to stop when the cursor is directly over it, so that it becomes a selectable button.
Lastly, I would like to apply this to many objects, that don't overlap, but rather, "bounce off" of one another. An example of this is at
[URL]
The code I have so far is:
ball_mc.onEnterFrame = function() {
var xMouse = _root._xmouse;
var yMouse = _root._ymouse;
[Code]....
"ball_mc" of course, is the instance name of the object that I have created.
View 4 Replies
May 22, 2009
I am using a magnifying glass as part of my portfolio but when I click on another section and this loads an external swf above the main movie, because you can still see the main movie below, you can see the magify glass still moving as you move the cursor above?any ideas how I can stop the magnify glass moving while i am on the external swf above?
View 29 Replies
Apr 29, 2011
how to stop a ball from bouncing up and down when I grab the ball with my cursor?Currently, I have two sections of code, one for a drop and drag, and one to reenact the effects of gravity on my ball.I don't want the ball to start bouncing right away,I want it to either start bouncing when I drag it and let go, or start bouncing when I click a button.I would also like it to STOP bouncing altogether if I grab the ball. (because even though I can drag it around, the bouncing animation is still running!)Here's my current code: (With one "ball_mc" on the stage)
// creating some gravity
var spring:Number=.1;
var frizione:Number=.98;[code]........
View 1 Replies
Dec 27, 2011
how can i stop the object from dragging when the object was already dropped to its target =)
here is my code :
var pointsCtr:Number=0;
s1_mc.onPress = function()
{
s1_mc.startDrag(false);
[Code].....
View 3 Replies
Mar 16, 2010
How do you call a movie clip to animate but only while the cursor is in the stage area?
View 5 Replies
Aug 27, 2010
I have some info boxes that show up upon MOUSE_OVER of an MC. I set their position to mouseX and mouseY once I want them to appear. The problem is that when I mouse over something near the edge of my stage, the info box appears beyond the stage's bounds. Is there a way I can contrain the infobox X,Y so that it does not go off the state?
Right now, this is how I define the X,Y of the text box (pretty simple).
trlinfotxt.x = mouseX;trlinfotxt.y = mouseY;
View 4 Replies
May 1, 2002
Way to stop the pointing hand cursor from appearing when the mouse rolls over a Flash button?
View 13 Replies
Apr 28, 2010
I've been going mad trying to find a code that will make my custom cursor invisible when the mouse isn't on the swf.
View 2 Replies
Jan 29, 2011
I am trying to make it so when you click anwhere on the stage the movieclip cursor is removed.
Code:
stage.addEventListener(MouseEvent.CLICK,ketchremove);
function ketchremove (evt:MouseEvent):void
{
trace("I am removed");
[Code]...
View 7 Replies