How could I add together the numerical values in the dynamic text boxes?

I do an application and I currently have sections such as travel, rent, etc., where you can press one of two buttons to increase or decrease the total number (fresh) for this article. All totals are displayed in the dynamic text boxes - here is an example of the code for a section-

var FoodAndDrink:Number = 0;

button1_btn.addEventListener (MouseEvent.MOUSE_DOWN, Add);

function Add(e:MouseEvent):void {}

Repasetboissons += 1;

trace (FoodAndDrink);

FoodAndDrink_txt.text = "£" + FoodAndDrink;

}

button2_btn.addEventListener (MouseEvent.MOUSE_DOWN, subtraction);

function Subtract(e:MouseEvent):void {}

Repasetboissons-= 1;

If (repasetboissons < 0) {}

Repasetboissons = 0;

}

trace (FoodAndDrink);

FoodAndDrink_txt.text = "£" + FoodAndDrink;

Does anyone know how I would go all add up all the sections so that the total is in a box and changes based on the total entered in each section?

Thank you

then use:

import flash.events.MouseEvent;

var FoodAndDrink:Number = 0;

button1_btn.addEventListener (MouseEvent.MOUSE_DOWN, Add);

function Add(e:MouseEvent):void {}

Repasetboissons += 1;

trace (FoodAndDrink);

FoodAndDrink_txt.text = "£" + FoodAndDrink;

addAllF();

}

button2_btn.addEventListener (MouseEvent.MOUSE_DOWN, subtraction);

function Subtract(e:MouseEvent):void {}

Repasetboissons-= 1;

If (repasetboissons< 0)="">

Repasetboissons = 0;

}

trace (FoodAndDrink);

FoodAndDrink_txt.text = "£" + FoodAndDrink;

addAllF();

}

var/entertainment: Number = 0;

button3_btn.addEventListener (MouseEvent.MOUSE_DOWN, Add1);

function Add1(e:MouseEvent):void {}

Entertainment += 1;

trace (Entertainment);

Entertainment_txt. Text = "£" + Entertainment;

addAllF();

}

button4_btn.addEventListener (MouseEvent.MOUSE_DOWN, Subtract1);

function Subtract1(e:MouseEvent):void {}

Entertainment-= 1;

If (Entertainment< 0)="">

Entertainment = 0;

}

trace (Entertainment);

Entertainment_txt. Text = "£" + Entertainment;

addAllF();

}

Hotels var: Number = 0;

button5_btn.addEventListener (MouseEvent.MOUSE_DOWN, Add2);

function Add2(e:MouseEvent):void {}

Accommodation += 1;

trace (Accommodation);

Accommodation_txt. Text = "£" + accommodation;

addAllF();

}

button6_btn.addEventListener (MouseEvent.MOUSE_DOWN, Subtract2);

function Subtract2(e:MouseEvent):void {}

Accommodation-= 1;

If (accommodation< 0)="">

Accommodation = 0;

}

trace (Accommodation);

Accommodation_txt. Text = "£" + accommodation;

addAllF();

}

var travel: Number = 0;

button7_btn.addEventListener (MouseEvent.MOUSE_DOWN, Add3);

function Add3(e:MouseEvent):void {}

Travel += 1;

trace (Travel);

Travel_txt. Text = "£" + Travel;

addAllF();

}

button8_btn.addEventListener (MouseEvent.MOUSE_DOWN, Subtract3);

function Subtract3(e:MouseEvent):void {}

Travel-= 1;

If (trip< 0)="">

Travel = 0;

}

trace (Travel);

Travel_txt. Text = "£" + Travel;

addAllF();

}

var bills: Number = 0;

button9_btn.addEventListener (MouseEvent.MOUSE_DOWN, Add4);

function Add4(e:MouseEvent):void {}

Draft law += 1;

trace (Bills);

Bills_txt. Text = "£" + Bills.

addAllF();

}

button10_btn.addEventListener (MouseEvent.MOUSE_DOWN, Subtract4);

function Subtract4(e:MouseEvent):void {}

Projects of law-= 1;

If (bills< 0)="">

Projects of law = 0;

}

trace (Bills);

Bills_txt. Text = "£" + Bills.

addAllF();

}

function addAllF (): void {}

total_txt. Text = 'pound sign' +(FoodAndDrink+Bills+Travel+Accommodation+Entertainment);

}

