Flash :: Canvas Moved On StartDrag() Without Calling Set X / Y Or Move() - How Does StartDrag() Exactly Work In As3 / Flex

Feb 11, 2011

i have an .as class that extends mx.containers.Canvas (it's a draggable border of a resizable component), it becomes draggable on MOUSE_DOWN and stops being draggable on MOUSE_UP, MOUSE_OUT and ROLL_OUT. before calling startDrag() i create a Rectangle to define the drag area, i also have a _dragging: Boolean variable to control if it's draggable at the moment. the problem is that when i click this border it jumps to a negative coordinate without calling startDrag or switching _dragging to true.

i've overriden get x, set x, get y, set y and move() methods in order to solve it but the only thing i got was the fact that position changes without calling coords setters or move(), but at the moment it's changed a getter is called and returns new (negative) value so my question is what happens on startDrag() and how to filter unwanted incoming coords values?

View 3 Replies


Similar Posts:


Actionscript 3 :: Flash - StartDrag() Within StartDrag() On Child MovieClip

May 19, 2011

as you can see, I have a container MC which I have added to the stage. I set its drag constraints using a Rectangle(). I then add the 'cat' child movieclip to the container, and I want this to be dragable too. However, as soon as I click on my cat when testing the MC. It shoots to point x=0 y=0 on the stage and doesn't move.

The container MC can be moved without any trouble.

If I remove the rectangle bounds from the containers startdrag() function. both MC's can be dragged without any issue.

//panning ability
my_x = 800 - myImage.width;
my_y = 480 - myImage.height;

[Code]....

View 3 Replies

ActionScript 2.0 :: Making StartDrag Move Through And Axis?

Jun 1, 2004

I want to make a handle pull up and then down through an arc. Now using the startDrag on the Handle won't make the handle pivot around an axis. It needs to move a bit like a (one arm bandit) or (The old coin Poker Machines) I have attached a basic file to show the problem I have so far.

View 2 Replies

ActionScript 2.0 :: Making StartDrag Move Through And Axis

Jun 1, 2004

I want to make a handle pull up and then down through an arc. Now using the startDrag on the Handle won't make the handle pivot around an axis. It needs to move a bit like a (one arm bandit) or (The old coin Poker Machines) I have attached a basic file to show the problem I have so far.

View 2 Replies

Actionscript 3.0 :: Get RollOver To Work With StartDrag?

May 9, 2009

I have 10 objects on the stage, 5 of those should be draggable objects and have a target object to be dragged to named the same as the object, only adding "target_" first. So "objectA" should be dragged and dropped at "target_objectA". And the target objects have a rollover function inside that simply highlights the objects on rollover. But since the rollover functions does'nt work when the mouse is dragging something, I had to set the "mouseEnabled" to false. But then again, flash will not recognize my mouse_up to run the "dropObject" function I've created, which drops the object at the position the mouse is at that time.

I just cant figure out what to do, and I need to keep the functions so that all dragobjects can run them, because later on I'm going to add alot more. How can I get the rollover, startdrag and stopdrag to work all together?

Code: Select all//Imports and Stops
import caurina.transitions.*;
stop();
//Variables

[Code].....

View 1 Replies

ActionScript 3.0 :: Any Way To Make StartDrag Function Work Better?

Jan 13, 2010

When you are dragging a movieClip on the stage, it generally works fine. But if you are performing some calculation or hitTest while you dragging, the location of the cursor and the movieClip starts to go unsynched. For example, in the following code, I am running an ENTER_FRAME handler while you drag a box, and this onEnterFrame_Box method contains a bogus for loop to slow down the process. The drag & drop works snappy if you comment out that for loop... But if you bump up that 100 to something like 200, Flash Player runs quite slow, and the location of the box won't match where your mouse cursor is...

ActionScript Code:
var box:Sprite = new Sprite();
box.graphics.clear();
box.graphics.beginFill(0xCCCCCC, 1);
box.graphics.lineStyle(1, 0x999999);
box.graphics.drawRect(0, 0, 100, 100);
[Code] .....

View 2 Replies

ActionScript 3.0 :: StartDrag Doesn't Work With RotaionX Or Y?

Jun 8, 2009

I'm facing a strange problem, I'm using CS4 and AS3 and I got a text scroller that uses startDrag,I wrap all this in a function that handles a sort of 3D roationX with rotation and rotationY,why is the startDrag not working when rotationX or Y are used ?

View 4 Replies

ActionScript 3.0 :: Using Rectangle In StartDrag Makes StopDrag Not Work

Nov 9, 2009

I have a pretty simple function here where I want to start dragging a video scrubber along the x axis within bounds, and drop it when they let go. The code works perfectly if I don't specify a bounding rectangle (except it doesn't restrict to x-axis). What's up with that? Here's my non-working code:

