• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Basketball Scorebug Animated score update

Community Beginner ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

hide 1.jpghide 2.jpghide 3.jpghide 4.jpg

Hi! Everyone, I'm currently working on a low budget basketball scorebug for our community (refer to attached images). I'm using Animate CC and the scripting are all done but the one that my colleague wanted I cannot achieve. They want a box with +1, +2 and +3 to serve as transition to updated score. And the numeric should advanced vertically as well. Current NBA scorebug is currently using that transition style. Thanks in advance for all who would reply and help me with this.

My AS3 code:

import flash.events.MouseEvent;

stop();

var score:int = 0;

//add 1 pt to score

ad1Btn.addEventListener(MouseEvent.CLICK, ad1Click);

function ad1Click (event:MouseEvent): void

{

  score = score+1;

  scoreboard.text = "" +score.toString ();

}

//subtract 1 pt to score

su1Btn.addEventListener(MouseEvent.CLICK, su1Click);

function su1Click (event:MouseEvent): void

{

  score = score-1;

  scoreboard.text = "" +score.toString ();

}

import flash.events.MouseEvent;

stop();

var score2:int = 0

;

//add 2 pts to score

ad2Btn.addEventListener(MouseEvent.CLICK, ad2Click);

function ad2Click (event:MouseEvent): void

{

  score = score+2;

  scoreboard.text = "" +score

.toString ();

}

//subtract 2 pt to score

su2Btn.addEventListener(MouseEvent.CLICK, su2Click);

function su2Click (event:MouseEvent): void

{

  score = score-2;

  scoreboard.text = "" +score.toString ();

}

//add 3 pts to score

ad3Btn.addEventListener(MouseEvent.CLICK, ad3Click);

function ad3Click (event:MouseEvent): void

{

  score = score+3;

  scoreboard.text = "" +score

.toString ();

}

//subtract 3 pt to score

su3Btn.addEventListener(MouseEvent.CLICK, su3Click);

function su3Click (event:MouseEvent): void

{

  score = score-3;

  scoreboard.text = "" +score.toString ();

}

//RIGHT SCOREBOARD

import flash.events.MouseEvent;

stop();

var score3:int = 0;

//add 1 pt to score

ad4Btn.addEventListener(MouseEvent.CLICK, ad4Click);

function ad4Click (event:MouseEvent): void

{

  score3 = score3+1;

  bottomscore.text = "" +score3.toString ();

}

//subtract 1 pt to score

su4Btn.addEventListener(MouseEvent.CLICK, su4Click);

function su4Click (event:MouseEvent): void

{

  score3 = score3-1;

  bottomscore.text = "" +score3.toString ();

}

import flash.events.MouseEvent;

stop();

var score4:int = 0

;

//add 2 pts to score

ad5Btn.addEventListener(MouseEvent.CLICK, ad5Click);

function ad5Click (event:MouseEvent): void

{

  score3 = score3+2;

  bottomscore.text = "" +score3

.toString ();

}

//subtract 2 pt to score

su5Btn.addEventListener(MouseEvent.CLICK, su5Click);

function su5Click (event:MouseEvent): void

{

  score3 = score3-2;

  bottomscore.text = "" +score3.toString ();

}

//add 3 pt to score

ad6Btn.addEventListener(MouseEvent.CLICK, ad6Click);

function ad6Click (event:MouseEvent): void

{

  score3 = score3+3;

  bottomscore.text = "" +score3.toString ();

}

//subtract 3 pt to score

su6Btn.addEventListener(MouseEvent.CLICK, su6Click);

function su6Click (event:MouseEvent): void

{

  score3 = score3-3;

  bottomscore.text = "" +score3.toString ();

}

//QUARTER UPDATE

import flash.events.MouseEvent;

stop();

var score8:int = 0;

//update quarter number

//qtrboard.text = "OT".toString (); (replace this to line 197 for OT text only)

//replace this "qtrboard.text = "QTR " +score8.toString ();" for quarter update to line 197

//without the quotation mark

