Sunday 6 January 2013

❤ Class activity: Drag n drop ❤

Posted by kErTaS PeNseL at 18:09
Sawadikappp kap kun kappp...(ntah ape je aku merepek nih)
ok guys, nie aku nk update pasal activity terakhir aku dalam kelas authoring untuk sem nie..hehehe untuk activity terakhir adalah berkenaan dgn drag n drop jugak cume beza sket pd aplikasi n action script nye..hehehe for instance, if we drag the object to the right place, the right mark will appear..but if we drag the object to the wrong place, it will back to the origin place. so my question is how to do that? erm meh aku explain kan carenye ye..hehehe
Create drag n drop application:
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 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.
6. Import any symbol to the library, and put it at the corner of the box. 
7. Right click and choose action and type action script:
stop ( );
8. go back to scene, and drag the place to the stage and i named the layer as a response.
don't forget to name it the box. for my activity i name it as box1 and box2 at the instace name. 
9. Click on insert new layer, name it as shape. then i draw circle and rectangular and convert it into symbol by choosing movie clip.
10. at the circle and rectangular, i've insert an action script for each. the action script for this type of interaction is differ from the earlier drag n drop interaction. 
the action script as below;
on(press){
startDrag(this);
}
on(release){
stopDrag();
if((this._x>=* lowest value for x in the box*)&(this._x<=*highest value for x in the box*)&(this._y>=*highest value for y in the box*)&(this._y<=*highest value for x in the box*))
{
_root.box2.gotoAndStop (2);
}else{
_root.box2.gotoAndStop (1);
this._x=*the origin value for x*;
this._y=*the origin value for y*;
}
}

untuk action script nie korang kene tahu coordinate (sebut perkataan nie teringat waktu degree dulu blaja coordination chemistry..rindunye kat dr. rusmidah..hehehe) object dalam box untuk korang place kan object. kene tahu koordinat paling tinggi and koordinat paling rendah sbb nye if korang drag n drop korangnye object in between of that coordinate kire jawapan diterima la..huhu dan jugak koordinat asal object sebelum di drag sbb nnt of korang drag ke tempat n salah the object will back to its original place. dah dapat baru masukkan nilai dlm actionscript. 
11. after dah insert sume action script, insert a new layer n name it as stop. right click on the frame and choose action and type the action script as below:
stop ( );
12. test ur movie to know either it is work or not by click ctrl+enter. hehehe 
hehehe so nie lah step secara general nye..hehehe
huhu untuk tengok hasil keje aku nie, aku dah upload kat google site..sila la melawat..if u want to do so just just knock the 'door'. ok guys..see u again yaaa...

0 comments:

Post a Comment

 

kErTaS pEnSeL Template by Ipietoon Blogger Template | Gift Idea