Drag&Drop Duplicate Movie With Drop Target
Hi There...
I'm creating a game where people can design their own cell phone by adding diamonds to it, a "Bling Phone" if you will. You will be able to add 4 types of diamonds to it, change the phones skin, add music to it, give it a name etc etc
I've got it to a stage where it when you click on a diamond(mc) on the stage it duplicates a hidden diamond(mc with a button inside) off stage and you can drag it around etc and then click save. Theres a script which grabs the instance name, x and y position of every diamond on the stage and stores it into a multi dimensional array which will be fed into a mysql database for retreival purposes at a later date.
Now my problem is i would like to be able to use the phone(mc) as a drop target but i'm not sure where to put the droptarget script. does it go on the original MC diamond or the duplicated mc diamond with the button inside it ?
Once a diamond has been dropped onto the phone i would also like it if the user then drags the diamond off the phone it gets deleted. I think i've got it half working but my variables which keep track how many diamonds are on stage dont appear to be updating.
I've attached the .fla file to this post if some is interested in taking a look and helping me out. The droptarget script is only on the blue diamond so far.
Any help would be much appreciated.
Thanks
Rob
FlashKit > Flash Help > Flash ActionScript
Posted on: 10-05-2005, 08:04 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Drag - Drop Movieclip On Target- Duplicate
Hi I am new here, and to actionscript. I am working on a flash movie, and have run into a problem.
In this flash movie, you can drag the circle or square, and lock them on the smaller circle targets. What I would like to do is have a dragable duplicate made at the origin. So, say I could drag three circles, or three squares.
I have relentlessly tried to incorporate duplicateMovieclip(). But have not had any luck.
function dragSetup(clip, targArray) {
clip.onPress = function() {
startDrag(this);
this.beingDragged = true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged = false;
for (i=0; i<targArray.length; i++) {
targ = targArray[i];
if (eval(this._droptarget) == targ) {
this.myFinalX=targ._x
this.myFinalY=targ._y
this.onTarget = true;
_root.targ.gotoAndStop(2);
break;
} else {
this.onTarget = false;
_root.targ.gotoAndStop(1);
}
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
clip.myFinalX = 0;
clip.myFinalY = 0;
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)/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 (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
}
};
}
allTargets = new Array(targ01, targ02, targ03);
dragSetup(circle,allTargets);
dragSetup(square,allTargets);
Duplicate Event.Target For Drag N Drop Scenario
Hello,
I'm trying to create a drag and drop scenario in Actionscript 3. When an item on the stage is clicked, that item is duplicated, and that duplicated item is dragged with startDrag().
Essentially I need to duplicate the event.target - is this possible?
Here is my code:
Code:
function duplicateitem(eventObject:MouseEvent) {
activeitem = eventObject.target;
this.addChild(activeitem);
activeitem.x=eventObject.target.x;
activeitem.y=eventObject.target.y;
activeitem.startDrag();
}
item.addEventListener(MouseEvent.MOUSE_DOWN, duplicateitem);
The above code will not work. I need to be able to actually duplicate "item", which is the "eventObject.Target"...
but if I tried something like:
Code:
var activeitem = new item();
I would then need to do this for every unique item on the stage and have a unique function for each of them which I need duplicating...
if anyone knows how to duplicate an object and then have it draggable, that would be an incredible help. thanks
Duplicate Movie Clip Target
Is there anyway I can tell duplicateMovieClip a target?
For example I have a set of elements that dont fit on the stage(width). I want to create a scrolling device to scroll through the elements and users can drag them to a stage which will duplicate the movie clip.
When I created the scrolling device it scrolled the elements AND the duplicated clip.
Is there any way I can tell .duplicateMovieClip a target of another movie to copy/move/duplicate the clip to?
Many thanks
Duplicate Movie Clip Target
Is there anyway I can tell duplicateMovieClip a target?
For example I have a set of elements that dont fit on the stage(width). I want to create a scrolling device to scroll through the elements and users can drag them to a stage which will duplicate the movie clip.
When I created the scrolling device it scrolled the elements AND the duplicated clip.
Is there any way I can tell .duplicateMovieClip a target of another movie to dup. the clip?
Drag And Drop Duplicate Movie Clips
I have messed with this thing for a while, not getting very far. What I am trying to do is have some icons that I can drag and drop as many copies as i want in a target area, but then i want to be able to select those copies and drag and drop those around in the target area. i know the ghetto way is to put movie clip on top of movie clip, but i want it cleaner, and more efficient than that. Anyone know any tutorials,sites, or have prior experience with this code that can help me out would be awesome.
Why God, Help With A Duplicate Movie Clip And Drag And Drop.
I want to duplicate a movie clip and then drag that movie clip.
But when I release, it isn't stopping the drag. What gives?
on (press) {_root.green.duplicateMovieClip("eshow",2)
startDrag("_root.eshow");
_root.eshow._alpha =22
}
on (release) {
_root.eshow.stopDrag()
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
}
Why God, Help With A Duplicate Movie Clip And Drag And Drop.
I want to duplicate a movie clip and then drag that movie clip.
But when I release, it isn't stopping the drag. What gives?
on (press) {_root.green.duplicateMovieClip("eshow",2)
startDrag("_root.eshow");
_root.eshow._alpha =22
}
on (release) {
_root.eshow.stopDrag()
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
}
Duplicate Movie Clips-drag And Drop
I have a movie clip that the user-can drag onto the grid-and move around the grid. But, I want the user to be able to drag onto the grid as many of the item as he/she wants to-so probably the best way to do it is to duplicateMovieClip on the fly-but then how do I keep track of them-and give each one their own name, onclick event...?
til now I have an array with 10 copies of the same movieclip-I'm sure there is a more efficient way to do it with duplicatemovieClip-but I'm not sure how-any ideas?
thank you
Duplicate Movie Clip And Drag & Drop
Hello,
I need a movie clip that I want duplicate to main stage by drag and drop or mouse click. And I want to redrag and drop, rotate, scale the clip on main stage.
any scripts?
pls help me.
Thanks in Advance
Biju Subhash
please see this link I need like this (http://www.jordans.com/planengine/jrd-001_RP.asp)
Load Movie And Drop Target
I have my movie split up so that theres one smaller movie that loads a bigger one. In the bigger one I have a drag and drop target thing, but when I do the load movie thing to load the 2nd one in the first smaller one, the drop targets dont work. HOw can I make them work?
And on a second note, unrelated, can I make a load movie thing to open a swf/exe in the directory open directly to a flash player?
Dude, I Give Up. Help With Drag And Drop Duplicate Movie Clip Please.
ok, i have been trying to get this to work forever. What im doing here is making a flash site thats like a real time strategy game. You have to build stuff in order to unlock new sections of the site.
check out this: http://www.rasterica.com/thomas/quar...S_Nav/new.html
click on build, then drag the Main button and release somewhere above. Notice that when you release it sticks to the cursor and doesnt stop dragging. Now, hit cancel and notice that the main clip is still loaded and works correctly if you drag and drop it.
Quote:
on (press) {
_root.drag_main.duplicateMovieClip("main1", 2)
_root.main1.startDrag();
}
on (release) {
stopDrag();
_root.main1.gotoAndPlay(5);
}
this works perfectly on an object that isnt duplicated. It seems when you first duplicate a movie clip and immediately tell it to startDrag something messes up.
What im going for here is when you release, it goes to the animation. But for some reason its conflicting with something else when i load it the first time.
FLA- http://www.rasterica.com/thomas/quar...TS_Nav/new.fla
Dude, I Give Up. Help With Drag And Drop Duplicate Movie Clip Please.
ok, i have been trying to get this to work forever. What im doing here is making a flash site thats like a real time strategy game. You have to build stuff in order to unlock new sections of the site.
check out this: http://www.rasterica.com/thomas/quar...S_Nav/new.html
click on build, then drag the Main button and release somewhere above. Notice that when you release it sticks to the cursor and doesnt stop dragging. Now, hit cancel and notice that the main clip is still loaded and works correctly if you drag and drop it.
Quote:
on (press) {
_root.drag_main.duplicateMovieClip("main1", 2)
_root.main1.startDrag();
}
on (release) {
stopDrag();
_root.main1.gotoAndPlay(5);
}
this works perfectly on an object that isnt duplicated. It seems when you first duplicate a movie clip and immediately tell it to startDrag something messes up.
What im going for here is when you release, it goes to the animation. But for some reason its conflicting with something else when i load it the first time.
FLA- http://www.rasterica.com/thomas/quar...TS_Nav/new.fla
Drag And Drop Target Load Movie
Im try to figure out how i would go about a certain drag and drop ,with a traget. what i want is when a user drags an icon to a specific spot on the site and release's the mouse this wil load the swf with that file in it.. if anybody would happen to know how i would do this that would be great..
[MX04] Problems Using Drop Target With Nest Movie Clips
Hi !
I wonder if anyone can help me solve this bit of code i'm having problems with..
I'm working on a site that will have a panel that can be dragged from the botttom of the screen. the panel includes navigation and data from an xml file. i have made this and called it info_mc.
the first time i created it, i realised that making info_mc the draggable item meant i lost my buttons in the panel, so i created another movieclip called drag_mc and place it in info_mc.
Theorising that when you pressed on drag_mc it would drag info_mc with it. after much tinkering with the script i got this to work as i wanted. ( when you drage it up it slides up and when youo release it slides back down out of view.
I now want to put a drop target so that when it is dragged over the target it will stick, at present the droptarget doesn't work. I've done this before but not with an embedded drag_mc . below is the script as it is at present. i'm sure the problem has something to do with the paths to drag_mc, info_mc and circleTarget. but have not been able to fix it.
The elements are laid out as so:
main timeline contains - circleTarget, info_mc
info_mc contains - Drag_mc, script for dragging (see below)
circletarget contains - 2xkeyframes with script stop(); in each.
you can see a mock up of the flash movie and download the FLA here:
http://www.bru-ha.com/flashdemo/drangndrop
http://www.bru-ha.com/flashdemo/drangndrop.swf
Here is the script info_mc that should do all the dragging and dropping.
code:
drag_mc.onPress=function(){
startDrag(_root.info_mc,true,_x,580,_x,0)
}
drag_mc.onRelease=drag_mc.onReleaseOutside=functio n(){
stopDrag();
if (_root.info_mc._droptarget == "../targetCircle") {
_root.info_mc.onTarget=true;
_root.targetCircle.gotoAndStop(2);
}else{
_root.info_mc.onTarget=false;
_root._parent.targetCircle.gotoAndStop(1)
}
}
//sets function on embedded drag button to drag info_mc
//the variables below will store the clips starting position
_root.info_mc.myHomeX=_root.info_mc._x;
_root.info_mc.myHomeY=_root.info_mc._y;
drag_mc.onMouseDown=function(){
//this variable tells us if the mouse is up or down
mousePressed=true;
}
drag_mc.onMouseUp=function(){
mousePressed=false;
}
drag_mc.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&&_root.info_mc.onTarget==fa lse){
_root.info_mc._x-=(_root.info_mc._x-_root.info_mc.myHomeX)/5;
_root.info_mc._y-=(_root.info_mc._y-_root.info_mc.myHomeY)/5;
}
}
I hope someone out there will be able to help me, or give me some advice...
best
Andy
Drag And Drop - Multiple MC's On To A Single Drop Target
Hi All
I am struggling with a drag and drop excercise.
I have 15 movie clips that need to be dragged over a single drop target in a specific order. i.e 1,2,3,4, when the correct movie clip is dragged to the drop target a movie within the drop target needs to advance a single frame to display the result of the correct movie clip being dragged over the drop target.
Would I be correct in thinking I need to use some kind of array to compare the clip that is being dragged to the frame position of the drop target?
I have the bones of this working and need advice / help on getting the clips to work in the specific order required. I can post my code if needed.
Thanks in advance.
btw - am using Flash MX 2004 Professional
Renaming An Instance For Use In A Two-stage DragDrop Using ._name Problem.
Hello all,
Reference:
I'm creating a drag-and-drop game which has two drag-and-drop actions
per movieclip.
Essentially, I am dragging movieclip1 to targetclip1; on success
successclip plays a sound. After this sound, I need to drag movieclip1
to targetclip2; on success successclip2 plays a sound.
The game is for understanding basic electricity. I'm dragging an
object (say a lemon) to complete a circuit (which on success would
light a lightbulb). THEN I need to drag the lemon to it's proper
classification (which is either conducive or insulating and on success
play a sound).
Any help would be much much appreciated!
-Brian
My dilemma:
Should I rename the instance name so it can be evaluated again with a
separate function?
//Define Conductors Here
branchtest.onRollOver =
lemontest.onRollOver=papercliptest.onRollOver=penn ytest.onRollOver=bottleca*ptest.onRollOver
= keytest.onRollOver=pencilleadtest.onRollOver=funct ion () {
this.gotoAndStop(2);
};
branchtest.onRollOut =
lemontest.onRollOut=papercliptest.onRollOut=pennyt est.onRollOut=bottlecapte*st.onRollOut
= keytest.onRollOut=pencilleadtest.onRollOut=functio n () {
this.gotoAndStop(1);
};
branchtest.onPress =
lemontest.onPress=papercliptest.onPress=pennytest. onPress=bottlecaptest.onP*ress
= keytest.onPress=pencilleadtest.onPress=function () {
this.startDrag();
this.swapDepths(1);
};
//Global Conductor Test
checkIfMatchingConductor = function (test,original) {
test.stopDrag();
if (test.hitTest(target) == true) {
complete_circ.mcBulbTopAnimation.play();
test._x = 332;
test._y = 236;
} else {
test._x = original._x;
test._y = original._y;
}
}
//Conductor onRelease Functions Attached Here
branchtest.onRelease = function() {
checkIfMatchingConductor(branchtest,origin_brancht est);
branchtest._name="test2";
};
//Global Conductor/Insulator Classification Test
checkIfMatchingClassification = function (test2,original,test) {
test2.stopDrag();
if (test2.hitTest(conductors) == true) {
complete_circ.mcBulbTopAnimation.play();
test2._x = 10;
test2._y = 10;
} else {
test2._x = original._x;
test2._y = original._y;
test2._name=test;
}
- Hide quoted text -
- Show quoted
Drag And Drop To Any Drop Target
Hi guys....I am trying to create some more generic code for a project im on....infact you guys have already helped me lots in getting it up and running!
I have basicly got it where all the dragObjects and assigned functions within a for loop and therefore been assigned to their own dropTargets...all working fine, however a situation is needed where if a user drops a clip onto anything rather than a hit area it doesnt just register as an incorrect drop.....at the moment a drag that misses a dropTarget will be the same as one that is dropped onto an incorrect drop target and thats just a bit unfair for them as it means they have used up one of only two chances!!!
basicly I need to know if its possible to obtain using the coding style that i already have been whether a drop is onto any of the drop targets before than going to chec if its the correct one or not....sorry for the long winded talk but seemed the only way i could explain!!!
the code i'm using is below
Code:
var Xpos:Number;
var Ypos:Number;
var objects:Number = 2;
for (i = 1; i <= objects; i++) {
// assigning the on press events to the dragObjects
this["dragObject"+i+"_mc"].onPress = function() {
this.startDrag(true);
// assigning the original X and Y of the dragged clips
Xpos = this._x;
Ypos = this._y;
}
// assinging the on release events to the dragObjects
this["dragObject"+i+"_mc"].onRelease = function() {
// finding the number of the dragObject to use in the submitAnswer function
objName = this._name
dragNumber = Number(objName.substr(10, 1));
submitAnswer(dragNumber);
}
}
// function to assertain whether the drop was a successful one - whether dropObecjt1 was dragged on dropTarget1 and so on
// the number is passed from the onRealease function
function submitAnswer(dragNumber:Number) {
this.stopDrag();
// if its dropped onto its correct target then turn the button off, place ontop of its target
if (this["dragObject"+dragNumber+"_mc"].hitTest(this["dragTarget"+dragNumber+"_mc"])) {
this["dragObject"+dragNumber+"_mc"].enabled = false;
this["dragObject"+dragNumber+"_mc"]._x = this["dragTarget"+dragNumber+"_mc"]._x+50;
this["dragObject"+dragNumber+"_mc"]._y = this["dragTarget"+dragNumber+"_mc"]._y+50;
trace ("knob jockey");
} else {
// if it is dropped onto a wrong target then chuck it back to where it started!
this["dragObject"+dragNumber+"_mc"]._x = Xpos;
this["dragObject"+dragNumber+"_mc"]._y = Ypos;
}
}
thanks for any help!!
Drag And Drop To Any Drop Target
Hi guys....I am trying to create some more generic code for a project im on....infact you guys have already helped me lots in getting it up and running!
I have basicly got it where all the dragObjects and assigned functions within a for loop and therefore been assigned to their own dropTargets...all working fine, however a situation is needed where if a user drops a clip onto anything rather than a hit area it doesnt just register as an incorrect drop.....at the moment a drag that misses a dropTarget will be the same as one that is dropped onto an incorrect drop target and thats just a bit unfair for them as it means they have used up one of only two chances!!!
basicly I need to know if its possible to obtain using the coding style that i already have been whether a drop is onto any of the drop targets before than going to chec if its the correct one or not....sorry for the long winded talk but seemed the only way i could explain!!!
the code i'm using is below
Code:
var Xpos:Number;
var Ypos:Number;
var objects:Number = 2;
for (i = 1; i <= objects; i++) {
// assigning the on press events to the dragObjects
this["dragObject"+i+"_mc"].onPress = function() {
this.startDrag(true);
// assigning the original X and Y of the dragged clips
Xpos = this._x;
Ypos = this._y;
}
// assinging the on release events to the dragObjects
this["dragObject"+i+"_mc"].onRelease = function() {
// finding the number of the dragObject to use in the submitAnswer function
objName = this._name
dragNumber = Number(objName.substr(10, 1));
submitAnswer(dragNumber);
}
}
// function to assertain whether the drop was a successful one - whether dropObecjt1 was dragged on dropTarget1 and so on
// the number is passed from the onRealease function
function submitAnswer(dragNumber:Number) {
this.stopDrag();
// if its dropped onto its correct target then turn the button off, place ontop of its target
if (this["dragObject"+dragNumber+"_mc"].hitTest(this["dragTarget"+dragNumber+"_mc"])) {
this["dragObject"+dragNumber+"_mc"].enabled = false;
this["dragObject"+dragNumber+"_mc"]._x = this["dragTarget"+dragNumber+"_mc"]._x+50;
this["dragObject"+dragNumber+"_mc"]._y = this["dragTarget"+dragNumber+"_mc"]._y+50;
trace ("knob jockey");
} else {
// if it is dropped onto a wrong target then chuck it back to where it started!
this["dragObject"+dragNumber+"_mc"]._x = Xpos;
this["dragObject"+dragNumber+"_mc"]._y = Ypos;
}
}
thanks for any help!!
Duplicate Movieclip To A Target Mc Instead Of A Level
is there a way - i am sure there is, of duplicating a movieclip from the main stage, into a target empty movieclip???
duplicateMovieClip (myMC, myMC1, myTargetMC);
i cant get it to work - presumably because you cant do it?
i can load into the same timeline at another level, but wanted to know if the other was possible?
thanks in advance
gilesb
Target Duplicate MovieClip Question
I am trying to target a duplicate of a movie clip on stage to get it to change it's alpha to 0 when you roll over it. Below is the code that I am working with. Can someone please tell me how I can achieve this, thanks!
the movie clip on stage getting duplicated is named "heart"
-----
// the main loop
if (++frame_count >= WAIT_TIME)
{
duplicateMovieClip(heart, "heart"+cur_heart, cur_heart);
x_val = Math.floor(Math.random()*(X_START_MAX - X_START_MIN) + X_START_MIN);
y_val = Math.floor(Math.random()*(Y_START_MAX - Y_START_MIN) + Y_START_MIN);
Alpha= _alpha= 100;
setProperty("heart"+cur_heart, _x, x_val);
setProperty("heart"+cur_heart, _y, y_val);
setProperty("heart"+cur_heart, _alpha, Alpha);
// get ready for next wave of hearts
frame_count = 0; // reset frame count
if (++cur_heart > MAX_HEARTS) cur_heart = 1;
}
overHeart= heart;// this is what im having problems with,
//i need it to target the duplicated movie
//clip which is getting named like so, "heart"+cur_heart
overHeart.onRollOver= function(){
trace("yay");
}
/*
if (overHeart._alpha= 100){
overHeart.onRollOver= function(){
dripSound = new Sound(this);
dripSound.attachSound("drip");
dripSound.start(0, 1);
_alpha= 0;
}
}
*/
Duplicate Child Movies, How Do Specify Target Path
I have a parent movieClip (ie. dupMC) which I'm using duplicateMovieClip to create child movie clips. Then I'm dragging the duplicate child movieClips (ie. dupMC1) to a position on the stage, on the onRelease event a custom-built popop is postioned on the stage, from this popup you have a few options that you can select that then takes you to specified frame in the duplicate child movie clip.
_root.(duplicate movieClip).gotoAndStop(2);
That's my problem how do I specify a target path for child movie clips. I've tried setting a global variable of the child duplicated movieClip after dragging it:
_global.duplicateMCName = this._name; //dupMC1
And then using the variable in target path:
_root.duplicateMCName.gotoAndStop(2);
I'm was expecting the variable to place value into the path and then take it to the correct frame of the duplicated movieClip, like this:
_root.dupMC1.gotoAndStop(2);
But thats not happening and I could use a little help. Thanks!
Duplicate Drag And Drop MC
Hi all, I am working on a presentation that a user can drag and drop objects from a "component library" onto the map. I want these objects to be duplicated draggable MCs. I have found a very similiar, but more advanced example here:
http://www.type289.com/clients/colorforms/test.swf
In addition to drag and drop and duplicate MCs, this example also scales and rotates the MC, but all I want to know is how they 1)duplicate the MC after one is dragged onto the main screen 2) Clear screen. Any suggestions on the code or related tutorial will be greatly appreciated!
Thanks!
Drag'n'drop Of A Duplicate MC
Hello all and compliments on a great site and community. I stumbled onto this site a few days back and have found it a great help. The question I have seems to be quite elementary and popular. I have done an extensive search (both on this site as well as on actionscript.org), however both sites return a great number of threads with no answer. I am hoping that someone can point me and the rest of the previous posters in the right direction to a tutorial or example that we can work off of.
My situation can be best expressed with the following analogy:
Let's say a flash scene has an image of a plain white t-shirt. Below this t-shirt are a series of letters (let's call this series 'the alphabet') Now the letters range from A through Z, and are essentially drag'n'droppable MovieClips. A user of this flash program can click on a letter, drag the letter to the shirt, and drop it into a grid-like system of targets. The letter would now become a duplicate of that initial MC, whereas the initial MC would return to its starting position on screen. This would allow the letter to be used over and over again. The duplicated MC (now on the shirt) can be drag'n'dropped still, however this time only to a garbage can of somesorts to delete the letter off the shirt. If it is dragged anywhere besides the garbage can, it gets snapped back by its previous coordinates.
This is essentially what I am looking to do, not with a t-shirt or letters, but as I said this analogy hopefully anyone can understand and benefit from. I am really looking for some methodology and code examples. I guess the key issues are:
1.)Duplication of the MC and the proper method (duplicateMovieClip, or attachMovieClip?)
2.)Returning the initial MC back to its starting location
3.)Snapping the child MC to the dropTarget, and
4.)Modifying the properties(methods)of the child MCs so that they can't have children of their own
Thanks to all that give some insight and time!
Drag And Drop After Duplicate
Hi guys, I'm having trouble working this one out. I am trying to make multiple ducplicates of an mc on a button press. The duplicated mc's also have a drag and drop applied to them.
I have the following AS which will amke my duplicates. The only problem is when I get to my third duplicate, all future mc's are not draggable. Only the 3rd mc is.
code: on (press) {
typea202.duplicateMovieClip("typea202"+i, this.getNextHighestDepth(), {_x:20, _y:20});
i++;
amount--;
}
Could any one please help?
Cheers
Rich
Duplicate Drag-and-drop
Hi, I'm trying to do the following. I have a movie clip and I need to make copies of it every time user tries to drag-and-drop it, so there can be many copies and they all need to stay draggable and need to have similar onRelease event handlers. I'm having trouble assigning event handlers to copies. Please help.
Help With Drag & Drop Duplicate Mc
Hi,
hopefully somebody can help I've got to be a game were the child can build up there family by dragging a family member from a box on the left onto the stage.
Now I've got the drag and drop working but I want a duplicate to be created when the family member is dragged to the stage. At the minute I'm using the following code on each family member mc
on(press){
this.startDrag();
}
on(release,releaseOutside){
stopDrag();
var newdepth = this._parent.getNextHighestDepth();
var newname = "dad2" + newdepth;
var prevname = "dad2" + (newdepth-1);
var howMany:Number = 0;
if (this._parent[prevname] == undefined) this._parent[prevname] = this;
this.duplicateMovieClip(newname,newdepth);
this._parent[newname]._x = this._parent[prevname]._x + 0;
this._parent[newname]._y = this._parent[prevname]._y + 0;
}
the problem is that when I drag a duplicate to the stage it still has the same action script as the original which means it can also be draged and copied. How do I stop this and is there anyway to clear the stage of the duplicate movie clips, a reset button basically.
Can somebody please help?
Duplicate Drag And Drop
I have a movie were to decorate the christmas tree, you drag the decorations to it. On each decoration I put:
on (keyPress "<Space>") {
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior
}
on (release) {
//Start Dragging Movieclip Behavior
startDrag(this);
//End Behavior
//Duplicate Movieclip Behavior
//Requires Flash Player 7 or later
var newdepth = this._parent.getNextHighestDepth();
var newname = "copy" + newdepth;
var prevname = "copy" + (newdepth-1);
if (this._parent[prevname] == undefined) this._parent[prevname] = this;
this.duplicateMovieClip(newname,newdepth);
this._parent[newname]._x = this._parent[prevname]._x + 0;
this._parent[newname]._y = this._parent[prevname]._y + 0;
//End Behavior
}
BUT, each time I drag one, the select another one it 'pastes' itself on top of the other decoration?
Can anyone help?
Thanks,
Drag W/ Duplicate MC On Drop?
Hey everyone,
What function do you use to delete a duplicated MC? Lets say that i have a garbage can where I want to drag the duplicated MC's into to get rid of them? I thought about the setProperty() visible to false but then they would just pile up onto the Garbage can, right? Is there a better way to accomplish this?
Anyone please...
Thanks in Advance,
LImitlis
Duplicate Drag And Drop
All i want to do is duplicate a drag and drop a mc. Could someone please help to get this working. At the moment, it drags the first clip, then the one underneath (left behind) dissapears after a few seconds. I would like to have say 10 copies of the mc. Here is my code, It is attached to the mc.
on (press) {
this.duplicateMovieClip("mca", 1);
_root.mca.startDrag();
}
on (release) {
stopDrag();
}
Duplicate Drag And Drop MC
Hi all, I am working on a presentation that a user can drag and drop objects from a "component library" onto the map. I want these objects to be duplicated draggable MCs. I have found a very similiar, but more advanced example here:
http://www.type289.com/clients/colorforms/test.swf
In addition to drag and drop and duplicate MCs, this example also scales and rotates the MC, but all I want to know is how they 1)duplicate the MC after one is dragged onto the main screen 2) Clear screen. Any suggestions on the code or related tutorial will be greatly appreciated!
Thanks!
Drag W/ Duplicate MC On Drop?
Hey everyone,
What function do you use to delete a duplicated MC? Lets say that i have a garbage can where I want to drag the duplicated MC's into to get rid of them? I thought about the setProperty() visible to false but then they would just pile up onto the Garbage can, right? Is there a better way to accomplish this?
Anyone please...
Thanks in Advance,
LImitlis
Drag/drop/duplicate/swap. Can You Help Me?
Hello;
sorry i posted the worn message before.
Now this is the right one.
i have got a buttom in the root of my movie. at the same time i have got a rectangle with five squares inside of it. This my button, when draged must do the following.
on drag, it must duplicate itself, leaving the duplicated movie in the same position the button was before it was draged.
once i have drag the button into th rectangle, this button must swap in the square closer to him, otherwise it will reposition itself back to the original postion.
when this movie, goes back to it's original position, than the movie clip that was before duplicated but never used, desapears.
ISn't anyone capable of helping me?
thank for the help.
[Edited by littleisa2001 on 09-17-2002 at 03:37 AM]
Duplicate Rain Drop Animation
Hello guys!
I have a single rain drop animation in a MC and I want to make it rain from one drop to many drops and then back down to a few then 1...
I'm not a programmer....can anyone help?
Drag Drop, Duplicate Movieclip
this is the first time i've ever really had to deal with drag/drop and duplicate movie clip all together.
I've got several buttons that when clicked will create a new instance of a clip and position it over the button (the clips look just like the buttons). then i want the user to be able to drag the new instance to a location and when they release it, the clip should stopDrag.
what i have here works, but i think i'm only capturing the .onPress for the button and not the actual .onRelease for the duplicated clip properly.
the stop drag will trigger, but you have to release the clip, click it again and release again for that to happen!
any help is great!
code:
Code:
stop();
//bounds for drag/drop
_global.xBoundsLeft=11;
_global.xBoundsRight=680;
_global.yBoundsTop=59;
_global.yBoundsBot=551;
threeSixButton.cnt=0;
threeSixButton.onPress=function(){
threeSixClip.duplicateMovieClip("threeSix"+this.cnt, this.cnt);
newClip=_root["threeSix"+this.cnt];
newClip._x=this._x+19.5;
newClip._y=this._y+37;
newClip.startDrag(false, xBoundsLeft, yBoundsTop, xBoundsRight, yBoundsBot);
newClip.onRelease=function(){
this.stopDrag();
}
trace("newClip: "+newClip);
this.cnt++;
}
Drop Target In "drag And Drop Game"
Im very much confused that how the code is wrong here..?on (press)
{
startDrag (this, false);
}
on (release)
{
stopDrag ();
if (_droptarget eq _root.cpu)
{
_root.score = int(_root.score + 1);
gotoAndStop(2);
}
else
{
_root.score = int(_root.score - 1);
gotoAndStop(2);
answer.gotoAndPlay("wrong");
} // end else if
}
Here im prepairing a game where i had palce this script inside a movie clip,having two option Correct amd Wrong,
I had created a box name keyboard
where an image of keyboard when placed it should show that its correct,and..if the movie clip calledkeyboardbutton is placed outside then it shoul show its wrong.
keyboardbutton is the instance name for that keyboard,
Actually its a game showing the Process of flow of operation in Computer..
Where i had also used the CPU and Monitor..please anyone help me out here...
here is a sample file for that:
Good Way To Dragdrop Mc To A Sticky Grid With Grid Cells That Animate.
Is there a way to get mc._dropTarget to recognize a hidden MC it drops on?
I have am trying to drag drop a movie clip item onto a 9 by 6 grid. The user should not see the grid. Each grid cell has a number of properties, including an animation that plays in it depending on what is dropped in it. What is the best way to do this. I came up with two ways:
A. Do the math:
1. Figure out what the drop point x and y values would convert to in the grid to find the grid cell it applies to.
2. Attach a new movie clip animation to that cell's centered x,y point to show something happened there.
B. Fill the grid with Movie Clips:
Use the mc._droptarget to see what grid cell movie clip was dropped on and then change its animated state to show something happened there.
The problem with A is that it is a little slow and cumbersome.
The problem with B is that I can't let the user see the cell movieclips. mc._droptarget only works to detect if a mc was dropped on visible graphic area of another mc as far as I can tell.
I could sure use some help on this. Is there a better way?
- Wade
Drag, Drop, Multiple Targets And Duplicate.
Hello,
I have the folowing problem. I want to create something like this: On the scene you have a square lets call it squareMC and also two square holes in whic you can place the squareMC. Now I want the folowing. When the user klicks on squareMC it becomes dragable and it can be placed on either of the two holes. if you place it outside one of the holes it returns to the starting position. But when you place it on one of the holes it stays there and at the starting position will apear a duplicta of SquareMC wich also will be dragable to the two holes.
So I hope you can help me to achieve this because I am really stuck haha. I understand how I can make something dragable and make it drop but I don't know how to drop it to an target and than duplicate it and to make it return to its starting position.
Thank you in advance,
Andre
The netherlands
FLASHMX04: Help: Duplicate/drag And Drop Movieclips
I realize there are related threads to moviclip duplication, and I've been studying them, but so far i still haven't been able to answer my question and am tearing out my hair!
—I am making a program that allows the user to drag a movieclip onto a grid, making a pattern of their choice with duplicates of that clip. I made an grid to which the movieclip duplicates can "snap" to. I can now drag one copy of the original movieclip and "snap" it to the grid. That part is at least working great.
My problem that I can only drag and drop one copy of the original movieclip.
I want to be able to drag a new duplicate movieclip everytime I drag and drop the original movieclip, creating multiple copies of the original clip.
—here's my code:
I have a movieclip with code that tells it to "snap" to my grid (this part is working great!). Inside that movieclip there is a button with the following:
on (press) {
//when dragging is true, tells the movieclip to "snap" to the grid.
dragging = true;
}
on (release, releaseOutside) {
dragging = false;
//add 1 to the currentclip variable so that the new movieclip will have a new name and depth
currentClip = currentClip + 1;
trace(currentClip);
//make a duplicate of the movieclip that is being dragged
purple_mc.duplicateMovieClip("newpurple" + currentClip, currentClip)
}
sorry for the rather long post, but any help would be very much appreciated.
thanks!
Drop Target Help Please
hey guys,
I was hoping to make a button that when dragged to an appropriate location, will activate a sequence of animations. In short, how do i do drop targets where i drop say a ball into a black hole. Im kind of new at this so any help would be greatly greatly appreciated. Thanks
Don
Drop Target
k, this is a pretty simplistic question, however i'm quite new to flash. anyway, i need to come up with an interactive test, that requires drag and drop. i've gone thru various tutorials, but nothing that describes what i need. i don't want a long drawn out answer guys, just a tip. lol anyway, i've got the drag and drop down, i just need help with the targets, anyone know of a good tutorial? ty in advance
Drop-to-target
Hi:
I've never done the drop-to-target thing. Can anybody offer some code, ideas, or a good tutorial?
Basically, I have 10 different icons that I want to be able to be dragged to a target, then, once dropped, load a different movie for each one.
Any help will be appreciated.
Thanks,
James
He is risen!!!
Drop Target :(
ok.... so i am making this zoom tool so when u drag it on top of this window that is also draggable, it enlarges it to 175%... when you drag it over again.... it sets it back to 100%...
HOWEVER... it sets it the first time to 175%... then back to 100% on the 2nd drag, but then wont reset it back to 175% again after that... it is like it doesnt recognise the drop target anymore... the same thing occurs if you drag the drop target away from the initial position..... can anyone think of why this is happening?
on (press) {
startDrag("/zoombutt");
}
on (release) {
stopDrag();
if (getProperty("/window1", _yscale) eq 100) {
if (getProperty("/zoombutt", _droptarget) eq "/window1") {
setProperty("/window1", _yscale, 175);
setProperty("/window1", _xscale, 175);
setProperty("/window1", _alpha, 100);
setProperty("/window1", _x, 425);
setProperty("/window1", _y, 50);
}
} else {
setProperty("/window1", _yscale, 100);
setProperty("/window1", _xscale, 100);
}
setProperty("/zoombutt", _x, "510");
setProperty("/zoombutt", _y, "350"); // if these lines arent present which place the zoombutton back to the original position it works... but it isnt much use if it doesnt set its self back to the original x,y co-ordinates.
}
Thanks in advance if anyone can help with this...been trying for a long time..
Help Regarding Drop Target
I have made this simple flash movie. I want to increment my number variable when I drag b1 on circle c. for example if initial value of number is 2, so after dragging on circle it should become 3 and after drag out it should become 2, and if I drag b2 after b1 then number should become 2. so how can I increment and decrement. please help me.
Drop On Target
Hi, I made this movie for testing purposes..
There are two mc's on the stage with buttons in them.
When the mc "drag" is dragged upon "drop" it must goto and stop frame 2 of "drag". When I tell it to goto and stop the drop mc it works fine. but the other way around it won't. Can anyone tell me why?
Actually what i want is that when the mc is dragged upon the drop area it must remove itself. so i also tryed the remove mc function. But can't get it to work either. The set property codes are used in my real movie, so they must remain. Can you help me in the right direction.
Drop Target
I have created a magnifying glass effect, by using a target as a magnifying glass image and a set of objects. I used the kirupa tutorial as a base
http://www.kirupa.com/developer/acti...t/dragdrop.htm
However I want to have multiple objects changing on drag and drop.
Is this possible. Do I just need something like an if..else code to be inserted after the stopDrag command in the kirupa code above or is there another way?
Drop Target
hi,
Can someone help me to achieve the following?
see .fla
Thx
Mel*
AS2: Drop Target
I've been making this drag and drop game where you have 11 cards (the drag items) and 4 drop spots (Any of the 11 cards can go onto the 4 drops) - I need to make it so that once any of the 11 cards has hit the drop spot then that drop spot becomes deactivated and if you try and pull any other cards onto it, it won't hit.
I've tried drop1_mc.enabled = false and removeMovieClip(drop1_mc);
Drop Target
In the drop target syntax, if (_root.clip._droptarget == "/target")
what is the slash for before the instance name of the target? Will _root.clip.droptarget == "target" work just as well?
Drop Target
I have created a magnifying glass effect, by using a target as a magnifying glass image and a set of objects. I used the kirupa tutorial as a base
http://www.kirupa.com/developer/acti...t/dragdrop.htm
However I want to have multiple objects changing on drag and drop.
Is this possible. Do I just need something like an if..else code to be inserted after the stopDrag command in the kirupa code above or is there another way?
|