# ACTIONSCRIPT help please!

**URL:** <https://forum.kirupa.com/t/actionscript-help-please/322123>\
**Category:** Uncategorized\
**Created:** [May 11, 2011, 8:20am UTC](https://forum.kirupa.com/t/actionscript-help-please/322123 "2011-05-11T08:20:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwerqwer](https://avatars.discourse-cdn.com/v4/letter/q/ac8455/32.png) [@qwerqwer](https://forum.kirupa.com/u/qwerqwer)\
**Post date:** [May 11, 2011, 8:20am UTC](https://forum.kirupa.com/t/actionscript-help-please/322123/1 "2011-05-11T08:20:14Z")

</div>

:puzzle: I have created a basic footy scoreboard with number of goals, behinds and total for both home and away team. The winner/ or currently winning team  
is displayed at a textbox called ‘Leader’ and this all happen when button GO is pressed down. Below is my whole thing

* * *

// Function  
function FootyScoreboard(evt:MouseEvent):void {

// Variables  
var iVisGoals:int;  
var iHomeGoals:int;  
var iVisBehinds:int;  
var iHomeBehinds:int;  
var iVisTotal:int;  
var iHomeTotal:int;  
var iLeader:String;  
var iLeadPoint:int;

// Input  
iHomeGoals = parseInt(HomeGoals.text);  
iHomeBehinds = parseInt(HomeBehinds.text);  
iVisGoals = parseInt(VisGoals.text);  
iVisBehinds = parseInt (VisBehinds.text);

// Processing  
iVisTotal = (iVisGoals_6)+iVisBehinds  
iHomeTotal = (iHomeGoals_6)+iHomeBehinds;

// Output  
HomeTotal.text = (iHomeTotal.toString());  
VisTotal.text = (iVisTotal.toString());

if (iHomeTotal == iVisTotal) {  
Leader.text = “Draw”;  
}

if (iHomeTotal \> iVisTotal) {  
Leader.text = “Home”;  
}

if (iHomeTotal \< iVisTotal) {  
Leader.text = “Visitors”;

}  
}

// Event Listeners  
btnGo.addEventListener(MouseEvent.CLICK, FootyScoreboard);

* * *

What i have to do now is in a textbox called LeadPoint, put how much points the winner is winning by. But i cannot work out how i will do that.  
I tried doing LeadPoint.text = iHomeTotal - iVisTotal which doesnt really work, and i did iLeadPoint = iHomeTotal - iVisTotal for ‘if (iHomeTotal \> iVisTotal)’ and reverse for Vis \> Home but only one worked!! meaning if Home scored 10 and Visitors scored 5, it will say 5 and if Vis scored 10 and Home scored 5, i will say -5.

_Currently when i put in the number of goals and behinds it calculates the total and the winner as you can probably see up there._  
Textbox where leading points will be displayed is currently empty . Please explain or let me know what i can do. Even small help will  
really be appreciated. if anythings unsure please let me know so ill try to explain whats going on.
