How to turn 1000000 into 1.000.000?

FLASH

    Next

  • 1. Fade out FLV?
    Hello all, I am trying to fade out an FLV file that is playing with a button object? Does anyone know if this is possible? I need to fade out the audio/video...and go to another frame... Appreciate any help you can give.. thanks, john
  • 2. Customize ComboBox with Gradient Background
    Hello, Does anyone out there know how to skin a ComboBox with a gradient in the background of the text area, using the Halo Theme? I've looked everywhere in the class files for instances of the DrawRoundRect function to see where the fill color is determiend, but can't seem to find where the rounded rectangle is actually drawn. Any help would be appreciated. TIA Thanks, Mike
  • 3. Wordwrap
    I'm trying to create a multiline textbox in actionscript. See code below. The text I'd like to wrap is "this.description" a string read in from an XML node that contains linebreaks. However, Flash truncates text after the linebreaks, and will also not wrap long lines of text. But when I do a trace() on the text at the end, it's returning the entire string correctly. Any suggestions? Thanks in advance. _____________ this.textBox2=this.createTextField("tb2", this.getNextHighestDepth(), this.screenWidth/2, this.shell._y+this.captionOffset+boxFormat1.size*2, this.screenWidth/2, this.captionSize); var boxFormat2:TextFormat = new TextFormat(); boxFormat2.color = 0xCCCCCC; boxFormat2.align="left"; boxFormat2.font="embeddedArial"; boxFormat2.size=this.captionSize-12; this.textBox2.embedFonts=true; this.textBox2.multiline = true; this.textBox2.wordWrap = true; var tempText:String = clean(this.description); this.textBox2.text=tempText; this.textBox2.setTextFormat(boxFormat2); trace(this.textBox2.text);

How to turn 1000000 into 1.000.000?

Postby Danilo Fiocco » Mon, 23 Aug 2004 23:46:31 GMT

Im creating a swf where users enter some numbers to be processed in a formula, 
but the results always show huge numbers like 168460123184, making them hard to 
read, so I want to find a way to add a "." (a dot) every 3 numbers, so they 
would be easier to read...
 and I dont have a clue of how that can be done :(

 thanks!

 PS: I chose to use dots instead of commas cos here in Brazil we use dots to 
separate hundreds from thousands and so on....


Re: How to turn 1000000 into 1.000.000?

Postby abeall » Tue, 24 Aug 2004 06:26:01 GMT

Hmm, that's going to take some thought. I'll try some things. Hopefully someone 
who's already done this will share, but I think you will need to convert your 
Number.toString() the use .slice and .concat in a loop to fix it up. I'll see 
if I can't fix up a function, would be useful to have on-hand.

 PS - So if you use . then do you use , for decimal notation? ;)


Re: How to turn 1000000 into 1.000.000?

Postby abeall » Tue, 24 Aug 2004 07:21:56 GMT

Here, this works(see attached code). You can change the increment point from 
every 3 characters to whatever you want, if you would ever want to use it for 
another purpose.

 It turned out a little annoying, because it seems theres no way(at least in AS 
1) to simply insert a character at a certain point, I had to split() then put 
into an array, then finally join() the array... but at any rate you see the 
basic method of looping and such.

 HTH

 I may try to simplify it a bit later.

 strSeperator_func = function(num,delimiter){//takes long number(or string) and 
incrementally inserts a character
 	num=num.toString();//convert Numbers to String
 	num_arr=new Array();//create blank array
 	for(i=1 ; i<=Math.floor(num.length/3) ; i++){//loop through length of String 
divided by 3
 		n1=num.slice(num.length-(i*3),num.length-(i*3)+3);//get 3 char sections, 
starting at right, moving left
 		num_arr.push(n1);//add new section to array as new element on end
 		n2=num.slice(0,num.length-(i*3));//get leftover characters
 	}
 	if(n2.length>0){//if there are leftover characters
 		num_arr.push(n2);//add leftover characters section to array as new element 
on end
 	}
 	num_arr.reverse();//reverse(because they were added from right-to-left to 
left-to-right
 	num=num_arr.join(delimiter);//add all array elements(3 char sections + 1 
leftover section) together as new 'num' String
 	return num;//return 'num' to where function is called
 }

 //sample usage #1
 myNumber=strSeperator_func(35498673549867,",");
 trace(myNumber);
 //sample usage #2
 myNumber=1000000
 myNumber=strSeperator_func(myNumber,".");
 trace(myNumber);


Re: How to turn 1000000 into 1.000.000?

Postby rlc5611 » Tue, 24 Aug 2004 07:35:36 GMT

Well that puts me to shame but I had made this if it helps

 http://www.**--****.com/ 

Re: How to turn 1000000 into 1.000.000?

Postby abeall » Tue, 24 Aug 2004 08:06:40 GMT

hi rlc5611,
 I don't have MX-04 so couldn't open the file, but I would love to see the code 
involved...I'm trying to figure out a way to make this simpler and easier to 
modify, any different angle/aproach would be useful; thanks!

 PS - I just tried a slightly different version, see attached code. A tad 
