Drag & Drop problem

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;
}
}

Howdy…

Sounds like you got yourself a pathing problem… The first thing you might want to try is to change your all of your _root to something like _level0, and ‘/’ to be others like ‘this’…

Please use code formatting when you post your code…

Thanks for your response.

Im new here and dont know what code formatting is.

Sorry if I broke a rule.

colin

Nope… You didn’t break any rule or whatever… :wink: I just thought that it will be more readable and clean if you used code formatting… Click on this code formatting to learn how to use it… =)