Alright so this is the script for your main timeline.
circle_array is for all the circle movieclip names and amounts box_array is for all the box movieclip names and amounts
the stage just needs circles and boxes with instance names circle_1 etc.. box_1 etc..
PHP Code:
var current_selected=null
var drag_mode_enabled=false
var box_available=null
var circle_array=[circle_1,circle_2,circle_3,circle_4,circle_5,circle_6,circle_7,circle_8,circle_9]
var box_array=[box_1,box_2,box_3,box_4,box_5,box_6,box_7,box_8,box_9]
This main timeline script below gives you more chances to let go of the circle if it hasn't locked to the box yet:
The boxes should have a lower depth than the circles on the stage.
The registration point for the boxes and circles should be centered for the distanceChecker function to detect where you drop the circle
PHP Code:
var current_selected=null
var drag_mode_enabled=false
var box_available=null
var circle_array=[circle_1,circle_2,circle_3,circle_4,circle_5,circle_6,circle_7,circle_8,circle_9]
var box_array=[box_1,box_2,box_3,box_4,box_5,box_6,box_7,box_8,box_9]
oh I left 37 as the distance to snap, heres a fix:
might work for swishmax
PHP Code:
var current_selected=null
var drag_mode_enabled=false
var box_available=null
var circle_array=[circle_1,circle_2,circle_3,circle_4,circle_5,circle_6,circle_7,circle_8,circle_9]
var box_array=[box_1,box_2,box_3,box_4,box_5,box_6,box_7,box_8,box_9]
hello hello Alloy Bacon
there is a problem:
for example
when i press box_1 and drop circle_1 this is ok but when i press box_2 and drag and drop in box_1 again the circle droped again into box_1
Ok so now
1) .enabled=false //when the circles at the box
2) .swapDepths(300) //the circle gets highest depth when dragged
3) .onReleaseOutside // so the circle doesnt follow the mouse if it is released
4) //nice graphics kofa
PHP Code:
onFrame (1) {
stop();
var drag_mode_enabled=false
var box_available=null
var circle_array=[circle_1,circle_2,circle_3,circle_4,circle_5,circle_6,circle_7,circle_8,circle_9]
var box_array=[box_1,box_2,box_3,box_4,box_5,box_6,box_7,box_8,box_9]
hello Alloy Bacon
i am very sorry
there is a new problem
when i press box_1 and drag and drop into box_2 , the circle dropped in box_1
i want if i press box_1 and the circle near box_1 only (move to box_1 only) else return back
excuse me for my bad english
You can limit the snap on bounds by modifying the distance checker statement: /2 now
If this does not solve the issue, can you post a screen record?
PHP Code:
var current_selected=null
var drag_mode_enabled=false
var box_available=null
var circle_array=[circle_1,circle_2,circle_3,circle_4,circle_5,circle_6,circle_7,circle_8,circle_9]
var box_array=[box_1,box_2,box_3,box_4,box_5,box_6,box_7,box_8,box_9]
hello Alloy Bacon
if you have a free time can you add some features
can you create a textfield into each boxes which loads rondom text from array for example
on frame(1)
this.create (9 )text field
my_array = [ text1 , text2 , text3.........]
text field_1=my_array [0]
text field_2=my_array [1]
when the circle droped into box , the circle create text field = the same text in box
The box movieclip needs a text field with an instance name of: data_field
The circle movieclip needs a text field with an instance name of: data_field
PHP Code:
var current_selected=null
var drag_mode_enabled=false
var box_available=null
var circle_array=[circle_1,circle_2,circle_3,circle_4,circle_5,circle_6,circle_7,circle_8,circle_9]
var box_array=[box_1,box_2,box_3,box_4,box_5,box_6,box_7,box_8,box_9]
var text_array=['txt1','txt2','txt3','txt4','txt5','txt6','txt7','txt8','txt9']