Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE FLASH:HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

Re: Label and identify diagram activity

COW Forums : Adobe Flash

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Share on Facebook
Respond to this post   •   Return to posts index   •   Read entire thread


demetri tashieRe: Label and identify diagram activity
by on Apr 13, 2012 at 2:38:56 pm

think of this as a 'drag and drop game'. you can see a real simple example of this in action here

the code that makes this work:
red.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag);
blue.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag);

red.addEventListener(MouseEvent.MOUSE_UP, endDrag);
blue.addEventListener(MouseEvent.MOUSE_UP, endDrag);

function beginDrag(e:MouseEvent):void {
e.target.startDrag();
answer.text="";
}

function endDrag(e:MouseEvent):void {
e.target.stopDrag();

if (e.target==red && red.hitTestObject(hit1)){answer.text="correct !";}
else if (e.target==red && red.hitTestObject(hit2)){answer.text="wrong. try again !";}

if (e.target==blue && blue.hitTestObject(hit2)){answer.text="correct !";}
else if (e.target==blue && blue.hitTestObject(hit1)){answer.text="wrong. try again !";}
}

the red and blue squares on the bottom (movieclips named ;'red' and 'blue' ), need to be dragged and dropped onto the correct hitTest movieclip ( the grey squares named 'hit1' and 'hit2' ) the dynamic text box named 'answer' will change the response accordingly, and is voided upon the initiation of the next drag

i hope that helps out.


Posts IndexRead Thread
Reply   Like  
Share on Facebook


Current Message Thread:




LOGIN TO REPLY



FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]