Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Targeting Draggable MCs



I have a button on stage that when pressed, duplicates a movieclip. These duplicated MC are intended to be draggable when clicked on. The problem I have is passing the name of the clicked on MC to the startDrag function. Here is the code:


Code:
var i:Number = 1;

duplicate_btn.onRelease = function():Void {
_level0.attachMovie("clip", "clip"+i+"_mc", i);
i++;
};

someClip.onPress = function():Void {
//startDrag statements go here...
};
Is it possible to assign the name of the dynamically generated MC to the startDrag callback function, when the MC is clicked - without adding code to the generated MC itself? If so, how?

I want to try and keep all of the code on the main timeline and not have any code snippets attached to the draggable MCs. Am I trying to do the impossible here? Or is there something I've overlooked?

Thanks in advance for any help.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 03-30-2006, 08:11 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Draggable Item On A Draggable Mask
hello, i was trying to make a sniping game, and i can get the mask to drag. but i want crosshairs and it won't appear in the mask, so i put it on a diff. layer and it still won't work. has anyone had this same problem, and if so, please help me.

Draggable
hmm can someone tell me or point me in the direction of how to make a mc draggable using flash 5...
thanks

More Than Just A Draggable Map
All I need here is just a small push in the right direction and I am sure it will all click.

I have been looking for some time to get a map that I am going to use for navigating through a site, to drag on both the _x and _y axes. however rather than just creating a dragabble MC I was hoping to have a controller to make the animation look that much smoother. Has anyone seen a good tutorial or example to assist me or can recommend a solution.

Any response are greatly appreciated.

Draggable Help
problem:
i want to have a toolbar where you click the button, a movie clip will appear, and the user can drag it to any location they want.

Extra Credit:
in a perfect world, i would love to have a save button, that would save where the user placed these movie clips as a seperate swf file.


anyone that can help please do so...
thanks!

Draggable Nav Bar
ive made nav bar which i want to be draggable on my site, i made the background, then the buttons, grouped them as a movie clip and gme them the actions

onClipEvent (mouseDown) {
this.startDrag(true);
}
onClipEvent (mouseUp) {
this.stopDrag();
}

the problem is when people click one of the buttons it picks up the nav bar to be dragged and also when some clicks anywhere on the screen, the bar jumps there. how can i limit the bar from moving to only when its clicked on it a certain place and not the buttons or any random place on the page?

--> Following A Draggable MC?
I've been experimenting for several weeks now and haven't been able to figure this out.

I would like to set up my flash movie so that when the user drags a movie clip, other movie clips will move along with it depending on which variables are set. I can get one movie clip to follow another when dragged (using onClipEvent(enterFrame), but I would like to set this up on the individual buttons and only have it run when the user is in the process of moving an MC.

----------------------------------CODE----------------------------
on (press) {
_global.depth = _global.depth + 1;
this.swapDepths(_global.depth);
startDrag(this);
}
on (release) {
stopDrag();
//If piece is placed in following location lock it so that it can't be moved
if(this._x>467.5 && this._x<487.5 && this._y>53.75 && this._y<73.75){
this._x=477.5;
this._y=63.75;
_root.piece1MC.piece1._visible=false;

// If MC is placed in this position, it should be locked to the piece it was next to
}else if (_root.piece1MC._x < (_root.piece2MC._x - 62) && _root.piece1MC._x > (_root.piece2MC._x - 82) && _root.piece1MC._y > (_root.piece2MC._y - 8) && _root.piece1MC._y < (_root.piece2MC._y +12)){
_root.onetwo = "true";
}
----------------------END CODE------------------------

This is the code I have one MC (they're all similar to this). When variable "_root.onetwo" is set, I would like piece1MC to follow piece2MC and vice versa. The code to do this must be placed on each individual piece, otherwise only one will work.

Any help is greatly appreciated!

Draggable Mc
Hi, i have a function which allows me to drag my mc's on the x axis, but i now want them to be draggable on the y axis too.... so they can be put anywhere. My code for the x axis is below, any thoughts as to how i can make it completely draggable, not just on the x axis?

I'm fairly new to flash, thanks for your help.



onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, false) && _root.blocksDrag == false) {
this.startDrag(false, -800-this._width, this._y, 800, this._y);
}
}
onClipEvent (mouseUp) {
this.stopDrag();
}

Draggable MO + Following MC
Is there any simple actionscript to get a MC to follow a draggable MC.

Draggable MC
I basically need to drag a movie clip (just an image, nothing else) around the stage.. just did a search for it, but couldn't find anything in AS3.. anyone know where I would start?

Thanks!
Zg

Draggable MC Help
Hey folks,

I've been developing a little game thing...one part in particular is giving me problems.

There is a pic of a turtle, and a tortoise, and land and water. You're supposed to drag one of the two to its corresponding environment...if you're wrong, it goes back to the original spot, if it's right, it's supposed to stay.

