ActionScript 2.0 :: F8 - Formatting Number To Money?
Sep 5, 2007What is an easy way to format a number to money? I want to add commas for every thousand, and force the decimal to 2 digits.
View 4 RepliesWhat is an easy way to format a number to money? I want to add commas for every thousand, and force the decimal to 2 digits.
View 4 RepliesI want to use a TextFormat object as an argument to a function that uses its properties to generate a css style object to use to style some text. My reason for doing this is that I also use the TextFormat object directly to format som other non-html formatted text.
This all works fine except for the color property.a TextFormat object takes a color reference in the format 0xFF0000a style object takes the color ref in the format "#FF0000" I need to read the color property of the TextFormat object and reformat it to the hash prefix form that the stylesheet understands. I can't seem to get this to work though.
First off, if I try to access the textformat color property flash seems to convert it to a decimal number somehow, which does not seem terriby helpful. Secondly, even if I use bitwise operations to turn the number into r.g.b. values, I don't know how I can then turn those into a hash prefixed string of the hexadecimal value.I'm working in Flash 8 pro, AS 2.0 (using SE|PY), on windows XP
var score:int = 100;var money:int = 200; btnfeed.addEventListener(MouseEvent.MOUSE_UP,feed);function feed(event:MouseEvent) { if ((score == 200)&&(money <= 0)) { score += 0; money -= 0; Cash.text = String(money)
[code].....
i want it to add $5 to the total amount of money, but the problem is, is that my code doesnt work, in the frame actions i have:
[Code]...
If we made a game in flash that has online, would it cost money to have the online server or something?
View 3 RepliesI create this : function money () {total++;income.text=total;} and a button. income.text is added by 1 each time the button is onRelease. I need only 1 point to be added no matter how many time the button is pressed.
View 8 RepliesI'm working on a game where I need to have a variable for money and a variable for Health, or in my case, I call it Energy. Most tutorials I'm finding are in AS2 and the AS3 ones are not this basic thing that I need. Basically, I have an item shop with a pizza button, and in their respective dynamic text fields, you can see the status of your Energy and your Money. So, let's say the person clicks the pizza to buy it, Flash will subtract 10 (for 10 bucks) from the person's total money value and add 15 for total Energy points.This is what I've written so far and I'm writing all the script in Flash, not outside using classes or packages. I can tell already that I'm missing something. How do I write it so that Flash knows to add 15 Energy from that Pizza button and can I update the values of the variables and kick off that mouse event in the same function?[code]
View 2 RepliesI have a program that adds values together. I need the variable to display with 2 decimal places. Right now $1.50 would look like: 1.5
How do I make Flash display the zero automatically?
I am currently writing a Flash AS3 website where users upload file(s), I take payment, and when payment has been received, the files are emailed to me to be processed, all within the same SWF.
I can get the upload and email part all working nicely. My question is about the payment part. Ideally, I would like to use Paypal but the critical point is that payment and then confirmation must all be within the same SWF. If Paypal directs to another page and returns to a different URL (or the same one for that matter), the SWF would have ended which would be a problem for the emailing part.
Is there a solution for Paypal to take money within the same SWF and just allow further functions to run on confirmation?
I was wondering if anyone has attempted in profiting off of using Flash to make useful applications? I started the website [URL] which the products are both made in flash (one of the members here coded it for me). I am just interested in seeing if anyone else has tried selling flash as software? If your wondering I have sold about $450 worth of the basketball/football one and just started the first aid one
View 1 RepliesI have a simple money script [for my game] and I want to say, ok when I walk over a coin, I want it to add $5 to the total amount of money, but the problem is, is that my code doesn't work, in the frame actions I have:
Code:
money = 0;
and in the hitTest for the coin I have:
Code:
if (_root.dude.hitTest(_root.coin) {
_root.money +1
}
When i try to make like a shop game, i create a dynamic text and set it's variable to "money". When i test it, everything works fine. But when i try to add a static/dynamic text close to it, the text won't be visible.It's kinda hard to explain, so here's a preview:
The "normal" version:
megaswf.com/serve/1044057
The other version:
megaswf.com/serve/1044059
I am creating a roullete wheel type game. I am having a problem updating a total when I call a function to add the variables. I have a variable "myMoney" that is initialized at 50. After I spin the wheel, I want to add the bets to the current value of "myMoney." I have another variable, "slot1Bet" that is initialized at 0. I am trying to call the function updateMoney(myMoney) which than should take the current value of "myMoney" and set it equal to itself plus the slot1Bet. The trace statement for "money equals...." returns 500 and so does the updateMoney function.m so the correct value is returned based on the slot bet.
_global.myMoney = 50;
_global.slot1Bet = 0;
trace("updated money equals " + updateMoney(myMoney));
[code].....
Dear Guys I Want To Generate A Random Number Between 2 Number BUT Without Generating 2 Same Number I Mean If For Example Already Generated Number "2" Next Time Did Not Generate It , Is There Any Solution
View 5 RepliesI Want To Generate A Random Number Between 2 Number BUT Without Generating 2 Same Number I Mean If For Example Already Generated Number "2" Next Time Did Not Generate It,
View 4 RepliesInside my code i have some variables declared as Numbers, and i get some others from an external source; these variables can either be Numbers or String representation of Numbers. Now, i have to implement some equality controls on these variables, and since i don't know in that moment which type are them of, i'm converting all of them to Numbers (i don't need and neither want to compare strings) via the Number() function which accepts either Numbers or Strings as an input. These controls can compare 2 single variables or a variable and a sum (or subtraction) of other variables, for example:
[Code]....
I'm trying to create a shuffle button for my mp3 player. I don't want it to repeat any song in the xml playlist until all the songs are played. Is there to display a random number on the click of a button, without repeating any number in the array until all the numbers in the array are used?
View 9 Repliesmy functions in this fla i have. I use the function to create a random number and the char move accordingly depending on the number.
View 4 RepliesSO, I want to do a very simple program, and I have no clue how to even get started. This is what I need to do. Several Different boxes to put something into. I Have Done That, I can type into them. Their instance names are
Box1
Box2
Box3
Heres what I have no clue on how to do though, completely lost. Box 1 needs to have the value psr.
[Code]...
I would like to know is there any limitations in flash textarea like the number of lines it can have or the number of bytes it can have. iam opening a text file using php in textarea, where all the contents of the files are not getting loaded in the textarea. If it is there then how to increase its size, is it same thing in flex?
View 1 Repliesexplain this...
var i:Number = 7059467160524343000;
trace(i);
i = 7059467160524343700;
trace(i);
i = 7059467160524343999;
[Code]...
I need to be able to round a given number to an even number that is divisible by 10, 100, or 1000 depending on it's size.
For example:
4 would be 0 -- Round to nearest 10
6 would be 10 -- Round to nearest 10
54 would be 50 -- Round to nearest 10
[code]....
I've been scanning the WWW for a formula to do this in as3, but have come up empty handed.
ActionScript Code:
var numbers:Array = [];
var newNb:Number;
var max:Number = 81;
[code]...
lets say that when you click on a button the variable number goes up 1 or 2 but it picks it randomly
how would i do it
[Code]...
i want to make random number between 1 to 10 without repeat number twice or more i use this function to make random
function getRandomNumber(min:Number, max:Number):Number
{
var randomNumber:Number = Math.round(Math.random() * (max - min) + min);
return randomNumber;
}
getRandomNumber(1, 10);
If I take a swf, and run it through swfdump
swfdump.exe -abc file.swf > ABC.txt
One the first run I may get some output in ABC.txt like this
ObjectConfig.as$60
And on a subsequent run of the same SWF get a different output
ObjectConfig.as$61
What is the meaning of the number after the $ ?
how to genrate serial number for datagrid according to the number of rows?
View 1 RepliesI have a problem with this code :
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"[code].....
I get the right number when I click on only '+' or only on '-'But if I click '-' until 0.7 and '+', it stays at 0.7
The same append when I click '-' until 0.9 when '+', it stay to 0.8. Why? How can I do to increment or decrement a Number by 0.1?
i got a input text , how do i set some number if they input the right one?like i want (2,4,6,8,10) to be true if they input the the same number ,i want boolean to be true how i going to do this?
View 2 Repliesthere is any method to check if a number is a decimal number or not? i searched in the help-panel, but didn't found something.
View 6 Replies