Dynamic Input Box - Adding Two Numbers

Feb 24, 2011

I using Flash CS5 for the first time, and I'm hitting a snag. I have an input box on Scene 1 for age (variable called old). On scene 3, I have a dynamic test box (variable called display), where I want to display the age (old) + 10.

My Code looks like this:
PHP Code:
var Real_age = Number(old) + 10;
display = Real_age;
It's returning NaN.

A trace of the output of Real_age gives:
PHP Code:
<FONT FACE="Times New Roman" SIZE="12" COLOR="#009900" LETTERSPACING="0" KERNING="0">2</FONT></P></TEXTFORMAT>
<p align="left"></p>
<p align="left"></p>
<p align="left"></p>
<p align="left"></p>

The code works OK in Flash 8, but I figure I must have some some setting that is spitting out the unwanted HTML.

View 5 Replies

Similar Posts:

ActionScript 3.0 :: Adding Numbers From Input Boxes?

Jan 28, 2011

I'm stumped on this problem and can't seem to figure it out. Any suggestions would be welcomed. Basically I'm building a large calculator that adds over 100 input boxes. I've got it working except for the fact that if a user misses inputing a number into one of the input boxes it does not work anymore. I've tired lots of things to no avail. I just want to add the input boxes and skip those where the user did not enter any information (does not apply to them)

Here is my code.