simpler and easier to understand, it's the one I will use.

 strSeperator_v2_func = function(num,delimiter){//takes long number(or string) 
and incrementally inserts a character
 	num=num.toString();//convert Numbers to String
 	pos=num.length;//var 'pos' is used to add a seperator at
 	while(pos>3){//while loop, starts at String right moves to left
 		pos-=3;//move left to next seperator point
 		n2=num.slice(pos,num.length);//get all characters after seperator point as 
new substring
 		n1=num.slice(0,pos);//get all characters before seperator point as new 
substring
 		num=n1+delimiter+n2;//combine before-substring + dilimiter + after-substring 
as new 'num' String
 	}
 	return num;//return 'num' to where function is called
 }

 trace(strSeperator_v2_func(5679945,","));


Re: How to turn 1000000 into 1.000.000?

Postby abeall » Tue, 24 Aug 2004 08:10:12 GMT

And while I'm here, here is the second version taylored to your 
specifications...

 strSeperator_Fiocco_func = function(num){
 	num=num.toString();
 	pos=num.length;
 	while(pos>3){
 		pos-=3;
 		n2=num.slice(pos,num.length);
 		n1=num.slice(0,pos);
 		num=n1+"."+n2;
 	}
 	return num;
 }

 trace(strSeperator_Fiocco_func(1000000));


Re: How to turn 1000000 into 1.000.000?

Postby mandingo » Tue, 24 Aug 2004 09:09:36 GMT

Hi,

 Byron Canfield (for those that remember him) provided a web site with loads of 
downloadable .fla's ... currency conversion was one of those... so if you don't 
want to re-invent the wheel, take a look at this page

  http://www.**--****.com/ 

 allows you to determine the separator, the currency format and the decimal 
places...

 I hope that helps,
 cheers,


Re: How to turn 1000000 into 1.000.000?

Postby rlc5611 » Tue, 24 Aug 2004 12:47:19 GMT

abeall,

here it is

Re: How to turn 1000000 into 1.000.000?

Postby Peter Blumenthal » Tue, 24 Aug 2004 19:50:18 GMT

here's one I made earlier:

 http://www.**--****.com/ 

this adds commas rather than stops, and also adds 2 rounded decimal places
for currency. Pretty well commented tho, so should be easy to adapt.



Re: How to turn 1000000 into 1.000.000?

Postby Danilo Fiocco » Tue, 24 Aug 2004 22:10:01 GMT

Holy cheetos! So many replies!

 Thanks for the great help! U have all saved my life and for that I'm eternally 
grateful! ; )

 I'm at work right now (10am here), as soon as I finish work I'll give these a 
try...again...than you!


 abeall
 thats it...we use commas for decimal notation...so one million dollars would 
be  US$ 1.000.000,00 down here...


Similar Threads:

1.10.000+ rows

I'm a VB6 / VB.Net developer, looking into flash as an interface
engine.
I figured skinning is all very nice, but why not take it a step
further.

My main concern, before venturing any further, is how to display
datagrids (listviews) with 10.000+ rows (listitems), complete with up
to 10 columns (subitems).
Usually displaying datasets this big would just be bad design, but
this app is used for bulk data manipulation. So there you go.

I doubt flash can deal with these kinds of numbers directly, so I'm
wondering if there are any work-arounds like virtual datagrids
(virtual listviews) to get the job done.

Any ideas?

2.Creating 30,000+ flash files

I need to create a large amount of flash files, based on one template - each new file would involve changing out the font for another before exporting as SWF. Is there an easy way to batch process this group of files? I originally had looked into Applescript (I'm on Mac OS X) but didn't see much Applescript support in the Flash MX (pre-2004) application.

Any help would be greatly appreciated.



3.300,000+ XML Nodes

Hi all

 // begin sarcasm
 So I have this little XML file, with 300,000+ nodes (318,006 lines in this XML 
code to be exact).
 // end sarcasm

 Right now, I'm loading this monster in. When I finish loading, I want to take 
all these nodes and save them to an Object, so I can easily reference them 
later.

 The way I'm doing this now is with a for-loop, which in the end, gathers about 
5000 nodes, each with anywhere between 10-30 children.

 As best as I can tell, I have gotten this working successfully to this point. 
The problem I'm having now is that with this much data, Flash chokes on it a 
bit. So after my load sequence, there's about 5 or 6 seconds where nothing 
happens, then everything suddenly works.

 Now granted, this test XML I'm using is a worse-case-scenario. And I think 5 
or 6 seconds isn't bad. But I'm on a fairly fast and new machine and I'm 
worried about a lesser machine's performance. 

 So is there a better way to do this? Should I not use a for-loop? Should I not 
save this data much data to an Object?

 Any suggestions are welcome.

 Thanks
 Chris 

4.Given "2008-06-01 13:02:10.000"

Hi everyone,

 var date_time:String = "2008-06-01 13:02:10.000";

 How can I get the date (2008-06-01) out ?  for example date = 2008-06-01
 How can I get the hour (13) out ? for example hour = 13
 How can I get the minute (02) out ? for example minute = 02
 How can I get the second (10) out ? for example second = 10

 Thanks,
 May

5.can FMS support 1, 000 users at same time

6. Given "2008-06-01 13:02:10.000"

7. I'll buy houses and a flash car, says yob awarded ?67,000

8. Flash in Kiosk Mode - turn off / turn on launch schedule



Return to FLASH

 

Who is online

Users browsing this forum: No registered users and 87 guest