Code:
videoConsole.scrubber.addEventListener(MouseEvent.MOUSE_DOWN, dragScrubber);
videoConsole.scrubber.addEventListener(MouseEvent.MOUSE_UP, releaseScrubber);
private function dragScrubber(e:MouseEvent):void{

[code]....

View 1 Replies

Flash - Flex Canvas With Many UIComponents If One Moved Are Others Redrawn/reprocessed?

Jul 18, 2010

I have a canvas called Host with many UIComponents as children, sometimes up to 1000 or 3000 items. This is fine for now, as they are not interactive. But, I have added a 'marker line' (a 1 pixel wide UI Component with a colored background) to the canvas which follows the mouse movement. When this UIComponent is added to the Host canvas and moves, everything slow down to a crawl i.e. takes ages for the UIComponent to move.

View 2 Replies

Flex :: Why StartDrag() And StopDrag() Don't Effect The X - Y Coordinates

Mar 11, 2010

when I use startDrag() and stopDrag() to drag an object why doesn't it effect the x,y coordinates of the object? you can run this example and see for yourself (move the circle and look at the trace messages):

[Code]....

View 3 Replies

Flex :: Put Images On A Canvas And Have Them Be Moved Around By The Mouse?

Jan 11, 2010

I want to dynamically create and put some Image (mx.controls.Image) objects on a Canvas and I want them then to be able to be repositioned by the user via the mouse. Can this be done? Note, I am not looking for drag and drop. I just want to change the X and Y coordinates of Images with the mouse.

View 3 Replies

AS3 :: Flash - StartDrag Firing Mouse_up / Mouse_click Events

Oct 10, 2011

As I started developing mobile apps for iOS/Android using Adobe AIR I encountered strange problem (or feature). If you create Sprite and make it draggable using startDrag/stopDrag inside MOUSE_DOWN/MOUSE_UP event handlers, everything works. But if you add another listener MOUSE_CLICK to the same object, it starts to fire together with MOUSE_UP. Logically this behavior is all right.

What I need is to prevent firing MOUSE_CLICK handler when user drags the Sprite (startDrag) and I need it to fire when user did not drag the Sprite. What I'm trying to create is a small thumbnail bar which is draggable and after clicking on concrete thumbnail its large version/image opens up. This is actually not possible as MOUSE_CLICK fires everytime user drags whole thumbnail bar so large image opens up everytime.

View 1 Replies

ActionScript 2.0 :: Flash MX - StartDrag - StopDrag - Get The MC Drag To Stop ?

Aug 30, 2007

I can't seem to get the MC drag to stop

[Code]....

View 1 Replies

ActionScript 3.0 :: Flash StartDrag Setting Negative Bounds?

Dec 17, 2010

I have a large movieclip (2336 x 1752) and a stage of 800 x 600. I want to be able to drag the movieclip around the stage so no white is visible:

minimum x before I get whitespace: -1536
minimum y before I get whitespace: -1152
maximum x before I get whitespace: 0
maximum y before I get whitespace: 0

I have tried this:

Code:
var mcBounds = new Rectangle(-1536, -1152, 0, 0);
mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

[code]...

But it doesn't drag at all...when I try it just moves it to it's maximum position and stays there.Is it because the rectangle can't have negative values?

View 2 Replies

Actionscript - StartDrag Event On Movie Click Only Drags One Layer Flash ?

Jun 29, 2010

I have a problem with the startDrag function I'm using in AS3. Right now I have a movie clip which is made up of 4 different layers. I export the movie clip, create and object of it, add in an event listener for mouse clicks that calls the startDrag function. However, instead of dragging the entire Movie Clip and all of its parts, it only grabs and drags one layer around, which breaks the different parts of the Movie Clip up.

public function HopperMouseDown(event:MouseEvent):void
{
event.target.startDrag(true); //start dragging tile[code].....

This is my function for the MouseClick event on the MovieClip. I initiate the startDrag event, but here it will not drag the entire Move Clip for some reason it only drags the different pieces inside the clip.

View 2 Replies

ActionScript 3.0 :: Flash 1061: Call To A Possibly Undefined Method StartDrag Through A Reference

Apr 7, 2012

I've got a piece of code that means a button will only become clickable if a set of keys are dragged to a certain location.

This is my code for that:

Keys.buttonMode = true;
Keys.addEventListener(MouseEvent.MOUSE_DOWN, drag1);
Keys.addEventListener(MouseEvent.MOUSE_UP, drop1);

[code]....

I don't get why it's not working, I also get: 1119: Access of possibly undefined property buttonMode through a reference with static type flash.display:SimpleButton.

View 14 Replies

ActionScript 3.0 :: Error #1069: Property StartDrag Not Found On Flash.display.Loader And There Is No Default Value

Mar 17, 2009

I'm creating a little project that allows you to drag some images.I get this Error when I try to drag the images

Code:
ReferenceError: Error #1069: Property startDrag not found on flash.display.Loader and there is no default value.
at Icon03/beginDrag()

Here is my code

Code:
package {
import flash.display.*;
import flash.events.*;

[code]....

View 1 Replies

AS3 :: StartDrag X Y Coordinates?

Jan 11, 2008

not sure if this is possible but i'd like to get the X,Y coordinates of a button I drag. here's my problem:

PHP Code:
public function backbuttonDown(e:MouseEvent)
{

[code].....

View 10 Replies

F8 :: StartDrag() Multiple Mcs At The Same Time?

Nov 1, 2007

is there a way to drag multiple movieClips at the same time? Flash help explicitly says: Only one movie clip can be dragged at a time. After a startDrag() operation is executed, the movie clip remains draggable until it is explicitly stopped by stopDrag() or until a startDrag() action for another movie clip is called. anyone know of a way to do it anyway? maybe combining them in a dynamic mc or something?

View 3 Replies

ActionScript 3.0 :: Can't Disable StartDrag

Feb 21, 2009

I have a zoom in function and when I'm zoomed in I can drag the movie clip around with a drag function I have a zoom out function which restores the movie clip to its original size but I would like the drag function to be disabled while zoomed out.[code]...

View 4 Replies

ActionScript 3.0 :: StartDrag With MouseEvent?

Sep 24, 2009

I've created a function called dragItem() that I call with the MOUSE_DOWN event. I've got it working....kind of. I can access the function when the mouse is clicked and I can even get the name of the instance when the mouse is down. I'm trying to use the same logic to get the single object to allow a drag. see my code below...
 
function dragItem(event:MouseEvent):void {            var instName:String = event.target.name;            trace(instName);            trace(event.target.width);                        event.target.startDrag();                        event.target.removeEventListener(MouseEvent.MOUSE_DOWN,dropItem);            event.target.addEventListener(MouseEvent.MOUSE_UP,dropItem);                    }
 
I get this error when I try to drag the item...ReferenceError: Error #1069: Property startDrag not found on flash.display.Loader and there is no default value.    at Main/::dragItem()

View 8 Replies

ActionScript 3.0 :: StartDrag In 3D Not Working?

Apr 1, 2010

The Language Reference states:
 
"Three-dimensional display objects follow the mouse and Sprite.startDrag() moves the object within the three-dimensional plane defined by the display object. Or, if the  display object is a two-dimensional object and the child of a three-dimensional object, the two-dimensional  object moves within the three dimensional plane defined by the  three-dimensional parent object."
 
However, this does not seem to be the case.  I have a 2D object which is the child of a 3D object, but startDrag will not work on the child.  If I remove any tweens in code from the parent's rotationY then startDrag will work.    If I have any reference to rotationY it will not work, even if it is set to 0.

[Code]...

View 4 Replies

ActionScript 3.0 :: StartDrag Within A Loaded SWF

Jun 16, 2011

I have an index file in which I load my external .swf. One of the external .swf has a drag and drop quiz. And as you can guess, the startDrag doesn't work! In fact, when I publish within Flash it works just fine, but when played within the index file, it stops working!

For your information : all my files are in AS3.
 
So here's a bit of my code.

var interbouton : Number = 10;
//I have 7 items that I can dragfor(var i:Number=0; i<7;i++){ var dragBtn :MovieClip = new Drag();

[Code]....

View 2 Replies

ActionScript 3.0 :: StartDrag And Bounding Box

May 5, 2008

I have noticed when setting a bounding box on a drag object, if you go outside the bounds of the box you have set, the mouse won't let go of the object unless you go back inside the bounds and click on it again. Is there any way to force the stopDrag if you go outside the bounds while dragging? I have tried this bit of code:

[Code]..

View 3 Replies

ActionScript 2.0 :: Tile Map Using StartDrag()?

Feb 5, 2009

I'm making a strategy game the uses a tile map to show information about the other players! Every tile is 50*50px and when you start the map it loads about 50 tiles and puts them together (all this from a Flash->ASP->MySQL which i managed to do on my own)

What i need to do is to make the map draggable (kinda like maps.google.com) and make every tile clickable! I can't manage to do both of these things at the same time All the tiles are in a movieclip called mapMc so by creating a big button above the visible map area and write:

ActionScript Code:
on (press) {
allSize = _global.fullMapSize/2; //This gets the size of the map after all tiles have loaded[code].....

And that kinda works (except for the boundaries)Second, when you press a tile, which i stupidly constructed as another button, so every tile is a button (loaded dynamically) with as that fetches the tile information (already fixed ) But how do I combine them?

View 0 Replies

ActionScript 3.0 :: Can't Disable .startDrag?

Feb 21, 2009

Ok it's 5am so I'm just not thinking clearly and am straining to read my code and I cannot get this to work.

I have a zoom in function and when I'm zoomed in I can drag the movie clip around with a drag function
I have a zoom out function which restores the movie clip to its original size but I would like the drag function to be disabled while zoomed out.

[Code]...

View 5 Replies

ActionScript 3.0 :: Run Only Once StartDrag And StopDrag?

Dec 31, 2011

i created quiz. Questions of quiz, two question are fill inthe blank and others are multiple questions. i want to add matches question using startdrag-stopDrag. it runs in seperated fla. But it doesnt runk when i add to quiz.fla, actually mybadscrore doesnt work. However , how i can do to run only once square1.mc?

Code:

square1_mc.addEventListener(MouseEvent.MOUSE_DOWN, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(e:MouseEvent):void

[Code].....

View 3 Replies

How To Make A Infinit StartDrag

Mar 25, 2009

How to make a infinit startDrag So something like :Code: Select allstartDrag(this, false, 0, 0, infinit, infinit); Only this code acts like this:Code: Select allstartDrag(this, false, 0, 0, 0, 0); And also I'd like this startDrag to work with negativ cordinates.

View 2 Replies

ActionScript 2.0 :: StartDrag Outside Of Boundries?

Nov 22, 2006

trying to made a jigsaw puzzle, and using dynamic function to cut picture to pieces, but the pieces are not drag properly, except top-left coner one.how to make a good jigsaw, please share with me, it's my first game program in my life,

Code:
for(i=1; i<10; i++){
this.attachMovie("ad1", "pic"+i, 9+i, thumb);
_root['pic'+i]._x = 5;[code].....

View 3 Replies

ActionScript 3.0 :: Can't Get StartDrag Working

May 20, 2009

I have a MovieClip with other MovieClips inside of it. On each of the MovieClips inside, I have added a MOUSE_DOWN event and in the handler, I call e.target.startDrag(false, null);

But it doesnt seem to work :/

I have traced out the target name. I have tried current target and traced out it's name. THey both trace correctly. The target is being reached and it is the corect target. But the startDrag function doesnt make the MovieClip draggable.

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved