ActionScript 3.0 :: Mc Mirrors Position Of Mc Being Dragged?
Nov 14, 2009
I have 2 mc's which can be dragged. When one is dragged I want the other to mirror the position of the dragged one.
say they are mcA and mcB
if mcA is dragged,
mcB's x should = mcA's x and
mcB'sY should = mcA's Y * -1
same for when B is being dragged but reverse obviously
I want this to execute continuously while one of the mc's is being dragged. I tried using while with a boolean, maybe you can't? here is what I tried to simply get one to work, just B to follow A when A is dragged.
PHP Code:
var dragging:Boolean = false;
main_mc.mcA.addEventListener(MouseEvent.MOUSE_DOWN, startDraggingAB);
main_mc.mcB.addEventListener(MouseEvent.MOUSE_DOWN, startDraggingAB);
I am creating an exercise to teach the meaning of the word "take". I want draggable objects (MC's) which will automatically snap to a different position when they are dragged a little way.
This is the code I am trying (not mine I'm afraid). I have it on the same frame as the MC in "Actions - movie clip". The MC is draggable but doesn't snap.[code]...
I need help with MC's animation causing a weird conflict. I have a movie clip come out and appear to drag another to the side of the stage. I get a weird wobble and dither from the mc that is dragged in horizontal motion. I have included a simple example, the original has complex motion on the "arms: so I used a simple box to demonstrate problem. I am at a loss as to what is causing this. This is a flash cs4 file.
I have set up some objects so that they can be dragged and dropped into an area(suitcase). This works fine but the thing is that when I move to another part of the timeline the object is put back in the same position it was in before being dropped in the suitcase. I need to be pointed in the right direction with this:
a) If an item is dropped into the suitcase then a message is displayed saying for example "you packed the socks"( I think I can handle this).
b) The object should stay in the case and be displayed there until the interaction moves on(I need this to happen).
c) The user must pack all objects before moving, so I need a way of recognising all objects are packed so that the user can move on..(I need this to happen).
Can i create a custom text animation or something. Ofcourse without involving variables. And can i use this Movie clip in various projects. What am i supposed to do, save it and keep it as a .fla or can the movie clip alone be saved and imported into various projects ?
I'm just wondering if it's possible to have a page of text that is 'invisible' (for want of a better word) and when you move your mouse over the page, the text appears in a circle (of whatever radius) around the mouse point.The text would be clearest and darkest at the mouse point, and fade out towards the outer circle, and 'appear' smoothly as the mouse is dragged around the white page.
how to determine if there's a dragged object. Is there a way to do this?
I know if you start another drag on the other object it will stop the current dragged object. Maybe there's a public function that will query about this?
I am using PopupManager in FB4 to display a custom dialog.
popwin = new TitleWindow(); popwin.addElement(myCustomDialog); PopUpManager.addPopUp(popwin,this,false); PopUpManager.centerPopUp(popwin);
It's possible to drag the popped up TitleWindow and let go of it when its gray title bar lies outside the bounds of the Flex app rectangle,and then the popup cannot be grabbed again.It's also possible to drag the TitleWindow downwards so it becomes completely invisible below the bottom edge of the Flex app rectangle.When the Flex app bounds are less than the full browser window,and the user is working quickly, this chances of this happening increase.Is there a simple setting that will keep this from happening, or must the programmer intercept the behavior during the drag operation?
how to make a draggable map but the map can only be dragged in an area. let say if i did a rectangle as the limit,so the map can only be dragged within the rectangle... outside of the rectangle cant be dragged and cant be seen...
So I am using actionscript 3.0, not FLEX so I had to make my own drag and drop code. The only thing I now need is a way to create a copy of the datagrid row that follows the mouse when dragging. How would I make a 'semi-transparent image' of the row to drag along with the mouse when I drag? It would seem like there would be some way to render a row as an image, but as of now its unknown to me. I would use a MOUSE_MOVE event in combination with knowing that the drag is initiated, but how to I generate the image itself that will be dragged?
I have 26 letters(english alphabet) into a linkage movieclip(var let:Letter = new Letter() ) and I put a drag and drop function into the mc. My goal is to drag the movieclip leaving the original on its position. The reason why I want to duplicate is that when I spell a word with single vowels on it ex. "word" with single "o" that would have no problem. But when I spell a word ex. "banana" with 3 "a"`s there is where my problem is.
I have a simple game that allows the player to drag counters around a board (just a background image).There are 23 counters created in the main .as class by calling another class, called "Units.as". The counters are added into an array in the main class like this:counterarray[0] = new Units("1",2);(where "1" and 2 define the label and colour of the counter)I do this for all 23 counters.[code]The class Units.as defines the counters as rectangles and places mouse listeners so they can be dragged around.My problem: I want to save the information about the counters to a shared object, but if you move a counter around, the counterarray[0].x and .y remain stubbornly where I originally set them - as 100 and 50.
I tried passing the x and y co-ordinates to Units (e.g. counterarray[0] = new Units("1",2,100,50); ) but while this works for placing the units, the value of counterarray[0].x is now zero and doesn't change when the counter is dragged around.I've only been using AS3 for a couple of weeks so suspect I am missing something obvious, but I've spent the last couple of days searching the internet & can't find it.
i already made a working tooltip.now i want the tooltip to be dragged by the mousepointer movements....but the tooltip should always keep the same y-axis position....something like maybe:
what I have are pieces of a truck and the user needs to be able to drag and drop the pieces to the correct locations. I can get the pieces to drag, but I need help locking them into place once they get within a certain area. So for example if they drag and drop the wheels of the truck towards the back, but not in the exact location, then the movieclip will move and lock into place and then the movieclip becomes disabled.
var dragMC = finalMC.graphicMC; /////////////////////////////////////// onMouseMove = function () { updateAfterEvent();
I have an masked image that is externally loaded onto my stage that the user can drag and position.I then need to be able to record or save where and how the user has positioned the image by either -taking a bitmap copy of where the user has positioned the image (my first and easiest thought of how to do this) -or is it possible to get X and Y co ordinates of where they have positioned it I have a movie currently set up but when the user clicks 'save and continue' it takes a copy of the original position of the image - not from where you have last dragged it to?Full code and attached fla file below
Code:
stop(); //-------------- // Loader //-------------- var imageP1:Loader = new Loader();
I'm doing a little drag and drop work and I'm wondering if it's possible to change the size of an object when it is dragged over another object on the stage..
For example I would like to drag a square movieclip around, but when it is dragged over a certain object it either play the movieclip and 'morph' into a rectangle or simply become rectangular (using a frame label or something) !
Is it possible to do this sort of thing with hitTestObject or hitTestPoint or dropTarget without contiuously checking if the objects are in contact ?
I think there is a simple solution to this question, just not simple enough for me to find it.Question:How do you constrain a TitleWindow in Flex 3 from being dragged off the screen/stage? Is there a way to restrict the TitleWindow to the viewing area? Example: Let's say I have an application that take 100% of the screen. Next, I create a TitleWindow via the PopUpManager. I can then proceed to click and hold (drag) that window off the screen, then release the mouse button. That window is now lost off-screen somewhere. Is there a way to keep the window from being dragged beyond the viewing area?
I have a flex tree with dragMoveEnabled = true. I want to find out, when an item is dragged into itself or it's children. I'd like to use DragManager.showFeedback(DragManager.NONE) in the tree's onDragOver handler, but can't find out how get this to work. I'm using an ArrayCollection of nested objects as dataSource for the tree.
I have a number of instances of a MovieClip on stage. These are dragged onto the stage and arranged manually. Now, I would like to alter the instances during run time, using as2 code.
how can I name all the instances of the same MovieClip dragged onto the stage, using as2 code? (specify if the solution involves exporting the library MovieClip with an identifier name)
I have a list that accepts drops. When an item is dropped (DragEvent.DRAG_DROP) I need to collect the data that is dropped, however I have found nothing in the event thatdo so, event.dragInitiator.selectedItems would work but gives me an error.
I have the AS to move pictures around (like a jigsaw puzzle i guess), im just struggling with setting boundaries so that the pieces cannot be dragged off the stage...
Im presuming setting the boundaries is a matter of adding X and Y values or similar.
I am trying to simulate onpress and onrelease functions but using onMouseDown and onMouseUp.squareContainer can be dragged around but squareBack, which is inside squareContainer changes colour when clicked. These both work.But.. when I drag squareContainer around, if the mouse is on squareBack (back) it changes colour as it sees it as onMouseDown. In the mouseUp, if squareContainer has changed position then it has been dragged. Then, using this I somehow want to say in mouseDown that if squareContainer is being dragged then dont change colour.. but it doesnt work!!![code]
I'm using AS3. I have a timeline with 12 labeled frames (page 1...page12). On frames 1 to 10, I have 3 objects that users can drag and drop onto matching places. There is a timer (60 seconds) and a counter. Users should match 15 objects correctly. If so, they go to frame 12 (congratulations!). If not, they go to frame 11 (Sorry, try again), which returns them to frame 1 (page 1).
ISSUE When users drag an object (mouseDown) and don't release it when time is over, the dragged object remains on the screen. When users go to frame 11 and game starts over, the object remains throughout the entire game.
How can I get rid of the dragged object that isn't dropped when the time is over?
ActionScript Code: // // TIMER var time1:int=60; var myTimer1:Timer = new Timer(1000, time1);
I have 2 custom class objects (both MC). I want to check when objA is dragged onto the objB. Each class constructor defines it name value, so on creation in my document class, if I trace thier names they come out as objA and objB. In the code for objA, I manage the startDrag and stopDrag:
I have an masked image that is externally loaded onto my stage that the user can drag and position. I then need to be able to record or save where and how the user has positioned the image by either
-taking a bitmap copy of where the user has positioned the image (my first and easiest thought of how to do this) -or is it possible to get X and Y co ordinates of where they have positioned it
I have a movie currently set up but when the user clicks 'save and continue' it takes a copy of the original position of the image - not from where you have last dragged it to. Full code and attached fla file below:
Code: stop(); // Loader var imageP1:Loader = new Loader(); var request:URLRequest = new URLRequest('XXXXXXX/image.jpg'); imageP1.load(request); addChild(imageP1); [Code] .....
I've got a question about depths. Im building a gallery that contains thumbnails (like the thread that happened a week or so ago). Each thumbnail is dragged and dropped somewhere to load something else. But, all of the thumbnails are going underneath the other thumbnails when dragged. What do i need to add to my movieclip thumbnails to have each one getFocus from the others when dragged?