ActionScript 3.0 :: Dragging Movieclips And Getting Info From Them?
Feb 3, 2011
I've been doing a game that requires to drag some pictures into containers... that's all great.... but at the same time, I have to be able to obtain info from them (a pop up) when i click them.I've tried using CLICK and MOUSE_DOWN on the EventListeners, but everytime I drag the object, when I release it, the pop up shows.
View 5 Replies
Similar Posts:
Dec 7, 2003
How do I drag more the 1 movieClip using this
on (press) {
startDrag(screen);
}
[Code]....
View 3 Replies
Feb 27, 2010
I have a site that uses a custom cursor, I would also like to be able to drag other objects around. However in flash this seems to be quite difficult. came across this site called senocular and they had a .as file called beginDrag.asThey had some simple useage for the script:
on(press){
this.beginDrag(true,0,0,300,300); // constrained to 300x300 square
}
[code].....
View 1 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
Jun 24, 2010
I have some scrolling content (info). I've also made my own scroll bar.I want the scrollBar dragger to be positioned in relation to the info._y as the user scrolls info.I have created two vars: one that worsk out where info._y is as a percentage and the other that works out where the scroll._y dragger should be as a percentage...
Actionscript Code:
var scrollBarPercent = Math.round(scrollBar.dragger._y / [code]........
also onMouseWheel working too.I need a small bit of code that takes the % of info._y and moves the scrollBar dragger to the same % but in relation to the Stage.height...so if projectGalleryPercent = 50%, make dragger._y 50% of Stage.height using scrollBarPercent.
View 1 Replies
Aug 6, 2010
I m trying to make sense of how to load a swf into a parent MovieClip and allow them to communicate.I ve attached two zip files � one which works fine and the other doesn�t. Unfortunately (for me), the one which doesn�t work is closer to my current project.I need to load movieclips into the parent movieclip. The parent movieclip has controls which rely on values parsed from the child movieclip.In the parent movieclips I wait until the loading is complete and so the values should be passed. However, the values aren�t passed unless I use a button (or timer), to pass the values (see the working exampes).The code which doesn�t work is:
Parent movieclip:
ActionScript Code:
stop();
var myLoader:Loader = new Loader();[code].............
View 5 Replies
Dec 19, 2009
I have two SWF-Movies. One is exported into eht other as Child.Can I instance the Objects of the two libraries in all places, where ActionScript is possible? (In Keyframes of the MovieClips and in external class definitions.)
View 3 Replies
Sep 9, 2011
Looking for a way to stop all movieclips both are the stage and that are children of the ones on the stage.
I toyed with looping thru stage's children so I can first target clips on the stage. But I am getting error.
for (var i:int = 0; i < this.numChildren; i++) if (this.getChildAt(i) is MovieClip)
{
this.getChildAt(i).stop
}}
View 5 Replies
Jul 17, 2009
I want to if I can set a variable with the mc's name that the mc I'm dragging around hits.I did this before with eval() in as2 but there is not such a thing anymore. [code]...
View 4 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
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
Apr 3, 2010
so I am trying to drag around some images in a canvas. I am adding eventlisteners to the components and calling startDrag() and stopDrag() to pick them up and stuff:
component.addEventListener(MouseEvent.MOUSE_DOWN, component.startDrag)
The problem is that it is selecting the image at its (0,0) location and not where I initially click on it. So there's a sudden "jump" when I click on the image. It is not smooth.
I noticed that startDrag() has two default parameters, one of them is lockCenter and it is default to false. Maybe do I set it equal to true somehow? (I don't know how to pass arguments to my second parameter in addeventlistener)
Another question: if I want to add more conditions to it, like make a new function that uses component.startDrag(), how do I pass the component to this function while adding event listener to it at the same time? for example: I want to do:
component.addEventListener(MouseEvent.MOUSE_DOWN, some_other_function);
where some_other_function uses component.startDrag();
View 2 Replies
Apr 26, 2010
I have a flash project with three non overlapping panels (visual spaces) each of which contains different movie-clips. Each movie-clip in a particular panel is the child of that panel.Now, I want to drag one of the movie-clips from one panel to another (remove it as a child from the first panel and add it to the other) without a jitter and proper drag.What is the appropriate way to handle the drag architecturally
View 1 Replies
Feb 4, 2010
i am developing a flash game where i need to drag movie clips but i have to allow dragging only two direction x and y.
View 1 Replies
Mar 20, 2011
The code for dragging an object with the mouse is known:
mc.onPress=function(){this.startDrag(false);};
mc.onMouseUp=stopDrag;
I tried to drag two objects at a time using
mc.onPress=function(){this.startDrag(false);mc2.st artDrag(false);};
mc.onMouseUp=function(){this.stopDrag();mc2.stopDr ag();}
But this seems to drag only the object, corresponding to the last parameter in the function
How shall I drag more than one object at a time?
View 7 Replies
May 12, 2011
I've got a MovieClip that I want to drag around the stage, but only whilst the mouse button is held.
I've got this code:
[Code]...
View 1 Replies
Feb 29, 2012
I can't seem to drag a movie clip out of my scrollpane. It works fine inside the pane, but it won't show when I drag it out!
View 2 Replies
Dec 2, 2002
I'm messing around with a text box scroller. I want to be able to click on the scroller bar and drag it up and down accordingly.
Here is the code I am using:
on (press) {
startDrag ("_root.scroller", false, 578, 35, 578, 163);
} on (release) {
stopDrag ();
}
View 5 Replies
Dec 7, 2003
How do I drag more the 1 movieClip using this
on (press) {
startDrag(screen);
}
on (release) {
stopDrag();
}
View 3 Replies
Apr 6, 2008
I have a movieclip in the centre of a cross and want to make it move only along the lines of that cross. Is this possible with startDrag or do I need more complicated method? To illustrate: If you've moved left or right, you can't move up or down and vice versa.
View 2 Replies
Feb 15, 2010
I have need to simultaneously move a slider (called "shadeGrabber") movie clip and a mask. I'd like to do this by dragging the slider and seeing the mask move with it.
The example movie clip on the left (called "PICTURE_WIPE") is what I'm going for, but interactive instead. I'm working in the movie clip on the right (called "PICTURE_WIPE copy 2")
Here's my code, for quick reference (found on the "AS" in the "PICTURE_WIPE copy 2" movie clip:
[Code]....
View 4 Replies
Dec 20, 2006
I loaded a swf in another swf. Lets say in.swf is loaded in all.swf. But I need to pass some info from a movie clip inside of in.swf to another movie clip inside of all.swf.
View 10 Replies
Feb 22, 2009
I'm trying to get objects to drag and drop. Instead of dragging just the circle, it drags the entire screen. I can get it to work if I use "this.circle.startDrag()" but I want to be able to use the startMove and stopMove functions on different children, text boxes and other objects generically. Here's the code:
circle.addEventListener(MouseEvent.MOUSE_DOWN, startMove);
circle.addEventListener(MouseEvent.MOUSE_UP, stopMove);
function startMove(event:MouseEvent):void {
[code].....
View 2 Replies
Aug 19, 2009
Being adventurous I've got (all built in AS1) a masked area that you can view an image in. I'm trying to make it so you can zoom it in and drag it around, within the masked area, but the dragging locks it so that you can't drag it to the point where it leaves the edge of the masked area - if you follow. So when you're zoomed in, the iamge is never allowed to be dragged off so far that it's not filling the masked area. I've tried all sorts of code and the following code seemed to work well
Code:
// imageMC = the clip being scaled/repositioned/dragged
limitLeft = 0-Math.round(imageMC._width-maskWidth);
limitUp = 0-Math.round(imageMC._height-maskHeight);
limitRight = 0;
limitDown = 0;
imageMC.startDrag(false,limitLeft,limitUp,limitRight,limitDown);
But since the border size around the image is adjustable (it could be 2, it could be 20) and that eats into the area used to show the image (eg image is offset by imgBorderSize and shrunk by imgBorderSize*2) I tried to factor that into the formulas because once I turned the borders up the above formulas wasn't working right anymore
Code:
// imageMC = the clip being scaled/repositioned/dragged
limitLeft = 0-Math.round(imageMC._width-maskWidth)-(imgBorderSize*2);
limitUp = 0-Math.round(imageMC._height-maskHeight)-(imgBorderSize*2);
[code]....
I also tried to make it so when you zoom in, it zoomed in on the center of the area you can see through the mask, not on the top left - so repositioning is occuring alongside the scaling for the zoom to try and acheive that. Nothing clever, just :
Code:
// ZoomCalc range = 0-100;
// imageMC = the clip being scaled/repositioned/dragged
imageMC._xscale = 100+(2*ZoomCalc); // 100% - 300%
[code]....
When it zooms out however it'd be nice if it didn't snap back to center via the above code, eg if yu're zoomed into bottom left it would stay viewing bottom left as it zoomed out - yeah?If anyone has ANY input to this I'd greatfuly welcome it :/ If I manage to get it working then I have to figure out what my layer above all these layers with clickable buttons don't work as soon as I implemented the dragging of the image layer Is there no way to have buttons on something that is being dragged? ((
View 2 Replies
Sep 7, 2009
I basically am suppose to make "scarf" drag over to a movie clip named "winter_mc" and when it is on it, it is suppose to disappear but it's not disappearing. Here is my code used in the scarf:
Code:
on (press) {
startDrag(scarf, true);
}
[code]....
View 5 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
Aug 17, 2010
this math isn't working well. I'm using it for a rotated drag and drop (of a tone arm on a vinyl, a kind of abstract turntable simulation). Right now it just moves a bit in the middle of the vinyl (values between 21 and 36, is this degree or what unit is this?), but it should move between the two edges. The problem is that I don't know enough about trigonometry functions. Therefore I can't optimize the math for envisaged behaviour. Does anybody have an idea/tip how I can get a bit more control on the math and its effect? (maybe with more trace functions)
[Code]...
View 1 Replies
Sep 26, 2009
Is it possible to handle keystrokes WHILE dragging? I found this to be impossible, because hitting a key always fires an "onRelease" or "onReleaseOutside" event on the dragged movieclip when releasing the key - intterupting the drag operation. What I want to do is something like this: Drag and Drop a Movieclip and while dragging it I want to be able to flip it with a keystroke.
[Code]...
View 2 Replies
Jul 1, 2010
I'm trying to achieve a fairly simple effect--a dragging a MC with inertia.
Specifically, I'm trying to get this to happen:
1. When you click with the mouse on the MC (not the entire stage), the MC gets dragged along.
2. When you let go of the mouse button, the MC keeps going with inertia (slowly comes to a stop) that depends on the speed with which the MC was dragged and in the same direction. The MC shouldn't change directions if the unpressed mouse is moved around.
3. The dragging is constricted to the X axis.
View 3 Replies
Oct 28, 2010
I'm trying to enable the user to drag a movieclip vertically. I've coded something to be dragged horizontally, and thought it would be a simple matter of swapping some of the info around.
Here is my current code:
stop();
var leftY1:int = 120;
var rightY1:int = 400;
frontbar1_mc.mask = mask1_mc.rec1_mc;
[code]....
Now when the movieclip is clicked, it completely changes position and will only be dragged horizontally. Then when its clicked again, it will jump vertically by how much I previously dragged it horizontally.
View 3 Replies