It works on it's own (as seen here), but when loaded into the main container movie, they don't stay put.

Here's what i'm using on the MC's of the buttons of the turtles;


Code:


on (release) {
stopDrag ();
if (_parent.tortoise_drag._droptarget == "/tortoise_target") {
//_root.tortoise_target.gotoandStop("tortoise_hold");
_parent.tortoise_drag == stopDrag();
}
else {
this._x = 490//the old xposition of the MC
this._y = 145//the old yposition of the MC
}
}



I"m guessing i'm incorrectly using the _parent and _root somewhere, but not sure.

Thanks!

Draggable Mask?
I have tried but failed miserably to accomplish this task...

Using Startdrag, make a draggable mask layer to create a magnifier effect.

Can it be done?
Any hints?

Regards,

Draggable Pop Up Window
what I want to do is have a draggable window pop up at a certain location within the main movie when I press a button. what code do I attach to the button? I know the drag stuff, but how do i set the position?

Draggable Buttons - Help?
ive got a 'nav bar' (movie clip) on it are 7 buttons.
the 7 buttons are in the movie clip.
the nav bar is called 'menu'
i want to make the nav bar draggable and have the buttons clickable to go to 7 different scenes in the main movie.

help would be great as Im at work and struggling

Draggable Buttons
I have created a draggable button that works fine. The problem is that I created another button which leads to a URL that seems to get dragged along with the other button even though it is on a different layer and has no script. Does anyone know how to seperate the button behavior or keep the entire movie from being dragged with the draggable button? Thanks for your help
Terry C

Draggable Menu
Hi there,

Reading about inertia and dragging things in Foundation Actionscript (thank you mr. Sham Bhangal), I wanted to make a draggable menu. One button is used to move the menu, the menuitems are supposed to follow that button. My problem is that the menuitems aren't aligned after moving the menu around. Any suggestions?
http://users.skynet.be/sky39384/flash/drag_menu.fla
http://users.skynet.be/sky39384/flash/drag_menu.swf

Draggable Mask
Hey Guys,
Just wondering if it was possible to make a draggable mask. I tried making a mask, turning it into a button and then making it draggable but that didnt work since it takes everything below the mask with it. So when I just want to drag the mask, I end up dragging the maskED images as well. Any help would be greatly appreciated. Thanks guys
Don

Draggable Scrolling Help
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Aaaaaaaaaaaaaaa
This will be the third time I've tried to post this! Flash kit is TOO SLOOOOOOOOW. It's really frustrating.

So anyway, I really need to find a good, fairly basic tutorial on the scripting involved in creating a draggable scrollbar, preferrably a "continuous feedback" one. I've been working with a tute here on flashkit, but it's a little more advanced than what I need right now. In fact it doesn't even contain any real explanation of how the scrollbar part works, but focuses on adding more advanced features to it. It seems a tad convoluted, but this is the best thing I have found. If anyone knows of a clearer tutorial on the web, or if you could even post a little code with a brief explanation, that would be great. I appreciate any help that anyone could offer.

Draggable Windows
i've been tryin to get this draggable window thing down can someone please help me out? i'm tryin to make a draggable window, alost where you can close it, and also make it retractable as it opens. andy info would help, thanks

Draggable Scroller
i want to make a small scroller in my flash project.

on sreen at the moment i have a line and a small square, the square will be
the draggable scroller and the line will be the guide.

how can i slide the square back and forward the lenth of the line

Draggable Popups.- Help
HI I need some help here. I am trying to use a draggable popup window (a flash generated window, not a browser popup.) and i have gotten one window to work quite well. if usiing multiple windows it doesn't work. To recap what i did....i took the movie clip and buttons and duplicated them gave them other names and in the actions (set property _visible) changed them according to the new file names. still it doesn't work. I downloaded the fla from masaflash's tutorial and have been trying to get a hold of him...no luck. i'd appreciate any help anyone could give me. my deadline is approaching!!!

thanks in advance.

Draggable Objects?
Howdy all-

I'm an experienced programmer (but new to Flash) trying to figure out how to create the appropriate button/movie to allow for a mouse-draggable object (as seen in the myriad draggable/throwable ball demos).

I have the actionScript written for start/stopdrag-ing the button, and the physics for the ball graphic movie, but can't seem to figure out how to connect/link the ball movie and the button to make things work. Is there a way to make the button a child of the movie somehow? Right now my ball object bounces around fine, while the button used for 'grabbing' it just sits in the scene.

Any help (or direction to related tutorial) is much appreciated. Thanks!

Draggable Mask
i am trying to make a "draggable" mask using two movie clips. like the tutorial given here on FK. the mask is working, however when i test the movie and even publish it, the mask, and image that is being masked is cutoff in the upper left hand corner of the page. does anyone know how to get the entire image on the page, i would like the user to get to drag the mask over the whole image, not just that small area.
Thanks
Jon