on (press){
ReceptionTotal = Number(LocationFee) + Number(Caterer) + Number(ToastingGlasses) + Number(SecurityFee) + Number(BarPackage) + Number(WeddingCake) + Number(FoodHors) + Number(Baker) + Number(BartentingFee) + Number(CakeKnife) + Number(Servers) + Number(Flatware) + Number(Dinnerwear) + Number(Flatware) + Number(TableLinens) + Number(ChairsCovers) + Number(Glasswear) + Number(Tent) + Number(Napkins) + Number(Childcare) + Number(DanceFloor) + Number(ServingStaff) + Number(Lanterns) + Number(Heaters) + Number(Restrooms);

each input box has a variable name assigned to it as indicated above. I've tired setting the variables to 0, tried if statements don't know how to skip one of the above variables when no number is entered.

View 8 Replies

ActionScript 2.0 :: Adding Up Numbers In Dynamic Textfields?

Nov 9, 2010

let's say you had a dynamic text field with a number (for example '30'). Everytime you click on a certain button / movie clip, that triggers an animation (so far no problem) AND adds '20' to the number in that textfield.

==> first click, the number displays 50 (30+20), second click 70 (50+20) ...

When you enter a certain keyframe and that number is higher than let's say 290, the movie jumps to frame x. If that number equals 290 or is lower than 290, the movie jumps to frame y.

View 4 Replies

ActionScript 3.0 :: Adding Commas To Dynamic Numbers

Sep 29, 2009

So I have a project where the user puts in a number, that number is * by a certain number and then spits that number back out to another dynamic textField. All of that is working out great so far. Now I need to figure out a way to add commas to those numbers that I am displaying.

Here is the code I have thus far:

var num1:Number;
var inputFont:Gotham = new Gotham();
var tf:TextFormat = new TextFormat();


View 1 Replies

ActionScript 3.0 :: Adding Up Odd Numbers From An Array Of Numbers?

Mar 7, 2012

I have been using Actionscript 3.0 in Adobe Flash Builder for a few weeks,and I really like it! Bare with me because I'm not really good at it, yet. Anyway, I was wondering how would I go by adding up odd numbers from an array of numbers? I know how to make all of the numbers add up, but adding only the odd numbers I'm not so sure how to do it.

View 5 Replies

Actionscript 3 :: Restrict The Input To Numbers Only?

May 26, 2011

i want to restrict the input to numbers only, but do have a problem for an empty entry:

now accessing like this:

var newValue:Number = event.itemRenderer.data[event.dataField]

newValue is now for an empty entry not null, but 0...

View 1 Replies

ActionScript 3.0 :: Input Box Wont Allow Numbers?

Jan 25, 2012

When I try typing in numbers into the input text box, nothing happens.Can anyone explain why and/or how to fix?

View 8 Replies

IDE :: Adding Two Numbers (digits)

Feb 18, 2005

I have to input text fields and third - dynamic. Also I have a button. I want that on button press in the dynamic field would be displayed the sum of two numbers entered in those input fields. First field: var1 Second: var2
and dynamic text: answer.

I wrote scipt but look what happens. For example I input to numbers: 5 and 6 I need to get answer 11 but the sum is shown: 56 .

View 6 Replies

ActionScript 2.0 :: CS3 - Input Text Box Not Reading Numbers?

Dec 16, 2009

I have an input text box and I want the user to be able to enter a number in the text box and hit a button and it will jump to that frame of a movie clip. For some reason I can't get the input text to read the input as a number. I have tried using parseInt or Number, but it gives me this output instead. "<TEXTFORMAT LEADING="2"><P ALIGN="CENTER"><FONT FACE="Myriad Pro Light SemiCond" SIZE="13" COLOR="#000000" LETTERSPACING="0" KERNING="0">2</FONT></P></TEXTFORMAT>" when I just want it to say "2".

Here is the code I have linked to the button:

btn_newPage.onRelease = function (){


On the trace of pageString I get the text i put in above and then pageNum comes back as NaN.btn_newPage is the button they would click after they have input a page number in the input text box. pageString is the name of my input text box variable and I was trying to use pageNum to change it to a number. And doc_content is the movie clip I am trying to control.

View 1 Replies

ActionScript 3.0 :: Take Only Numbers Into The Text Input Field?

Aug 17, 2011

How can i Take only numbers into the text input field...

View 1 Replies

ActionScript 3.0 :: Numbers Only In Input Text Field?

Sep 23, 2009

is there a way to only allow a user to enter numbers in a text feild. setting embed text to numbers only worked for a while, but have to embed all now.

View 1 Replies

ActionScript 2.0 :: Input Numbers To Change GRB On Picture?

Nov 29, 2010

there fellow actionscripters, I am currently studying design and I have a code that was constructed on class:

var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth() );
var image:String = "hxxp://static.vgcats.com/gallery/walk_wallpaper_800.jpg";
var mcl:MovieClipLoader = new MovieClipLoader();


I have to make it, so that a user can input a value (0-255) so they can edit the GBR on the spot.

Like, putting those numbers in an input box and have the picture change according to those numbers.

View 5 Replies

ActionScript 2.0 :: Numbers And Text Input Component

Jun 9, 2004

I am using actionscript 2.0, and I actually have a simple question: the TextInput.text property returns the text string in quotes. However, I am calculating something and don't want it in quotes. How do I get rid of the quotes so I can calculate stuff?

View 2 Replies

ActionScript 2.0 :: Flash8 Adding Two Numbers?

Oct 28, 2009

I am trying to add two numbers (num1 and num2) in Flash Pro 8. Every time that I try to add them I get a result of NaN in my answer box (ans instance, sum var)

The code in the Layer's Background is as follows

var num1;
var num2;
var sum;


View 1 Replies

ActionScript 2.0 :: Adding The Multiple Numbers?

Sep 8, 2010

I'm building a calculator of sorts and have about 7 input text boxes (input text chosen) that users can enter numbers. At the bottom I have a calculate button that adds all of the numbers users have input into the boxes. The answer goes into a dynamic text box. It all works fine expect if a user does not enter in a number in one or more of the boxes. In other words, users would have to input a number in each box for it to work, I don't want that.Here is the code on the calculate button:

TransportationTotal = Number(Limo) + Number(SUV) + Number(HorseCarriage) + Number(Boat) + Number(Helicopter) + Number(LuxuryCoach) + Number(LuxuryCar) + Number(TransportationGuests);

whereas the names in brackets are the var assigned names. Do I need to declare the var's beforehand? Tired this and did not work.

View 2 Replies

ActionScript 1/2 :: Adding Numbers In Flash?

Nov 29, 2010

I have a game I'm trying to create over a number of key frames.I want to be able to contiuously add a users score.Each question is worth different points from 100 - 500 and ther is about 5 different categories.Is there a simple way to add numbers in flash?

View 3 Replies

ActionScript 3.0 :: Adding Numbers To Integers?

Jan 30, 2011

var result:Number = int(driven.text) / int(mpg.text);
result1.text = String(result);
var result:Number = int(driven.text) / int(mpg.text + 3);


for some reason it doesnt work properly...the correct equation should work like this:

12000 (milesdriven) / 20(mpg) = 600
12000 (milesdriven) / 23(mpg + 3) = 521
600 - 521 = 79(gal.)
79 x $2.75 = $217.25

what im having problems with and what i need to function is that the MPG input has a +3 to any number inputted (i.e. 20 becomes 23)

View 3 Replies

ActionScript 3.0 :: Adding Numbers From Dates

Aug 10, 2011

i want to create a calculater that can add scores from a scale of 1 to 10.for example, if the player gets between 0-3, he gets a point

-between 4-7, he gets 2 points
-between 8-12, he gets 3 points

when this is complete, the points are added up, depending on what the player gets, for example he scores between 4-7 and between 8-12, he gets gets 5 pionts. i can get them to add the points, but not when its between a certain value

View 1 Replies

ActionScript 2.0 :: Adding Numbers To A Total

Mar 4, 2009

Say I have 4 values (level_reached1, level_reached2, level_reached3, level_reached4) I want to add up to a total, and another 4 values (goal1, goal2, goal3, goal4) I want to add up to a total. How do I add these up and compare them to each other, and if the "level_reached" is equal to OR greater than "goal" I want a movie to gotoAndStop(2);

Here is what I have, which does not work, I probably have things really mixed up:

leveltotal = level1 + level2 + level3 + level4;
goaltotal = goal1 + goal2 + goal3 + goal4;
if (leveltotal >= goaltotal) {


View 2 Replies

ActionScript 3.0 :: Flash Xml / Adding Numbers

Apr 18, 2012

I have an xml file that I loaded and parsed and end up with xmlist like this:


I want to variable that adds the goals together to get 62. How do I go about doing this?

View 1 Replies

ActionScript 3.0 :: Capturing User Input Restricted To Just Numbers?

Nov 14, 2008

I've written a function that restricts user input to just numbers (0-9,.) and stores the input in the associative array, userInput[]. It works but seems inefficient looping through the entire input text string to scrub out invalid characters. Anyone have suggestions for a more efficient approach? Note that a working solution must correctly process mouse or cursor key movements/edits within the input box.

Also, you can see I'm using the KeyboardEvent.KEY_UP event to trigger the processing. The docs seem to indicate TextEvent.TEXT_INPUT is really the proper event for this purpose. I started with TextEvent.TEXT_INPUT but found the event is triggered before the last key pressed is actually added to the instance. The result is that the function was always one characterbehind. Is there an easy way to get the current text in the input box, including the last key pressed, when processing TextEvent.TEXT_INPUT?

View 5 Replies

ActionScript 2.0 :: Restrict User Input To Numbers Only Between Letters

Aug 30, 2008

I would like to restrict user input to numbers only between letters. for example: the user is allowed to input "a2b", but "2ab" or "ab2" isn't allowed.

View 4 Replies

ActionScript 2.0 :: [F8] Adding Numbers To The Beginning Of A Variable

Feb 18, 2009

Basically, I have an input box on a widget that sends information via PHP.

One of the input boxes is phone number. Everyone inputs number as normal, but without the country code.

Is there a way of me taking their normal number from the input box, removing the '0' and adding the country code before sending it (i.e. within a calculation/function/formula).

View 1 Replies

ActionScript 3.0 :: Adding Two Numbers But Getting Error 1067?

Jan 5, 2009

just trying to add 2 numbers but doesn't seems to work.

error:1067: Implicit coercion of a value of type Number to an unrelated type String.


var imput:Number;
var imput2:Number;
var total:Number;


View 1 Replies

ActionScript 3.0 :: Dynamice Text Adding Numbers

Jan 23, 2011

I dont know why, but I am having the hardest time! All I want is for there to be a movieclip, and when I click it my textfield adds a number! I swear I have looked everywhere but nothing.

View 7 Replies

ActionScript 3.0 :: Adding 2 Numbers With One TextField And Four Buttons

Oct 31, 2011

Adding 2 numbers having 3 textfields and a button, I can do. The first textfield for input one, the second one for input two and the third one for output (result). The button triggering the operation. [URL]. How can I add 2 numbers only with one textfield( result) and 4 buttons. One button for number 1, another one for number 2, another one for the operator +, and finally another one for the sign =.

I have the code, how to put everything to work:
import flash.events.Event;
var txt_inp:TextField = new TextField();
txt_inp.type = "input";
txt_inp.x = 168.95;
txt_inp.y = 51.10;
[Code] .....

View 10 Replies

ActionScript 2.0 :: Adding Numbers (time) To A Countdown?

May 22, 2009

I'm sure this is something really basic, but I've searched and nothing quite fits what I'm looking for..I have a timer counting down using this code

count = 30;
countdown = function(){


View 2 Replies

Professional :: Extracting Numbers Not Strings From Input Text Fields?

Apr 29, 2010

I have two input boxes that I can type numbers into.I'd like a third input box to display the total of the first two.I've set up a key pressed listener on the stage to run a function that adds them together when a key is pressed.Problem is, it just places the strings together - it ddoesn't add them.So how do I tell Flash that box1.text and box2.text are numbers?box3.text = box1.text + box2.text ain't doing it.

View 5 Replies

ActionScript 3.0 :: Type Only Numbers And The Minus (-) Sign Into An Input Textfield

Apr 11, 2008

I would like the client to be able and type only numbers, and the minus (-) sign into an input textfield. The reason I need them able to type a minus (-) sign is in the case they need the number to be negative. However,


View 8 Replies

ActionScript 2.0 :: Transfer Numbers Out Of The Input Fields And Into An Sudoku Array

Nov 16, 2009

I'm making a sudoko solver, and i have 81 input fields. They're named from i11 to i99. The first number is the column number "x", the second number is the row number "y". I want to transfer those numbers out of the input fields, and into an array.


is something wrong with the way I am naming the grid array? After tracing just about everything, that must be the problem.

View 5 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved