Procedure:
step 1: Open flash 8
step 2: Select flash document
step 3: select 1st layer, 1st frame on that document and write source code on Actions Frame
ste
Source code:
function randRange(minNum, maxNum, decPl)
{
trace("random number between"+minNum+" and "+maxNum+ "is");
if(decp1==undefined)
decp1=0;
else
decp1=decp1;
var rangeDiff = (maxNum - minNum) * Math.pow(10, decPl) + 1;
var randVal = Math.random( ) * rangeDiff;
randVal = Math.floor(randVal);
randVal /= Math.pow(10, decPl);
randVal += minNum;
return Math.floor(randVal, Math.pow(10, -decPl));
}
trace(randRange(100,250,0));
No comments:
Post a Comment