4. Creating a Function, Calling a Function
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
step 4: To check output press ctrl+enter(test movie)
Source code:
function poly(x:Number):Number
{
var res=0,x1;
while(x>0)
{
x1=x%10;
x=Math.floor(x/10);
res=res*10+x1;
}
return res;
}
var n:Number=323;
var n1=poly(n);
if(n==n1)
trace("Given number is palindrome");
else
trace("Given number is not palindrome");
No comments:
Post a Comment