Dear All,
i’m trying to optimizing the script below, but i have problem. Please kindly help me to solve this problem.
Thanks in advanced…
/*
su=0;
onEnterFrame=function()
{
if( su == 1 ) trace(1);
if( su == 2 ) trace(2);
if( su == 3 ) trace(3);
if( su == 4 ) trace(4);
if( su == 5 ) trace(5);
}
su1_btn.onRelease = function(){ su=1 };
su2_btn.onRelease = function(){ su=2 };
su3_btn.onRelease = function(){ su=3 };
su4_btn.onRelease = function(){ su=4 };
su5_btn.onRelease = function(){ su=5 };
*/
// OPTIMIZING THE SCRIPT ABOVE
su=0;
onEnterFrame=function() // ITS WORK !
{
for(i=1;i<=5;i++)
{
if( su == i ) trace(i);
}
}
for(j=1;j<=5;j++) // ITS NOT WORK, WHY ?
{
this["su"+String(j)+"_btn"].onRelease = function(){ su=j };
}