Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-17-2010, 01:40 PM   #1
paul.s
Registered User
 
Join Date: Oct 2009
Posts: 34
Unhappy keeping score via dropped clips not incrementing properly

Hi, having trouble keeping score of dropped movielips on a target.

below code is not working and it's driving me nuts.

How / where can I store this variable so that it can be incremented and accessed correctly.

Any help / solution would be greatly appreciated.

Thanks, Paul
ActionScript Code:
// var _foodPanel:foodPanel = new foodPanel(); addChild(_foodPanel); _foodPanel.x=360; _foodPanel.y=275; _foodPanel.visible=true; //trace(_foodPanel.foods1.numChildren); var startX:Number; var startY:Number; var dropCount:int; for (var i=0; i<_foodPanel.foods1.numChildren; i++) {     var object:Object=_foodPanel.foods1.getChildAt(i);     //trace(object);     object.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);     object.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);     object.buttonMode=true; } function mouseDown(event:MouseEvent):void {     event.target.startDrag();     startX=event.target.x;     startY=event.target.y; } function mouseReleased(event:MouseEvent):void {     event.target.stopDrag();     checkHit(event.currentTarget as MovieClip); } function checkHit(obj:MovieClip):void {     if (hit.hitTestObject(obj)) {         obj.visible=false;         trace(obj.name);         checkGame(obj);             dropCount++;         trace(dropCount);         if (dropCount>=5&&dropCount<8) {             trace("YOU CAN STOP NOW");                             } else if (dropCount ==8) {             trace("MAXIMUM");             } else {             trace("MORE");         }     } else {         obj.x=startX;         obj.y=startY;     } } function checkGame(obj:MovieClip):void {     trace(obj.name);     var badChips:int =1;             if(obj.name=="badChips8" ||  "badChips7" ||  "badChips6"||  "badChips5"||  "badChips4"||  "badChips3"||  "badChips2"||  "badChips1") {                         badChips+=1;             trace("SCORE IS:"+badChips);         }       }

Last edited by CyanBlue; 02-17-2010 at 03:41 PM. Reason: AS Tag applied...
paul.s is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:14 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.