Snapping A Draggable MC
how can one snap a MC to different spots along a line?

i want to drag a MC along a timeline and have it snap to different spots along the way... or if neccesary, after i release the mouse.

so the effect i'm looking for is for a MC to snap to many different spots as you pull it across a timeline... always snapped one spot or another.

any feedback greatly appreciated!

quazi

CONROLLING A DRAGGABLE MC
Ok, here's the scoop: I have a button in a MC (glossary). when U click the button (in frame1) it goes to frame 2 (still in glossary) and displays another MC that is draggable, minimizable, and maximizable. When the close button is clicked, it goes away. Fine and dandy, that's what I want it to do...

However, I would still like to click the glossary button to run this draggable MC again in case I need it again. What's the scripting for this?

Draggable Objects
How do you make more than 1 draggable object that dosen't take others with it? Give me a detailed explanation with an example.

Draggable Plane
I'm trying to make a Window (Draggleable Plane) in my flash movie. This is what I want to happen:

1. You click a button
2. Window comes up
- I want the window to have a Dragable title bar
- An [X] button that closes the window


Also my movie to have multiple windows but so that each windows open they dont open on completely on top of each other.

-Thanks

Draggable MC Snapping
can you have a droptarget inside another movieclip...and detect it with drop target... any work arounds?

if(eval(_root.draggable._droptarget)==_root.hotspo t.MC){
}

[en]

Draggable Resize
Question. How could I make something like: http://www.globz.com

The resize button where the user can click and drag the movieclip bigger. How can this be accomplished?

Draggable Mask
can someone point me to a tutorial on making a mask draggable? I have tried but have not had any success

thanks

Draggable Window
I have this working script for a draggable window:-

on (press) {
startDrag("/well", false, 0, 0, 640, 480);
}
on (release) {
stopDrag();
}

I can't figure out what the part in bold does, it works with and with out it.

false, 0, 0, 640, 480


I think the 640 and 480 may be the drag area, Any Suggestions? If you know please gimme loads of detail!

Thanks and Merry Christmas

Draggable Menu
i want a menu that can be drug to only a certain _x and once it has hit that mark i want it to stop how do i do this i have tried allot of things.

Flash MX

Draggable Windows
I'm making a flash site, and I would like that when I click a button a draggable window will pop up, with the information I want. I would also want to do this the easiest way possible. If you can help me with this I would really appreciate it.

How To Make Something Draggable?
Hello

First of all, let me say that I am relatively new to Flash. I am working on something for a web site and want to do an effect like this: I'm going to have about 5 different mustaches and you can drag the mustaches onto a picture in a Flash movie. I have no clue how I would go about doing this. Could someone please help me and sort of explain it to a newbie?

Thanks!

Draggable Masks
I have 2 movieclips in my interactive movie, which have 2 sepearte masks inside the clips. this movieclips are 2 draggable sliders which can only move in the horizontal axis. if you drag any of the slider, the mask inside that clip is also dragged and reveals the filling(the graphics which i want to be seen). my problem is if 2 sliders are dragged in random, then the slider in the bottom layer doesnt function properly meaning there are image jerks. this happens only when you move the slider(in the bottom layer) inside the region already covered by the the other slider(the movie-clip in the top layer).
i am lloking forward if you can come up with a solution for the problem.

Draggable Polygon
I have drawn a polygon, now I want to make the buttons/ MC's on each corner point, so that when a corner is dragged the lines goes along with it. For some reason I can't target the _x and _y values of the duplicated MC's. Please Help

Thanks




Code:
Arrayx=[50,300,0];
Arrayy=[300,315,0];
function DrawPoly1b(StartingPosx, StartingPosy) {
Test.lineStyle(1,xx000000,100);
Test._x = StartingPosx;
Test._y = StartingPosy;
Test.lineTo(Arrayx[0], Arrayy[0]);
Test.lineTo(Arrayx[1], Arrayy[1]);
Test.lineTo(Arrayx[2], Arrayy[2]);
//Creates MC to be placed on
for(i=1; i<4; i++){
duplicateMovieClip(Test, "Test"+i,i);
temp="Test"+i;
temp_x=Arrayx[i-1];
temp_y=Arrayy[i-1];
trace(_root.i._x);
}
}
DrawPoly1b(50,100);

Help With Draggable Image
I have aquired this code to create a draggable movieclip containing an external image (jpg) when the relating thumbnail is pressed...




The panel itself is actually an image placed into a movie clip. Also in the movieclip is a button with the alpha lowered to 0% so that it is still active, but not visible
The mc is placed into the main movie timeline and given an instance name : draggable

the button within is then applied the foll code:
on (press) {
startDrag ('_root.draggable');
}
on (release) {
stopDrag ();
}

