| You are here: DEVPPL ‹ Forum ‹ Programming ‹ Flash Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Multiplying variables...
3 posts
• Page 1 of 1
0
Multiplying variables...
Hi there!
Here is the whole script of a test document which doesn't work...
Excuse me but I never used multiplication of variables and I confess how shameful I feel.
I absolutely don't understand the explanations the Flash Help contains...
Document contains three Input Fields, a Dynamic Field and a Button.
Clicking the Button returns NaN !!!
I thank you in advance for any help.
Best regards from Old Gerry
Here is the whole script of a test document which doesn't work...
Excuse me but I never used multiplication of variables and I confess how shameful I feel.
I absolutely don't understand the explanations the Flash Help contains...
Document contains three Input Fields, a Dynamic Field and a Button.
Clicking the Button returns NaN !!!
I thank you in advance for any help.
Best regards from Old Gerry
- Code: Select all
var a:Number = new Number(field1.text);
var b:Number = new Number(field2.text);
var c:Number = new Number(field3.text);
operationFct = function () {
var res:Number = new Number();
res = (a * b) + c;
resultFld.text = res;
};
myButton.onRelease = function() {
operationFct();
};
stop();
- Germaris
- Reputation: 0
- Posts: 2
- Joined: Wed Feb 27, 2008 10:34 pm
- Highscores: 0
- Arcade winning challenges: 0
0
The problem isn't your multiplication. When you defined var a-c, it was when the frame loaded. At that point, there was nothing in them. You need to redefine your variables in the function like this:
Although if you leave the input textfields empty you would still get NaN.
- Code: Select all
operationFct = function () {
var a:Number = new Number(field1.text);
var b:Number = new Number(field2.text);
var c:Number = new Number(field3.text);
var res:Number = new Number();
res = (a*b)+c;
resultFld.text = res;
};
myButton.onRelease = function() {
operationFct();
};
stop();
Although if you leave the input textfields empty you would still get NaN.
- Solar
- Reputation: 0
- Posts: 35
- Joined: Tue Jul 11, 2006 1:56 am
- Highscores: 0
- Arcade winning challenges: 0
|
|