In my drag and drop i have 2 dragable objects and 2 targets.
It works perfectly on the first scene frame 1 But what i want to do is add all 4 dragable images and targets together in one movie clip but when i add all of them into a single movieclip it stops working i have tried putting the actionscript in the 1st frame of the movieclip but that still didn’t work anyone can help i would be so greatful!
[COLOR=#000000][FONT=verdana]Movieclip’s in file [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]circle_mc[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]circle_mc2[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]target circle[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]target circle2[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]im trying to add them all together so i have 1 movieclip on the 1st scene but when i group them all into 1 movieclip it stops working…[/FONT][/COLOR]
circle_mc.onPress = function() {startDrag(this);};circle_mc.onRelease = circle_mc.onReleaseOutside=function () {stopDrag();if (this._droptarget == “/targetCircle”) {this.onTarget = true;_root.targetCircle.gotoAndStop(2);} else {this.onTarget = false;_root.targetCircle.gotoAndStop(1);}};//the variables below will store the clips starting positioncircle_mc.myHomeX=circle_mc._x;circle_mc.myHomeY=circle_mc._y;//the variables below will store the clips end positioncircle_mc.myFinalX = 45.6;circle_mc.myFinalY = 37.0;circle_mc.onMouseDown = function() {//this variable tells us if the mouse is up or downmousePressed = true;};circle_mc.onMouseUp = function() {mousePressed = false;};circle_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 && 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;}}; //start dragable image 2 and target
circle_mc2.onPress = function() {startDrag(this);};circle_mc2.onRelease = circle_mc2.onReleaseOutside=function () {stopDrag();if (this._droptarget == “/targetCircle2”) {this.onTarget = true;_root.targetCircle2.gotoAndStop(2);} else {this.onTarget = false;_root.targetCircle2.gotoAndStop(1);}};//the variables below will store the clips starting positioncircle_mc2.myHomeX=circle_mc2._x;circle_mc2.myHomeY=circle_mc2._y;//the variables below will store the clips end positioncircle_mc2.myFinalX = 118.5;circle_mc2.myFinalY = 37.0;circle_mc2.onMouseDown = function() {//this variable tells us if the mouse is up or downmousePressed = true;};circle_mc2.onMouseUp = function() {mousePressed = false;};circle_mc2.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;}};
iv attached the fla if anyone would like it have a go.