//replace (green) "QTR" with "OT" IN 197

qtrBtn.addEventListener(MouseEvent.CLICK, qtrClick);

function qtrClick (event:MouseEvent): void

{

  score8 = score8+1

  qtrboard.text = "QTR " +score8.toString ();

}

//previous quarter

suqtrBtn.addEventListener(MouseEvent.CLICK, suqClick);

function suqClick (event:MouseEvent): void

{

  score8 = score8-1;

  qtrboard.text = "QTR " +score8.toString ();

}

//FOULS

// TEAM A HIDE

/* Click to Hide an Object

Clicking on the specified symbol instance hides it.

Instructions:

1. Use this code for objects that are currently visible.

*/

//HIDE 1ST FOUL BUTTON

fo1Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_3);

function fl_ClickToHide_3(event:MouseEvent):void

{

movieClip_2.visible = false;

}

/* Click to Hide an Object

Clicking on the specified symbol instance hides it.

fo2Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_4);

function fl_ClickToHide_4(event:MouseEvent):void

{

movieClip_3.visible = false;

}

//HIDE 2ND FOUL BUTTON

fo3Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_5);

function fl_ClickToHide_5(event:MouseEvent):void

{

movieClip_4.visible = false;

}

//HIDE 3RD FOUL BUTTON

fo3Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_6);

function fl_ClickToHide_6(event:MouseEvent):void

{

movieClip_4.visible = false;

}

//HIDE 4TH FOUL BUTTON

fo4Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_7);

function fl_ClickToHide_7(event:MouseEvent):void

{

movieClip_5.visible = false;

}

//HIDE 5TH FOUL BUTTON

fo5Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_8);

function fl_ClickToHide_8(event:MouseEvent):void

{

movieClip_6.visible = false;

}

//TEAM A SHOW

//SHOW 1ST FOUL BUTTON

fi1Btn.addEventListener(MouseEvent.CLICK, fl_ClickToHide_9);

function fl_ClickToHide_9(event:MouseEvent):void

{

movieClip_2.visible = true;

}

//SHOW 2ND FOUL BUTTON

fi2Btn.addEventListener(MouseEvent.CLICK, f1_ClickToHide_10);

function f1_ClickToHide_10(event:MouseEvent):void

{

movieClip_3.visible = true;

}

//SHOW 3rd FOUL BUTTON

fi3Btn.addEventListener(MouseEvent.CLICK, f1_ClickToHide_11);

function f1_ClickToHide_11(event:MouseEvent):void

{

movieClip_4.visible = true;

}

//SHOW 4TH FOUL BUTTON

fi4Btn.addEventListener(MouseEvent.CLICK, f1_ClickToHide_12);

function f1_ClickToHide_12(event:MouseEvent):void

{

movieClip_5.visible = true;

}

//SHOW 5TH FOUL BUTTON

fi5Btn.addEventListener(MouseEvent.CLICK, f1_ClickToHide_13);

function f1_ClickToHide_13(event:MouseEvent):void

{

movieClip_6.visible = true;

}

// TEAM B HIDE

//HIDE 1ST FOUL BUTTON

fo6Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_14);

function f6_ClickToHide_14(event:MouseEvent):void

{

movieClip_7.visible = false;

}

//HIDE 2ND FOUL BUTTON

fo7Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_15);

function f6_ClickToHide_15(event:MouseEvent):void

{

movieClip_8.visible = false;

}

//HIDE 3rd FOUL BUTTON

fo8Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_16);

function f6_ClickToHide_16(event:MouseEvent):void

{

movieClip_9.visible = false;

}

//HIDE 4TH FOUL BUTTON

fo9Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_17);

function f6_ClickToHide_17(event:MouseEvent):void

{

movieClip_10.visible = false;

}

//HIDE 5TH FOUL BUTTON

fo10Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_18);

function f6_ClickToHide_18(event:MouseEvent):void

{

movieClip_11.visible = false;

}

//TEAM B SHOW

//SHOW 1ST FOUL

fi6Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_19);

function f6_ClickToHide_19(event:MouseEvent):void

{

movieClip_7.visible = true;

}

//SHOW 2ND FOUL

fi7Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_20);

function f6_ClickToHide_20(event:MouseEvent):void

{

movieClip_8.visible = true;

}

//SHOW 3RD FOUL

fi8Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_21);

function f6_ClickToHide_21(event:MouseEvent):void

{

movieClip_9.visible = true;

}

//SHOW 4TH FOUL

fi9Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_22);

function f6_ClickToHide_22(event:MouseEvent):void

{

movieClip_10.visible = true;

}

fi10Btn.addEventListener(MouseEvent.CLICK, f6_ClickToHide_23);

function f6_ClickToHide_23(event:MouseEvent):void

{

movieClip_11.visible = true;

}

movieClip_2.visible = false;

movieClip_3.visible = false;

movieClip_4.visible = false;

movieClip_5.visible = false;

movieClip_6.visible = false;

movieClip_7.visible = false;

movieClip_8.visible = false;

movieClip_9.visible = false;

movieClip_10.visible = false;

movieClip_11.visible = false;

btnOutall.addEventListener(MouseEvent.CLICK, f7_ClickToHide_7);

function f7_ClickToHide_7(event:MouseEvent):void

{

movieClip_2.visible = false;

movieClip_3.visible = false;

movieClip_4.visible = false;

movieClip_5.visible = false;

movieClip_6.visible = false;

movieClip_7.visible = false;

movieClip_8.visible = false;

movieClip_9.visible = false;

movieClip_10.visible = false;

movieClip_11.visible = false;

}

btnReset_Score.addEventListener(MouseEvent.CLICK, resetClick);

function resetClick (e:MouseEvent):void

{

score =

scoreboard.text = "0".toString ();

score3 =

bottomscore.text = "0".toString ();

}

//BIG SCORE

//ADD 1 PT VISITOR SCORE

import flash.events.MouseEvent;

stop();

var score9:int = 0;

//add 1 pt to score

ad1Btn.addEventListener(MouseEvent.CLICK, ad1Click3);

function ad1Click3 (event:MouseEvent): void

{

  score9 = score9+1;

  scoreboard2.text = "" +score9.toString ();

}

//subtract 1 pt to score

su1Btn.addEventListener(MouseEvent.CLICK, su1Click3);

function su1Click3 (event:MouseEvent): void

{

  score9 = score9-1;

  scoreboard2.text = "" +score9.toString ();

}

//ADD 2 PT VISITOR SCORE

import flash.events.MouseEvent;

stop();

var score10:int = 0;

//add 2 pt to score

ad2Btn.addEventListener(MouseEvent.CLICK, ad1Click4);

function ad1Click4 (event:MouseEvent): void

{

  score9 = score9+2;

  scoreboard2.text = "" +score9.toString ();

}

//subtract 2 pt to score

su2Btn.addEventListener(MouseEvent.CLICK, su1Click4);

function su1Click4 (event:MouseEvent): void

{

  score9 = score9-2;

  scoreboard2.text = "" +score9.toString ();

}

//ADD 3 PT VISITOR SCORE

import flash.events.MouseEvent;

stop();

var score11:int = 0;

//add 3 pt to score

ad3Btn.addEventListener(MouseEvent.CLICK, ad1Click5);

function ad1Click5 (event:MouseEvent): void

{

  score9 = score9+3;

  scoreboard2.text = "" +score9.toString ();

}

//subtract 2 pt to score

su3Btn.addEventListener(MouseEvent.CLICK, su1Click5);

function su1Click5 (event:MouseEvent): void

{

  score9 = score9-3;

  scoreboard2.text = "" +score9.toString ();

}

//BIG SCORE

//ADD 1 PT HOME SCORE

import flash.events.MouseEvent;

stop();

var score12:int = 0;

//add 1 pt to score

ad4Btn.addEventListener(MouseEvent.CLICK, ad1Click6);

function ad1Click6 (event:MouseEvent): void

{

  score12 = score12+1;

  bottomscore2.text = "" +score12.toString ();

}

//subtract 1 pt to score

su4Btn.addEventListener(MouseEvent.CLICK, su1Click6);

function su1Click6 (event:MouseEvent): void

{

  score12 = score12-1;

  bottomscore2.text = "" +score12.toString ();

}

//ADD 2 PT VISITOR SCORE

import flash.events.MouseEvent;

stop();

var score13:int = 0;

//add 2 pt to score

ad5Btn.addEventListener(MouseEvent.CLICK, ad1Click7);

function ad1Click7 (event:MouseEvent): void

{

  score12 = score12+2;

  bottomscore2.text = "" +score12.toString ();

}

//subtract 2 pt to score

su5Btn.addEventListener(MouseEvent.CLICK, su1Click7);

function su1Click7 (event:MouseEvent): void

{

  score12 = score12-2;

  bottomscore2.text = "" +score12.toString ();

}

//ADD 3 PT VISITOR SCORE

import flash.events.MouseEvent;

stop();

var score14:int = 0;

//add 3 pt to score

ad6Btn.addEventListener(MouseEvent.CLICK, ad1Click8);

function ad1Click8 (event:MouseEvent): void

{

  score12 = score12+3;

  bottomscore2.text = "" +score12.toString ();

}

//subtract 3 pt to score

su6Btn.addEventListener(MouseEvent.CLICK, su1Click8);

function su1Click8 (event:MouseEvent): void

{

  score12 = score12-3;

  bottomscore2.text = "" +score12.toString ();

}

btnReset_Score.addEventListener(MouseEvent.CLICK, resetClick2);

function resetClick2 (e:MouseEvent):void

{

score9 =

scoreboard2.text = "0".toString ();

score12 =

bottomscore2.text = "0".toString ();

}

Views

891

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 11, 2019 Jul 11, 2019

i'm not sure what problem you're having but you should be moving each movieclip independently.  the easiest way to create and maintain this, i believe, is to create an object that facilitates conversion from a number to a y coordinate of a strip:

var posObj:Object={0:0,1:-30,2:-60,3:-90,etc};  // if your numbers are 30 pixels apart and 0 is vertically centered on your scoreboard when the y position of your strip is at 0.

you can then use:

function positionColumns(n:int):void{

var hun:int=Math.floor(

...

Votes

Translate

Translate
Community Expert ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

you would use a mask and a vertical strip of numbers to give an 'odometer' effect.  using shading can give a more convincing odometer effect.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

Thanks for your reply, I like the idea you have given me but the problem with basketball scoring is the undetermined final score output. So, if the final score would be "150" I should make a vertical number strip of about "200".  I would give it a try anyway. I attached an image to show your point. score scroll.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

no.

make one movieclip from 0 to 9.  use it three times for the 100's column, the 10's column and the 1's column.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 11, 2019 Jul 11, 2019

Copy link to clipboard

Copied

That would be great solution, but the problem is the digit placement. Pls. refer to image attached) scores are always centered.

But, I guess it is workable by using code positioning the whole 3 movie strips for single, tens and hundreds place value, whew!!!

Thanks! again anyway, I would try it though.score scroll copy.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2019 Jul 11, 2019

Copy link to clipboard

Copied

LATEST

i'm not sure what problem you're having but you should be moving each movieclip independently.  the easiest way to create and maintain this, i believe, is to create an object that facilitates conversion from a number to a y coordinate of a strip:

var posObj:Object={0:0,1:-30,2:-60,3:-90,etc};  // if your numbers are 30 pixels apart and 0 is vertically centered on your scoreboard when the y position of your strip is at 0.

you can then use:

function positionColumns(n:int):void{

var hun:int=Math.floor(n/100);

hunColumn.y=posObj.hun;

var ten:int=Math.floor((n-hun*100)/10);

tenColumn.y=posObj.ten;

var one:int = Math.floor(n-hun*100-ten*10)

oneColumn.y=posObj.one;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines