Skip to main content
Participating Frequently
June 5, 2007
Question

reset button and movie color change

  • June 5, 2007
  • 5 replies
  • 850 views
hi all

I have created a drag and drop interaction. i am trying to get the reset button working. But i can't i have attached my code.

On my main timeline i have a draggers, droppers and actionscript and button layer. The drag and drop is working. however the reset button doesnt, im not getting any error messages either when i preview my code. when i preview i can drag and drop but then when i press my reset button i get nothing. the instance and button name are the same name 'reset_btn'. Almost seems like my button isnt attached to my reset_btn code code. All my code for the drag and drop and reset button lies in a actionscript layer in a frame on the main timeline.

Also i wanted the object that dragged objects are placed on too to change colour depending on if the person drags the drag object on to the correct object. I have also added the code for this, but when i preview my work it just loops and go through the different colours that i have specfied on the keyframes. I have tried adding a stop(); to the moive clip but then when i preview it. The clip doesnt change colour when i drag and drop an object on to it.

can anyone help with my two problems. the worst thing is no error messages so dont know what to do.


This topic has been closed for replies.

5 replies

Participating Frequently
June 9, 2007
ok thanks....... but a bit confused about the brackets

if(eval(this._droptarget) == drop2_mc || eval(this._droptarget) == drop3_mc
|| eval(this._droptarget) == drop4_mc )
|| eval(this._droptarget) == drop5_mc )
|| eval(this._droptarget) == drop6_mc )

is the above better or

if(eval(this._droptarget) == drop2_mc || eval(this._droptarget) == drop3_mc || eval(this._droptarget) == drop4_mc || eval(this._droptarget) == drop5_mc || eval(this._droptarget) == drop6_mc )
Participating Frequently
June 13, 2007
The second is correct - the first has too many brackets.

Alternatively you could leave out the eval() statements (as they are not really needed) and type the instance names as strings:

if(this._droptarget == "drop2_mc" || this._droptarget == "drop3_mc") //etc...

but they both turn out the same.

JAMES
Participating Frequently
June 9, 2007
Hi James

So to be clear if i have 13 clips perhaps i would need to do something like this

if(eval(this._droptarget) == drop2_mc || eval(this._droptarget) == drop3_mc
|| eval(this._droptarget) == drop4_mc )
|| eval(this._droptarget) == drop5_mc )
|| eval(this._droptarget) == drop6_mc )
etc...
)

{ // and so on
eval(this._droptarget).gotoAndStop(10);
}
Participating Frequently
June 9, 2007
Yes - that would be the safest way to go. That would be the code for the release event for the drag1_mc movie clip, then you would just have to change some numbers around for the rest.

JAMES
kglad
Community Expert
Community Expert
June 5, 2007
put a stop() in the first frame of your drop zone mc.
kglad
Community Expert
Community Expert
June 5, 2007
change to:

Participating Frequently
June 5, 2007
hi guys

Thanks kglad for drawing my attention to that. My reset button now works, However when i place my object on the drop zone it should change colour. However the drop zone movie clip just keeps looping and changing colour without anything being dropped on it. However when i do drop an object its works, but during the start it loops. do u know how i can prevent this

I have added the following line to my reset button code to make it go back to the first colour
drop1_mc.gotoAndStop(1);

I have posted up the fla file. hopefully it will make more sense.

http://homepage.ntlworld.com/unixhome/
Participating Frequently
June 6, 2007
I have looked at your fla and there is no stop action at the start of the drop1_mc movieclip, but also there in your actionscript you are saying drag2_mc.gotoAndStop(5); and drag2_mc.gotoAndStop(10); and I belive you want to say drop1_mc.gotoAndStop(5); and drop1_mc.gotoAndStop(10);
Participating Frequently
June 5, 2007
Post a link to the fla - it is hard to tell wat's wrong here with just part of the code.