Dragging And Dropping Using Drop Targets
Hello,
I've just been checking out the useful Flash tutorial on Dragging and Dropping Using Drop Targets.
I was wondering whether there is a way that a user can save thier results before closing the .swf file? And then when the user re-opens the .swf file, the saved settings from the previous session are saved and available for the user to view, change etc...
Any help would be greatly appreciated.
Cheers
Andrew
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 03-15-2007, 08:13 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dragging And Dropping
Hi there,
I am playing around with "Dragging and Dropping" in Flash 4. I have a button with a movie clip on the down frame.
Now here is my problem...every thing works fine..the movie plays when I press the button and its stops when I release.
BUT the user can also drag this button around the screen...to move it out of the way in a sense...but if I add a background layer to the movie scene...everything moves along with the button when I drag it around.
What am I doing wrong?
Here is the Action code of the button in the Movie scene.
On (Press)
Go to and Play (1)
Start Drag (GetProperty ("/MyMC",_y ), L=-140, T=-60, R=210, B=100)
End On
On (Release, Release Outside)
Go to and Play (15)
Stop Drag
End On
Please help me somebody?!
Zen And The Art Of Dragging And Dropping
anyone have any ideas on how to drag an object to a specified space, say a box.... drop it in the box and have it magically wisk you away to another scene or page?
Dragging And Dropping
umm... i am a REAL noob. the most actionscript i know is how to make a movie stop and start. i want to make something kinda weird. see, it has a bunch of squares and some characters. you drag the characters and some word balloons into the squares to make a comic. i looked at a tutorial and it's not workin. PLEEEASE help.
Dragging And Dropping
I'm trying to make a drag and drop interface for a school project, and Whenever I click on one it is dragging the entire project around, and not just that one symbol.
http://www.softmodfiles.net/flash/
There's the FLA right there, but here's the actionscript I have:
Code:
on(press)
{
startDrag(this);
}
on(release)
{
stopDrag();
}
Dragging And Dropping
Working my way through the tutorials, and I got to the Drag and Drop tutorial.
I have the clip instance, with a button inside with dragging and dropping working properly, but I'm having problems with the drop target.
If the user drops the clip on the target clip, I want the target clip to animate, but the code in the tutorial doesn't seem to be working. The target clip has a stop(); stop command on frame 1, so I'm trying to get the drop action to start animating the target clip at frame 2.
Here is the code via the tutorial for the object being dragged into the blender (someone's head )
ActionScript Code:
on (press) {
startDrag (this, true);
}
on (release){
stopDrag();
if (this._droptarget=="/blender") {
_root.blender.gotoAndPlay(2);
}
}
The movie clip of the blender is named blender, as well as the instance on the stage. Is there any reason this shouldn't work?
Thanks
Tru
Dragging & Dropping
Well, here I am again...STUMPED, LOL!!!
Basically, I'm trying to create something that will let me drag an object (object_A) onto a hit area (object_B) and give it the exact same x and y coordinates as object_B.
I know object_A has to be a movie clip with a button inside of it and that the code has to go on the button, not the movie (because the 'drag' function only works with a handler like on_press for example).
Anyways, this is the code that I have right now:
on (press) {
startDrag("_root.object_A");
}
on (release) {
stopDrag();
if (eval(object_A._droptarget) == _root.object_B) {
object_A._visible = false;
} else {
object_A._x = x_480;
object_A._y = y_90;
}
}
The other catch is...object_A needs to be able to be dropped onto several possible hit targets, not just object_B (eg. object_C and object_D).
Not sure if it makes any sense to anybody but, if you have any ideas they would be greatly appreciated!
Dragging On My Dropping
Hello all
Can anyone tell me if there is a way to drop a MC into a moving MC target. Basically move my object from one MC to another. I've got a working solution but it requires a lot of code. Hoping someone has a nice little actionscript magic out there that I am as of yet unawares!
Thanks in advance!
Dragging And Dropping
Hi there,
I have been using flash 5 on and for a few months, and can make basic animations and use (very) basic scripting, but i would like to know how it is possible to drag an object (i think it has to be a button so you can use the 'on press') over the top of another object (a graphic) without the other object pulling along with it. i have tried to do this what is probably a basic thing, but everytime i drag the button the other object goes with it. i would also like an alert to appear when certain buttons go on top of the graphic. oh yeah, and is there a way of emailing the finished thing with the click of a button. what a mouthful all that was!!!
as if thats not enough, i am finding it difficult to create cartoony images with flash, and wondered if there is some other application i could use to create cartoons(gifs with transparent backgrounds) that i could import and use in flash. or alternatively are there any good tutorials available about how to create decent cartoons that dont look like complete poo!!!
thanks to anyone who can help, and sorry in advance if these questions are a load of kack.
get involved...
Dragging, Dropping, Swapping
im quite new to flash, and my understanding of programming is limited, very limited. but i do want to know how to do this: im designing a small game, and there are six targets and six answers. the user has to drop each answer into a target. once each target is filled, the user can choose to swap any answers over. i have no idea how to do the swapping thing. and for the dragging, do u just set it up as a normal dragging movieclip thing?
Trouble With Dragging And Dropping
Hello,
I am working with MX 2K4, and I'm having trouble with dragging and dropping (newb). I'm trying to make a review file that will have a group of draggable clips. My goal is to have the draggable clips stop when they've reached their drop target and read correct. If the drop site is incorrect, then the clip will say "incorrect", pause long enough for the user to comprehend what's going on, and return to its original position.
Right now, I haven't been able to get the program to read correctly. I believe that I've typed in the drag-drop interaction correctly, but without the dadgum thing working, I know I've gone wrong somewhere. I also know that I will need to use a setInterval to send the button back to it's original spot, but I'd figure I'd wait on that until I get to it (I really am trying to learn this!)
I've attached a stripped down version of what I'm working with if anyone would be willing to look at it. Thanks in advance...
Dragging And Dropping Images
Can i apply drag and drop to images where the drag item and the drop target are both images? or can it only be applied to movie clips with a button inside it? thankss
Dragging, Dropping Question
Hi. Im trying to create a type of drag/drop puzzle where the user drags and drops each of the 4 peices and when the puzzle peices are in the right spot it loads to a new scene. How would i code it so when the symbols are at certain X,Y positions the puzzle is correct and it loads the new scene? Is there an easier way
Thanks guys
Dragging And Dropping Problem (seems Simple Enough)
ok this is seriously frustrating me...
i'm doing a drag and drop of one triangular shape (instance name - "triangle") into it's duplicate (instance name - "triangleDrop") when this draggable shape is dropped over it's duplicate it is supposed to fit exactly intothe exact position of it's duplicate, so that you can hardly even tell if there is one triangle on top of another.
Problem is when i do this it works but leaves "triangle" slightly hanging off on the side, above or below off "triangleDrop".
Then it looks so obvious that there is two of the same shape. Anyone know how i can make it snap right on top of it's counterpart?...arghh.
Here's the code i'm using for the button within the MC ("triangle")
on (press) {
var xx = _root.triangle._x;
var yy = _root.triangle._y;
startDrag ("_root.triangle");
}
on (release) {
stopDrag ();
if (_root.triangle._droptarget eq "/triangleDrop") {
_root.triangle._x = _root.triangleDrop._x;
_root.triangle._y = _root.triangleDrop._y;
} else {
_root.triangle._x = xx;
_root.triangle._y = yy;
}
}
Dragging, Dropping & Triggering Actions
Hi,
Can anyone please tell me how I can achieve the following?
Here is what I am trying to do. I have found a open source fla that allows the user to drag a movie clip onto a target mc and it triggers some dynamic text to tell the user either - you dragged successfully or you didn't drag successfully.
The main reason for me using this code/fla is that it tells the dragged mc to glide back to it's original position rather than snapping back.
I need to know how I can add multiple draggable mc's to the file and add different functions to the mc's so as when they are dropped on the target mc the trigger gotoandplay or load movie functions depending on which mc is dropped on the target.
I would also like to add something to the code that would recognise if another mc is being dropped onto the target and would swap the newer mc for the one already in there and return the older one to it's original position with the gliding method.
Has anyone done this or similar before? Is there any tutorials/open source etc... that anyone can recommend please?
or maybe by taking a look at my existing code suggest how I can do it please? here is the code that is placed on the first frame of the timeline:
HTML Code:
// dragMe_mc in the instanceName of the movieClip
// Starts the drag onPress
dragMe_mc.onPress = function() {
this.origX = this._x;
this.origY = this._y;
this.startDrag();
};
// dragMe_mc in the instanceName of the movieClip
dragMe_mc.onRelease = function() {
// stops drag onRelease
this.stopDrag();
// dymainc txtField+Message displays "error"
if (dropHere_mc.hitTest("_root.dragMe_mc")) {
// snaps the dragMe_mc to the dropHere_mc in the middle of _x&_y
this._x = _root.dropHere_mc._x;
this._y = _root.dropHere_mc._y;
// dynamic txtField+message displays "success"
infoText = "Congratulations you dropped it correctly";
// disables this dragMe_mc from being dragged again after dropped correctly
this.enabled = false;
} else {
infoText = "You dropped it incorrectly";
this.onEnterFrame = function() {
// i'm using temporary values here to hold the x & y distance because
// they're being referenced more than once
var dx = this.origX-this._x;
var dy = this.origY-this._y;
// Math.max(dx,dy) is a cheesy but inexpensive approximation of the distance to the original position
if (Math.max(dx, dy)<.1) {
// stop moving when we're close enough
this.onEnterFrame = undefined;
}
this._x += dx/3;
// 3 controls the speed - use a larger number for slower movement
this._y += dy/3;
};
}
};
Any ideas action script clever people? I have attached the fla (maybe someone can take a look at it?) Any help, ideas or suggestions will be warmly received, and thanks for taking the time to read this thread.
D
Triggering Script After Dragging And Dropping
Grrr, After I drop a draggable object, a new draggable object is supposed to appear but it does not.
I know the 'generate new object' code works, because I have a separate button on the page which does work. Unfortunately the code does not work when the user releases the draggable object though (which is what is supposed to happen).
I have attached the .fla for this so you guys might be able to help out.
Mark
Dragging And Dropping Buttons /MC Questions
I created a flash movie with a lot of buttons for dragging and dropping around in the stage.
I wanted to make it such that even if i drag one of the button away from its original position, a new same button will appear at exactly the same position. Also, i would like to make it that some buttons are always on top of the other items when being dragged and dropped.
How do i do this?
I am only able to code the dragging and dropping part, but not able to do the rest whereby some buttons are always on top of the others and there will be new same button when the button was being dragged.
I do not know how do i code for movie clip, is it better to use movie clip instead of buttons?
[FMX] Dragging And Dropping A Duplicate Clip
Hi, I'm creating a drag and drop movieclip to colour a different movieclip. I need to duplicate the first instance so as the original stays in the same place (on the pallette), and then the dragged one can be removed after it has been dropped into the area. This is the script for the dragging and dropping of the original instance, but I can't figure out the duplication/removal part:
on (press) {
startDrag("_root.pallette1");
this._alpha = 70;
}
on (release) {
stopDrag();
if (eval(_root.pallette1._droptarget) == _root.one) {
var colorful = new Color("_root.one");
colorful.setRGB(0x0066CC);
}
}
Can anyone help, please?
Cheers
Problems Dragging & Dropping & Defining Y Axis
I am new to Flash, but have taught myself quite a bit so far. Right now I am having a problem with dragging and dropping action script. What I want to do is have someone drag a pushpin graphic to a part of the screen. And depending upon where they drag it something will happen after they click a button. As far as I could figure out, in order for this to happen I need to know the X & Y coordinates of where I want the object to be. Here in lies the problem, I can not get the Y axis to respond correctly.
When I set trace(mv_pushpin._y); in the begining of my code before anything gets moved I get a correct reading. however, as soon as I move it, and try and retrace it, it tells me that it is undefined. The X axis works perfectly and I can get updated readings as to where it is. But for the life of me, I can not understand why I can't get a good reading on the Y axis. Does anyone have any ideas? Thanks
Trouble Finding Tutorials Relating To Dragging/dropping, And Snapping To A Grid.
This is the first of my problems in the project I am taking on. I have a grid of squares (34x34 pixels each) and the grid is 21 squares by 6 squares. I have 11 little special 34x34 squares that I want the user to be able to drag to a normal square, and it snap into place. I am specifically looking for the center of the object being dragged to be no more than 10 pixels in any direction from the center of the grid square they are trying to place it on. I can do the dragging and dropping stuff alright, but I'm not having a very good time finding tutorials on snapping and using grids. One tutorial said "The number of movie clips you need depends on the number of target areas you want." That said, I don't really want 126 different movie clips. I need each draggable object (11 in total) to have it's own set of squares upon which it can be dropped in. Please, please help. I need it!
Drop Down Menus Not Dropping Down.
Hi again everyone,
i think you all know i am new to this. the prob im having is before, whenever i move the mouse over a button, a menu drops down it's not doing it anymore. on layers, the button is above the drop down. Does anyone know of any good books out there where i can learn Flash in a flash, or get a good base knowledge of how this works. I sure do feel like and idiot.
Good Day
Drag And Drop - When Drop Targets Overlap
Hi,
Please see
http://www.paraminionstudios.com/dump/PleaseHelp.zip for the files I'm requestiong help on (upload tool is not working).
Drag and drop the power generator "icons" on the left of the screen into the designated areas in the 3d scene to "install" power generators along the side of the building.
I have 4 designated regions in a 3d rendered scene. there are 4 dragable power generator "icons" on the far left of the screen. When the generator icons are dragged and dropped upon one of the 4 targets, the target mc advances to frame 2 of the target mc, and the generator icon disappears (actually the generator icon mcs simply advance to frame 2 of the mc.. a blank kframe). Frame 2 of each of the targets contains a small graphic of a generator that fits the perspective of the 3d scene.
my problem here is that my target MCs overlap slightly. This is causing some issues. if you have already "installed" generator 1, and you then go to drag another icon just below target1, flash is getting confused because of the overlapping. Is it possible to change the instance name of the target after dropping a generator icon on the target so that the script doesn't get confused? the layer order doesn't seem to have any bearing on anything here as I had hoped.
The file is located (upload tool isn't working) at:
http://www.paraminionstudios.com/dump/PleaseHelp.zip
On "vacation", working for a client. never fun.
How Do I Get Component Drop-down Menus To "Drop-Up" Instead Of Dropping Down?
Hi,
I've been working on this website that has a component drop-down menu that needs to "drop-up" instead of down. How can I get it to do that?
I have another drop-down menu that is "dropping up" on the home page of the site that I am working on. I think it is doing that because it is positioned at the very bottom of the stage (movie). There is no room for the drop-down to be displayed, so it automatically goes up instead of down. However, there's another two drop-down menus that positioned at the bottom of the stage and for some strange reason they drop-down instead of up.
To see the working "drop-up" menu, click here. This is a testing server, as the site hasn't been launched yet. To see the stubborn drop-down menus that keep dropping down, when they should be "dropping up" then you'll have to enter in a 'test' booking. Select a branch (eg: Sydney), then type in "12345678" for the phone number, then type in a 'Contact Name' (your name or whatever) and then click on "Quick Pickup". You will then be taken to a page where you'll be able to see the two drop-down menus at the bottom on the left-hand side.
Any help will be greatly appreciated.
Blastbum
Drop Targets
I'm creating a sorting activity and i do not want to give the user the sorting rule. For example if they need to sort blue buttons and black buttons, i do not want to label the targets as blue or black. I want the user to decide on the sort themselves and then check to see if their sort was correct. Is there code that I could use to check the target area for all like items?
ActionScript 2, flash 8
Thanks in advance
Drop Targets
I'm creating a sorting activity and i do not want to give the user the sorting rule. For example if they need to sort blue buttons and black buttons, i do not want to label the targets as blue or black. I want the user to decide on the sort themselves and then check to see if their sort was correct. Is there code that I could use to check the target area for all like items?
Thanks in advance
Two Drop Targets At Once?
I'm using this actionscript at the moment:
ActionScript Code:
if (_root.pin2._droptarget == "/container/mcDraw"){
but is it possible to have two droptargets so that the actions are only carried out when the drag object is dropped within the bounds of two different movieclips? i.e when all three are overlapping.
Drag And Drop Targets
The actionscript in this movie I have attached for drag and drop targets I have used before and it has worked. I've added it to this movie and it's not working. When you drag the skeleton onto the brown target I want the red circle above it to change to green. Can anyone see why it's not working please?
Drag And Drop Using Targets In AS2
ok... I've made a tut on drag and drop using targets... but for some reson it only works in AS1... and I can't find the reson why...(!!)
Here's my code:
Code:
on (press) {
startDrag("_root.green");
}
on (release) {
stopDrag();
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
}
can any one tell me what's wrong?
Text As Drop Targets?
What I'm doing: I am making a game to help kids understand how different parts of speech function in English. A sentence will be displayed, and the user must drag icons that represent parts of speech (i.e. verb, subject, direct object, etc.) from a word bank. They must drop all applicable parts of speech onto the correct words in the sentence.
And so I have a lot of sentences that I am writing in my actionscript (to make it easy to change them when needed). I am planning on putting the sentences into an array (lets call it 'sentenceArray' for now) then having Flash break each sentence down into seperate words, to be put in new arrays (each element of sentenceArray would have its own array which has each individual word within sentenceArray). Once I have broken all this down, however, my problems are: how will I be able to display these words on the stage so that they can function as drop targets, and how will each word know which drop target its supposed to be?
Any help, or different way of approaching this that anyone out there can think of would be much appreciated. Thanks in advance!
-Ange52
Drag Drop Targets
I'm trying to move a movie clip so that when it's moved over another movie clip some text is displayed in a dynamic text box.
Code:
on (press) {
startDrag("drag", true);
this._parent.reply_txt.text = "pop";
}
on (release) {
stopDrag();
if (eval(this._droptarget) == this._parent.area) {
this._parent.reply_txt.text = "yes";
} else {
this._parent.reply_txt.text = "no";
}
}
I'm not sure where I'm going wrong. If you move the "backSkirt" movie clip onto the "area" movie clip the text box changes but not correctly.
Any help would great.
Jemes
Drag And Drop In Targets?
hello friends, pls help me out.!!!
i'm doing a drag drop project in flash. in that two movie clips (instance names = book1 and book2) are given. if the first moviclip (book1) is dragged and dropped in the position of second movieclip(book2), automatically the second movieclip(book2) should be dropped in the position of first movieclip.(book1)
again if the first movieclip(book1) is dragged and dropped to the previous position, the second movieclip(book2) should come to its previous position.
(vice versa)
could you please....... help me.....
Multiple Drop Targets
I'm just starting out in AS3 and need some help with a drag and drop word scramble game.
Basically I need to be able to match two movieclips in the same target. So in the example below I have the word SANDALS, there are two S's and A's and I want the user to be able to put the duplicate letters in either slot. As it is right now the s_mc can only go in the first target slot and the s2_mc can only go in the last target slot. Same goes for the a_mc and a2_mc.
I'm sure there's a simple fix for this
ActionScript Code:
s_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
s_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
a_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
a_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt1);
n_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
n_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt2);
d_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
d_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
a2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
a2_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt4);
l_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
l_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt5);
s2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
s2_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt6);
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
event.target.parent.addChild(event.target);
startX = event.target.x;
startY = event.target.y;
}
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
s_mc.filters = null;
targets_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
this.gotoAndStop(2);
}
}
function dropIt1(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
a_mc.filters = null;
targeta_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
this.gotoAndStop(2);
}
}
function dropIt2(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
n_mc.filters = null;
targetn_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
this.gotoAndStop(2);
}
}
function dropIt3(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
d_mc.filters = null;
targetd_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
this.gotoAndStop(2);
//completed.play();
}
}
function dropIt4(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
//reply_txt.text = "Good Job!";
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
a2_mc.filters = null;
targeta2_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
//reply_txt.text = "Congrats, you're finished!";
this.gotoAndStop(2);
//completed.play();
}
}
function dropIt5(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
//reply_txt.text = "Good Job!";
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
l_mc.filters = null;
targetl_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
//reply_txt.text = "Congrats, you're finished!";
this.gotoAndStop(2);
//completed.play();
}
}
function dropIt6(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
//reply_txt.text = "Good Job!";
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
s2_mc.filters = null;
targets2_mc.gotoAndPlay(2);
success.play();
}
if(counter == 7){
//reply_txt.text = "Congrats, you're finished!";
this.gotoAndStop(2);
//completed.play();
}
}
s_mc.buttonMode = true;
a_mc.buttonMode = true;
n_mc.buttonMode = true;
d_mc.buttonMode = true;
a2_mc.buttonMode = true;
l_mc.buttonMode = true;
s2_mc.buttonMode = true;
Thanks to anyone with advice or a quick solution to this problem!
Drag And Drop Targets
When all the targets have been targeted when you drag and drop objects onto them how do you set an action to play a movie clip?
Drag And Drop Using Targets
Why dosent this code work in falsh mx 2004?
Code:
on (press) {
startDrag("_root.green");
}
on (release) {
stopDrag();
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
the start dragging part works
and the stop dragging part works
but all the if-part dosen't work...
It works in flask mx, bur I can't figure out what to change to make it work in flash mx 2004
heeeelp
Drag And Drop Using Targets
I have created 6 dragable movie clips using the tutorial I found here. I also have the "drop zone". What i need to try and do with some more code is only allow the 6 movieclips to be dragged onto the dropzone in 1 correct order. If it is correct it disappears, if incorrect it gets placed away from the dropzone. I have no idea where to start with the code, any help would be greatly appreciated.
Thanks
Drag/Drop Need To Know Both Targets
Hi,
Have a look to the attached file here.
1. Imagine all the movies input_# and output_# are created by using AS.
2. There can be n number of input_# and output_# movies on the stage.
When I press on yellow triangle and release it on yellow circle, I need to know when I release, source triangle movie name and yellow circle movie name, on which I am releasing mouse.
I am looking for a general method(class or something). I don't want to bound this behavior on certain movies by writing design time code.
Regards
Drag And Drop Using Targets
Why dosent this code work in falsh mx 2004?
Code:
on (press) {
startDrag("_root.green");
}
on (release) {
stopDrag();
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
the start dragging part works
and the stop dragging part works
but all the if-part dosen't work...
It works in flask mx, bur I can't figure out what to change to make it work in flash mx 2004
heeeelp
Problem With Layering And Drop Targets
I have a sfw that defines a droptarget: if (this._droptarget == "/hot_area4") for snaping an icon into place.
This works great when i run the swf by itself. However when i load this clip into another movie making it _level1 it no longer works! I tried refrencing the path like _level1/hot_area4 but that doesn't work either.
How do i properly implement droptargets on _level1 clips? i'm stumped.
Loading Drag And Drop With Targets
I have created a drag and drop button with a _droptarget that plays a specified frame inside the _droptarget movie clip.
Works fine when I test it, BUT it does not work when it loads into the main movie
Can anyone help?
Movie Structure
main.swf
nav_level3.swf
story1_level1.swf
Script
on (release) {
stopDrag ();
setProperty ("_parent.product01", _x, "87");
setProperty ("_parent.product01", _y, "100");
if (_parent.product01._droptarget == "/target") {
_parent.target.gotoAndPlay("01");
}
}
Multiple Drag Drop Targets
i'm using this action script to do a drag and drop target set up.
Code:
fscommand("fullscreen", "false");
fscommand("allowscale", "false");
stop();
// don't use the hand icon
drag_mc.useHandCursor = false;
// handle press event
drag_mc.onPress = function() {
this.startDrag(false, 26, 25, 613, 170);
this.onMouseMove = function() {
updateAfterEvent();
};
};
// handle release event
drag_mc.onRelease = drag_mc.onReleaseOutside = function() {
stopDrag();
this.onMouseMove = undefined;
if (this.hitTest(_root.dropTarget_mc)) {
this._x = _root.dropTarget_mc._x+(_root.dropTarget_mc._width/2)-(this._width/2);
this._y = _root.dropTarget_mc._y+(_root.dropTarget_mc._height/2)-(this._height/2);
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
};
how can i make it work with multiple mc's? I appreciate the help.
Mutliple Drop Targets Help Needed
Hi guys,
I'm having some kind of big problem and i need to solve it somehow
Basicly i need 1 draggable object and 4 drop targets (i've included an image of the setup)
And the start position of the draggable object needs to be recorded somehow so if u release the draggable object somewhere outside a drop target it will move back to it's origin. But if it's on the drop target i want it to snap to it so it stays there (if possible)
And i need to trigger a little event like gotoAndPlay on every drop target when the draggable object has snapped to it.
I hope someone can come up with some help i would really appreciate it.
regards,
Mark
ps: this is a script maybe which is good for it, i just needs to be modified for use with more then 1 drop target i think?
glas1.onPress = function() { {download="wallpaper1"}
startDrag(this);
};
glas1.onRelease = glas1.onReleaseOutside=function () {
stopDrag();
if (this._droptarget == "/drop") {
this.onTarget = true;
//_root.winzip.gotoAndPlay(1);
} else {
this.onTarget = false;
_root.drop.gotoAndPlay(1);
}
};
//the variables below will store the clips starting position
glas1.myHomeX=glas1._x;
glas1.myHomeY=glas1._y;
//the variables below will store the clips end position
glas1.myFinalX = 477;
glas1.myFinalY = 448;
glas1.onMouseDown = function() {
//this variable tells us if the mouse is up or down
mousePressed = true;
};
glas1.onMouseUp = function() {
mousePressed = false;
};
glas1.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (mousePressed == false && this.onTarget == false) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (mousePressed == false && this.onTarget == true) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
}
};
Drag And Drop Multiple Targets
I have a movie with ten tokens to be dropped onto about 34 items.
I want the get the destination code when the tokens are dropped on the item. (named item1 - item34)
With the code below, the tokens only go back to their original position, but if i substitute the "i" for a 9 ,to test it for example, it works fine. The token stays on item9 and gives me dest1=9 . If i drop it on item4 it goes back to the original position.
how do i get this to work for all 34 items?
on (press) {
startX = this._x;
startY = this._y;
startDrag(this, false, 30, 15, 720, 435);
}
on (release) {
stopDrag();
}
on (release) {
for (i=1; i<=_root.maxitems; i++) {
if (this.hitTest(_root["item"+i])) {
_root.dest1=_root["item"+i].dest;
} else {
this._x = startX;
this._y = startY;
_root.dest1="";
}
}
}
**attaching Sound To Drop Targets** HELP
Hey guys!
Really need help on this one!
I desperately need to know what to add to this code to make a sound play when i drop the MC onto its target:
on (press) {
startDrag ("", true);
}
on (release) {
stopDrag ();
if (this.hitTest(_root.large)) {
setProperty (_root.s2, _visible, false);
}
}
FLASH FILE ATTACHED ALSO!!
Thanks
Dominic
Drag And Drop On Multiple Targets
I have been following this tutorial:
http://www.hed.swin.edu.au/design/tu..._tut/index.php
Everything works out fine. Except I can only define the movie clip to be assigned to one target. I created five separate targets, and five separate drag objects. I would like to be able to drag any of the five objects to any of the five targets. As of now, I don't have a problem assigning the objects to all work on the same target, or have them each assigned to one of the five targets.
Is there a simple way to change the script to allow the objects to drop on any of the five targets?
Here is the script I have:
onMouseMove = function(){
updateAfterEvent();
}
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this,true,63,85,530,465);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(2);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/3;
this._y -= (this._y-this.myHomeY)/3;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/3;
this._y -= (this._y-this.myFinalY)/3;
}
};
}
//this is where the object is assigned to the target
dragSetup(ruff_mc,target1);
dragSetup(chee_mc,target2);
I've tried everything I can think of from copying the dragSetup like this:
dragSetup(ruff_mc,target1);
dragSetup(ruff_mc,target2);
dragSetup(ruff_mc,target3);
But when I do that, it ignores the first two, and only will go to target3.
Any help would be WONDERFUL!!!!
Drag'n'drop To Multiiple Targets?
hey folks i have been using some tutorials to drag and drop objects to targets..... i have been trying to work out if its possible to move an object to multiple targets. i have tried a few ways like repeating the drag drop locations.... but when i do this nothing seems to be draggable.....hmmmm i think just maybee i'm doing somthing wrong wrong wrong.... i have been using script to tell the object if its not released on target it goes back to its original starting point.......
also does anyone know if its possible to drag an object from within a movie clip (or scroll menu type thing....) i'm guesing this works by creating a duplicate movie somehow.......
regards......
Drag N Drop With Multiple Targets
Hi actionscripters ;)
Does anyone have a good example of drag and drop with multiple targets? I am working on a smart way to code an interface where the objects in the menu can be dropped on a variety of places and then be moved somewhere else if necessary until the user is finished.
Thanks for your time, all replies are very much appreciated ;)
regards
Michael
Drag And Drop Multiple Targets
i am creating a flash project in which there is a drag and drop feature at the moment only one oblect can drop onto one target. i would like all the objects to be able to be dragged onto all the targets.
the project files can be downloaded here: CLICK HERE
if you have any questions just ask!
thanks in advance
Drag And Drop Into Multiple Targets
i am creating a flash project in which there is a drag and drop feature at the moment only one oblect can drop onto one target. i would like all the objects to be able to be dragged onto all the targets.
the project files can be downloaded here: CLICK HERE
if you have any questions just ask!
thanks in advance
Drag And Drop With Targets PROBLEM
I know there are posts on the forums about drag and drop with targets but none of them help me.
I have gone through the tutorials on drag and drop and have successfully made a number of drag and drop flash animations.
HOWEVER.....
I can't get this **** target thing to work and I'm following the tutorial as closely as I can.
Wouls someone please take a look at my FLA / code and try and give me some pointers. I'm getting really fed up of testing the same scene over and over and over and i want to get on with the next one!
thanks!
|