I have created a drag and drop button that is dropped onto a specific target.
If it does not land on the target, the object returns to its starting position.
All is working perfectly when I test the movie as an swf.
The problem is that when I pull this swf into another movie file, the functionality does not work. It still allows me to drag and drop, but it does not appear to recognize the target area…i.e. it returns the object to it’s start position every time, even when it’s dropped on the correct target.
Any help?
here is the code i used:
views_mc.onPress=function(){
startDrag(this);
}
views_mc.onRelease=views_mc.onReleaseOutside=function(){
stopDrag();
if(this._droptarget=="/targetViews"){
this.onTarget=true;
_root.targetViews.gotoAndStop(2);
}else{
this.onTarget=false;
_root.targetViews.gotoAndStop(1);
}
}
views_mc.onLoad=function(){
viewsHomeX=85;
viewsHomeY= 108;
viewsFinalX=514;
viewsFinalY=302;
}
views_mc.onMouseDown=function(){
mousePressed=true;
}
views_mc.onMouseUp=function(){
mousePressed=false;
}
views_mc.onEnterFrame=function(){
if(mousePressed==false&&this.onTarget==false){
views_mc._x-=(this._x-viewsHomeX)/5;
views_mc._y-=(this._y-viewsHomeY)/5;
}else if(mousePressed==false&&this.onTarget==true){
views_mc._x-=(this._x-viewsFinalX)/5;
views_mc._y-=(this._y-viewsFinalY)/5;
}
}