Tags: Adobe Animate

Similar Questions

  • Images in the dynamic text box?

    I searched high and low trying to find how to insert images in the dynamic text boxes and there are hundreds of solutions. I can't make them work... still too novice.

    Im trying to insert 1 image under a paragraph in a dynamic text box. Fact scroll and areas are defined for "render text as html" and "selectable".

    I have put the following inside the text box code and just show you the code.

    < img src = "images/graph.jpg" width = "194" height = "300" / > "

    What I am doing wrong?

    clbeech... thank you very much. Your help is very appreciated!

  • Value display trace in the dynamic text box

    Hey just work on an exercise and I can't understand the code to display the value of the trace in a dynamic text box.

    The following code generates exactly where I am at this time.

    Import 12345678910111213import;

    import flash.text.TextField;

    Basic color picker (based pixel)

    var myColourBitmapData:BitmapData = new BitmapData (500 400, false, 0xFFFFFF * Math.random ());

    var myColourBitmapImage:Bitmap = new Bitmap (myColourBitmapData);

    Add to list

    addChild (myColourBitmapImage); Add to the scene

    Get colors

    var pixelValue:uint = myColourBitmapData.getPixel (85,62); color of the pixel at X, Y

    displayed in the output window

    trace (pixelValue.toString (16)); toString (16) converts uint in a number of Hexadecimel format

    Here are a few screens, I want the values of trace output to appear next to the text in the dynamic text box

    Picture 4.png

    Picture 6.png

    I'm not sure of how to call the pixelValue to my text box, any help would be appreciated!

    Before or after the line that begins with «trace...» ' set dynamicTextFieldInstanceName.text = pixelValue.toString (16); Replace dynamicTextFieldInstanceName with the actual name that you gave to the dynamic textfield.

    There is an error in your output window. It seems that you have not integrated a font in the dynamic textField.

  • Add background color to the dynamic text boxes

    Is this possible?  Basically, I want to make the bottom of the dynamic text box have a color.  How can I do this using AS3?

    If your textfield reference name tf, use:

    TF. Background = true;

    tf.backgroundColor = 0xrrggbb;

  • Add price and display them in the dynamic text box

    Hey,.

    I have a combobox with specific prices and radio buttons I want attached according to the choice of the user. I have trouble to get the application to add the total of selections and display the total in a dynamic text box.

    I try to use global variables. I put them to a certain value depending on what is selected. At the end I put add them upward in the total variable and which corresponds to the text box named totalPrice.

    Currently, the value of global variables is not returned to their duties.

    Any suggestions for how to do this correctly?

    Thank you!

    remove these return statements, create a function that updates your textfield totalPrice and call this function of objComboListener.change after your if-else statements.

  • How to get the name of the instance of button to display in the dynamic text box

    first of all, thank God for you people. Laughing out loud.

    Here is my scenario, I am the designer of consumate and learning coding by leaps and bounds, today its been a lot of stumbling blocks however.

    I have a site I designed that contains buttons that navigate the user at various points on the timeline using image tags. When they arrive at the appropriate image tag, they are presented with a movieclip containing two layers. The bottom layer is a card, and the top layer is a collection of buttons printer having a component tooltip on them showing you the information on detailed mouse printer on and takes you to the Remote UI printer on release. each button has a name of unique queue for the printer appropriate under its name of the instance (e.g. itm100_btn). Here's the jist... I want to be able to place a dynamic text box near the printer and using action script button it display printer queue name automatically simply based on the button, targeting, or even place the dynamic txt area inside the printer button mc. See, on some pages, there are like 24 printers... I'm AFRAID to have to put all these names in manually because there are total 150 printers! OUCH...

    Oh it is AS2.0 with Flash cs4

    In short... God bless you people... for the love of God someone help me? Laughing out loud.

    Thank you so much peoples!

    "I make things look purdy, but do not know why the sky is blue".

    to create a movieclip button:

    create a (insert/new symbol/movieclip) movieclip and attach a stop() to its first image and etiquette 'up '.  create any graphic you want for the up state button movieclip.  create a 'more' and, if necessary, a "low" setting

    When you place this button movieclip on stage give an instance name (for example, printer1) and use:

    {Printer1.onRollOver = Function ()}

    this.gotoAndStop ("over");

    }

    {Printer1.onRollOut = Printer1.onDragOut = Function ()}

    this.gotoAndStop ("up");

    }

    {Printer1.onPress = Function ()}

    this.gotoAndStop ("down");

    }

    and add your onRelease to do all that.

    If you also wanted to add a textfield that displays the instance name of the button when the button is postponed, place a textfield on the framework of the "over" and give it a name instance (say tf) and associated to the MovieClip "over" frame that uses:

    TF. Text = This._name;

  • Definition of the size of the image in the dynamic text box

    I have a dynamic text box in which I'm embedding an image.  The following code fills the text box

    infoBox.informationText.htmlText=
         "<font size='16' color='#FFFAF0'>"+calledMarkerIndex+
         "\n<font size='14' color='#FFFAF0'>"+calledMarkerDate+
         "<img src='http://jacobull.files.wordpress.com/2010/06/ween.jpg'/>"+
         "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<font size='12' color='#FFFAF0'>"+calledMarkerDescription;
    

    How set the size of the image in the code above.  I tried to insert the width and height parameters after the path of the image, but an error is generated.  I would like for the width of the image to be as wide as the text of infoBox.informationText Dynamics

    Any suggestions?

    Also the path to each image corresponds to a variable called calledMarkerContent how could put the img src is equal to the variable called calledMarkerContent?

    Hello J,

    If you use a component to scroll, you can eventually use the ScrollPane for movieclips instead.

    The Adobe AS2 components reference:

    " The ScrollPane component to view video clips, the JPEGs and SWFs in a scrollable area. Using a scroll pane, you can limit the amount of space occupied by these types of media screen. The scroll pane can display the content loaded from a local drive or on the Internet. You can set this content during programming and execution with ActionScript. "page 1093 "

    This way you could integrate the area of dynamic text (for your text) both the movieclip (which has the text for your image inside box) that you can then scale them both in an another movieclip (parent), you use the ScrollPane component on.

    This way your text in dynamic text field dimensionnera not, the image can be scaleed to the size of what ever you like (dynamically) and if the two are sitting in a parent movieclip, this parent movieclip may have a ScrollPane component on it.

    How does that sound?

    Best regards

    Chris

  • Load the Image of the URL entered in the dynamic text box

    I have an area of dynamic text (image_in) to receive a URL entry of an image to be loaded into a clip (peak) when you press a button (b_load).

    I can't make it work, the code seems pretty simple:

    var image_url:String = image_in.text;

    b_load.addEventListener (MouseEvent.CLICK, Load_URL);

    function Load_URL(event:MouseEvent):void

    {

    var i = new Loader();

    i.Load (new URLRequest (image_url));

    pic.addChild (i)

    }

    This code gives me: #2044 Error: Unhandled IOErrorEvent:. Text = Error #2035: URL not found.

    This code works when I declare the var as a URL:

    var image_url:String = " " http://website.com/image.jpg ";


    What is the difference if I go http://website.com/image.jpg in the dynamic text field? What's wrong?

    Any help would be appreciated, thanks!


    You declare the image_url variable after the dynamic text? If this isn't the case, then the value of this variable will be an empty string. Set the variable inside the function declaration, and it should work as expected.

  • Problems with the formatting of the dynamic text box

    I'm under the questions with the help of HTML formatting for a dynamic text field. I know these are weird and I can't understand how to get the formatting right.

    I have on my scene a dynamic text called «content_txt' inside a movie clip instance «content_mc» box When he enters the frame, I just broke down the "content_mc" of the alpha of 0 to 100 with a scenario animation. So that this works, I have to incorporate the police in my text field 'content_txt '. However, the only way I get get the HTML formatting to work is if I do not embed fonts.

    The dynamic text field is configured to render as HTML. In my layer actions, I put the text:

    this.content_mc.content_txt.htmlText = "<b>Hello world,</b> it is me again."

    In summary:

    1. If I do not embed fonts, the alpha fade does not work but HTML formatting doesn't.

    2. If I incorporate police, the alpha fade works but HTML formatting does not work.

    How to solve this? It's driving me crazy!

    then you're not g-d instructions.

    You should have two textfields.  the one on the boards that you started with and that incorporates your normal font (not bold).  and a slide that takes the same family of fonts with license "BOLD".  Repeat the test.

  • Roll on the dynamic text boxes

    When I have a dynamic text box in a movie, and I want the movie she buttonMode. The hand symbol is converted to an arrow, even if the text is not selectable. Is there a way to get around this? It is not to do with a simple button... so I can put the text into a single button, but I expected something a little more forward.

    I do not see this behavior, but you can use the mouseChildren property to disable the children of your movieclip to respond to the mouse.

  • How to make a button that controls the value of a dynamic text box

    Hey guys

    I wanted to do a manufacturer Bill... sort for me. I have some products Let tell and I click on them, and clicking on these buttons, I'd give to see the numbers add up in a text box dynamics and if I could keep track of the value inside the box.

    Lets say we have 2 buttons. by clicking on the 1st and the 2nd I want to get 12 in the text box and clicking on the 2nd and 1st I would get 21 in my box.

    Is this possible atall with AS2?

    Please guide me through

    Thank you.

    ensure that:

    TF. Text =""; TF is your textfield that shows the results of your movieclip button clicks

    for (var i: Number = 0; i<>

    This ["btn_" + i] .ivar = i;  Use the movieclip buttons btn_1, btn_2,.., btn_9

    This ["btn_" + i] .onRelease = btnF;

    }

    function btnF (): Void {}

    TF. Text += this.ivar;

    }

  • Get the width of the dynamic text boxes containing different letters

    I have boxes of dynamic text next to each other, each showing a letter and the creation of a Word, any letter English ABC. Given that some letters are wider, how could I get the width of each letter to figure out spacing between them?

    Thank you!!

    You can use the textWidth of textfield property to get the width of the text inside.

  • LoadMovie give the error message in the dynamic text box

    I have a movie of controller that bring in other films.

    In any film, I have this code:

    var myStyle:TextField.StyleSheet = new TextField.StyleSheet ();
    myStyle.load ("kcm.css");
    copyHolder.txt.styleSheet = myStyle;

    copyHolder.txt.multiline = true;
    copyHolder.txt.wordWrap = true;
    copyHolder.txt.html = true;

    var history: XML = new XML();
    story.ignoreWhite = true;
    Story.Load ("Director.html");
    story.onLoad = function () {}
    _root.copyHolder.txt.htmlText = history;
    }

    that works fine in itself, but when I import the movie into the main movie I get this: _level0.buttClip.copyHolder.txt where the HTML text should be. I tried variations of the last line, but nothing seems to work. Any ideas?


    Well hit me upside the head. Publish the movie when you make changes allows, just so accustomed to saving a file to see the changes. The response was to add "buttClip" to the last line, according to the message.

    I have a movie of controller that bring in other films.

    In any film, I have this code:

    var myStyle:TextField.StyleSheet = new TextField.StyleSheet ();
    myStyle.load ("kcm.css");
    copyHolder.txt.styleSheet = myStyle;

    copyHolder.txt.multiline = true;
    copyHolder.txt.wordWrap = true;
    copyHolder.txt.html = true;

    var history: XML = new XML();
    story.ignoreWhite = true;
    Story.Load ("Director.html");
    story.onLoad = function () {}
    _root.copyHolder.txt.htmlText = history;
    }

    that works fine in itself, but when I import the movie into the main movie I get this: _level0.buttClip.copyHolder.txt where the HTML text should be. I tried variations of the last line, but nothing seems to work. Any ideas?

    Well hit me upside the head. Publish the movie when you make changes allows, just so accustomed to saving a file to see the changes. The response was to add "buttClip" to the last line, according to the message.

  • CP4: Nattering add to the input text box button submit

    Is this possible? I want the button submit to act in the same way as a click box.

    Thanks in advance.

    Steve

    DOH!  You are right.

    Go with the legends of success or failure is a better way to go.  Just need to ensure that captions are not set to fade.

    However, it would be a good thing to have as a feature for COP6.

    I find that Cp does not have certain basic features round when it comes to easily trigger sounds.

  • get rid of the area around the dynamic text box?

    I want to make my text 'grabable' on my swf as a way to do it, I was thinking the whole dynamic of the text, is it a good idea? If so, how can I do so that the box appears around the text? Thank you, Raphael

    The text should not be dynamic to make 'Selectable' - is an option to the widow of properties. Click your text and in the Properties window, click the 'Selectable' - it's an Arelatifs capital and b small nail beside him: Ab (the b is white in a black box). The text has a box around it, because you did have it's icon two courses on the right of the icon 'selectable '. Click this icon to remove the box.

Maybe you are looking for