Where as the button is pressed, the movieclip ('draggable') in the main timeline ('_root.') is told to follow the mouse (startDrag) as soon as the mouse button is released the drag is dropped.

The other actionscript on the thumbnails tells the movieclip which image to display.



BUTTON CODE

on (release) {
if (isOn == false) {
// the panel is not currently visible
tellTarget ('_root.draggable') {
gotoAndPlay ('on');

}
tellTarget ('_root.draggable.slide') {
gotoAndStop (1);

}
setProperty ('_root.draggable', _x, '175');
setProperty ('_root.draggable', _y, '150');
isOn = true;
} else {
// the panel is currently visible
tellTarget ('_root.draggable.slide') {
gotoAndStop ('1');
}
}
}




However, I am a true flash virgin and although I am desperate to learn flash after defecting from html, I need a little help to translate and understand.
Are there any flash Pro's out there that can break it down for me step by step on how to use this code to display the images I have outside my flash movie file, and where to input the file names, location etc.

Much appreciated

KAIN

Draggable Problem I Have.
Hello, what I am trying to with a draggable movie clip is in relation to a map.
I have a large map below, and a smaller to scale map above. I have a draggable movie clip in the small map, that when i move it in any direction over the map, i want the larger map below it to move in the opposite direction.

So the user can basically use the draggable icon in the smaller map to navigate themselves around the larger map to see more detail.

I know the code might be to much to put in here, and rather complicated i would imagine, but i was wondering if anybody has made anything like this that i can have a look at to get the idea of what i need to do.

Thank you

lee

Draggable Masks
how do u create a draggable mask?

i fon;'t one that you drag, but I want one that follows your cussor! It will be very apreciated!!!!!!!!!!!!

Draggable Menue
hello very easy question... hope u can help me
i wanna make a draggable menu.
its a little box with 4 buttons inside i want that box to ve able to move with the move ON CLICK
tnkx alot.

Loadmovie In A Draggable Box
I need help with this. Can somebody send me script for a draggable box or at least a tutorial. Also Do I just need to attach a loadmovie code to that box?

JPEGS - Draggable?
In FLASHMX i import a jpeg and convert it to a movieclip
I give the movieclip an instance name of "MC".

Then i put this script in:

startDrag("MC", true);


IT DOESNT WORK?

If i put it in Flash5 it works perfectly.
The idea is to drag a picture under a mask.
PLEASE HELP?

Can You Have Draggable Masks?
I want to have an area that is able to be draged by mouse events, displaying information underneath.
It be be a mask effect, where the item is draged over the underlying image which would become 'visible'.
When I try to drag an object which is the mask, it along with what i'm masking disappears.

Draggable Menu
I am just having a problem with being able to use buttons in a dragged movieclip...

How can I have the movieclip drag and use buttons from within it?

thanks for your time...

AS Draggable Kite?
I remember seeing a fla. for a draggable kite at flashkit before, but havent a clue where it may be now, searched everywhere I thought it may be under. By draggable I mean there were certain points you could click on and move about, then the AS would work out a realistic motion for it.

Any ideas where this might be hidden away?
Thc
Lev

Duplicating A Draggable MC
Howdy - I'm trying to figure out the proper way to duplicate a draggable movie clip. Ideally, I'm looking for a way to "stack" the mc's on top of one another so when you drag one out, another sits underneath, but each able to be dragged independently.

I've gotten it to the point of being able to dup. a movie clip, but when I go to drag the new mc, only the original is draggable. Any ideas on the best way to go about this without adding much to the file size?

Thanks a ton!

Draggable Effect
Please help me, how to create this dreaggable movie effect. Please attach the example source file. So we can easily understand.

Draggable Menu
I want to have a navigational pop up menu and be able to drag it around and drop it anywhere in my flash movie. I have figured out how to drag and drop it and even define a certain hit area for it, but I cannot figure out how to create links inside of the pop up menu, it won't let me click on anything I put inside of it. Any help is appreciated. Thanks.

Draggable MC With Buttons Within
http://www.araj21.dsl.pipex.com/dragMask_a.fla

Hi Guys,

Above is a link to the file I am referring to.

I need to have a button within a dragable MC (the red square in the MC traces 'press'). This I have achieved, however, when I add onReleaseOutside the functionality of the button stops. Can anyone explain how to get around this?

Many thanks

Ol

Draggable? Or Button?
Hey everyone,
I'm making a game that involves moving objects around in a room environment in order to find objects hidden behind them. I've played around with making the objects draggable but i don't like how you can move it anywhere on the stage, is it possible to constrain the area in which a object is dragged? or is there a better way for the viewer to move objects? possibly making them buttons? Please let me know, any help would be great!! thanks, Jen.

Copyright © 2005-08 www.BigResource.com, All rights reserved