# Writing function syntax

**URL:** <https://forum.kirupa.com/t/writing-function-syntax/177402>\
**Category:** Uncategorized\
**Created:** [February 1, 2006, 5:44pm UTC](https://forum.kirupa.com/t/writing-function-syntax/177402 "2006-02-01T17:44:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)\
**Post date:** [February 1, 2006, 5:44pm UTC](https://forum.kirupa.com/t/writing-function-syntax/177402/1 "2006-02-01T17:44:52Z")

</div>

this may be a bit extensive code, simple to understand

[AS]//entra b1  
function goGo() {  
var b1UP:Tween = new mx.transitions.Tween(b1\_btn, “\_x”, Strong.easeOut, 0, 105, 1, true);  
var b1ALPHA:Tween = new mx.transitions.Tween(b1\_btn, “\_alpha”, Strong.easeOut, 0, 100, 1, true);  
b1\_bnt = 1;  
}  
//sai b1  
function goHome() {  
var b1UP:Tween = new mx.transitions.Tween(b1\_btn, “\_x”, Regular.easeOut, 105, -50, 1, true);  
var b1ALPHA:Tween = new mx.transitions.Tween(b1\_btn, “\_alpha”, Regular.easeOut, 100, 0, 1, true);  
b1\_bnt = 0;  
}  
//entra b2  
function goGo2() {  
var b1UP:Tween = new mx.transitions.Tween(b2\_btn, “\_x”, Strong.easeOut, 0, 100, 1, true);  
var b1ALPHA:Tween = new mx.transitions.Tween(b2\_btn, “\_alpha”, Strong.easeOut, 0, 100, 1, true);  
b2\_bnt = 1;  
}  
//sai b2  
function goHome2() {  
var b3UP:Tween = new mx.transitions.Tween(b2\_btn, “\_x”, Regular.easeOut, 100, -50, 1, true);  
var b3ALPHA:Tween = new mx.transitions.Tween(b2\_btn, “\_alpha”, Regular.easeOut, 100, 0, 1, true);  
b2\_bnt = 0;  
}  
//[/AS]  
i just want to make it shorter, and have tried to do like so  
[AS]//entra b1  
function goGo(who) {  
var b1UP:Tween = new mx.transitions.Tween(who, “\_x”, Strong.easeOut, 0, 105, 1, true);  
var b1ALPHA:Tween = new mx.transitions.Tween(who, “\_alpha”, Strong.easeOut, 0, 100, 1, true);  
who = 1;  
}  
//sai b1  
function goHome(who) {  
var b1UP:Tween = new mx.transitions.Tween(who, “\_x”, Regular.easeOut, 105, -50, 1, true);  
var b1ALPHA:Tween = new mx.transitions.Tween(who, “\_alpha”, Regular.easeOut, 100, 0, 1, true);  
who = 0;  
}[/AS]

doubt is if i can replace the variable also, ex:  
“b1\_bnt = 0;” goes like so “who = 0;”  
“b1\_bnt = 1;” goes like so “who = 1;”  
…

seams not to work ☹  
help please :toad:
