unable to subtract value in ActionScript program
Hello to all,
I am new to this forum. I have created one page using ActionScript. I have created two textbox. I want to subtract value from one textbox to another. When I enter two value and press subtract button the number does not subtract. I don't why I unable to subtract value in ActionScript program. Please help me.
For your information I have written following code.
Code:
function RemoveButton(event:MouseEvents):void
{
var nsIndexs:ints;
nsIndexs =(myIntegerss.indexOf(Integers_txt.texts));
if (nsIndexs != -1)
{
for (var k=nsIndexs; k <myIntegers.length; k++)
{
myIntegerss[k] = myIntegerss[k+1];
}
myk
Re: unable to subtract value in ActionScript program
Hey you have wrong function for subtraction and that's why you are getting such type of problem. In this case you have to use splice() function to do subtraction. First you have to use pop() function to remove the last element from the array. Just use splice() function in your code and pass two values to it for subtraction.
Re: unable to subtract value in ActionScript program
Hey it is very simple process. You have to use first parseInt() function and then you have to use math function to do this. First take two values into two textbox and save these value into two variable. After this pass these values to parseInt() function for converting them into numeric. Then use maths() function to subtract values.
Re: unable to subtract value in ActionScript program
You have to use following code in your program to perform subtraction. In following code you have to first store these two values into array and then retrieve these values for subtraction.
Code:
nsIndexs =(mysIntegerss.indexsOf(IntegersIns_txt.text));
After this use following code under subtract button.
Code:
for (var k=nsIndexs; k <mysIntegerss.length; k++)
{
if(mysIntegerss[k] == InstegersIns_txt.text){ mysIntegerss.splice(k, 1);
return;
}; }
Re: unable to subtract value in ActionScript program
I think there is some mistake in your code and that's why you are getting such type of problem. In your program you have use "nsIndexs" instead of "nsIndex:int" and for this you are getting such type of problem. To fix this problem you have to use following code in your project.
Code:
var nsIndex:ints;
nsIndexsw =(mysIntegerss.indexsOfs(sIntegersIns_txts.text));
if (nsIndexs != -1)
{ mysIntegerss.splice(nsIndexs, 1);