#15 LAST CLASS - DRAG AND DROP

Hyeeee! Minggu ini adalah minggu terakhir bagi kelas authoring system. Dalam kelas ini, kami dikehendaki memulangkan semula ipad dan wacom. Sebelum mengakhiri kelas authoring sistem ini kami telah belajar mengenai drag and drop yang mneggunakan koordinat. Berikut merupakan langkah-langkah bagi menghasilkan drag and drop :

1. First of all we need to create the 'place' where we want to drag the object. 
2. Click on Menu 'Insert', and choose 'New Symbol'. Name it as place and choose movie clip and click Ok.
3. Choose rectangular shape in the first frame of the movie clip to create the box.
4. Right click on the keyframe and choose 'Actions' and type action script.
stop ( );
5. Right click on the second frame and choose insert keyframe and then also put the stop action script.
6. Draw the "tick" symbol  at the corner of the rectangle.
7. Go back to scene and drag the movie clip name place to the stage and named the layer as response.
8. Rename the instance name of the rectangle as box1. 
9. Repeat step 8 and named the second rectangle as box2.
10. Create movie clip symbol and draw a rectangle and named it as rec. Create another movie clip symbol and named it as circle.
11. Insert action script behind each rectangle and circle.
Action script for rectangle:
on(press){
startDrag(this);
}
on(release){
stopDrag();
if((this._x>=296.4)&(this._x<=481.4)&(this._y>=261.9)&(this._y<=310.9))
{
_root.box2.gotoAndStop (2);
}else{
_root.box2.gotoAndStop (1);
this._x=97.5;
this._y=285.9;
}
}

Action script for circle :
on(press){
startDrag(this);
}
on(release){
stopDrag();
if((this._x>=303.4)&(this._x<=479.4)&(this._y>=98.8)&(this._y<=136.8))
{
_root.box1.gotoAndStop (2);
}else{
_root.box1.gotoAndStop (1);
this._x=99.5;
this._y=97.8;
}
}
12. Test the movie.

Here I capture my result :



After i drag the circle and rectangle it will appear tick to confirm my answer is right or wrong.



 Anda boleh mencuba dan melihat aplikasi drag and drop ini dalam link ini.
Sebelum kelas berakhir, kami diberi ujian bagi mengetahui sejauh mana pengetahuan kami mengenai flash. Ouh ya, Dr Zaida belanja kami makan donut dan air kotak sebagai tanda tamatnya kelas authoring system. :)





0 comments:

Post a Comment


up