PLEASE HELP!  Converting numbers into real words

I am faced with a problem. I need to create a prorgram that will convert a number ex. 156 into the word "one hundred fiftysix" This program will need to handle numbers up to 999 999 999.
If someone has a program similar to this or is willing to assist a newbie programmer, your assistance would be appreciated.
Also source code is preffered, prefferbly with c as the console.
Thanks again

Here is my most up to date code
I also forwarded you a copy of my code
import hsa.Console;
public class ConvertingWordsToNumbers
private static int convertingFromOneToNineteen (String numberString)
String oneToNineteenInWords [] = {"", "one ", "two ", "three ", "four ", "five ", "six ", "seven ",
"eight ", "nine ", "ten ", "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ",
"sixteen ", "seventeen ", "eighteen ", "nineteen "};
int oneToNineteenInNumbers [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
int total = 0;
//Checking for each word and adding it to each total
for (int pos = 1 ; pos <= oneToNineteenInWords.length ; pos++)
if (numberString.indexOf (oneToNineteenInWords [pos]) >= 0)
total += oneToNineteenInNumbers [pos];
numberString = numberString.substring ((numberString.indexOf (oneToNineteenInWords [pos])));
return total;
return total;
private static int convertingFromTwentyToNinety (String numberString)
String twentyToNinetyInWords [] = {"", "", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy",
"eighty", "ninety"};
int twentyToNinetyInNumbers [] = {0, 0, 20, 30, 40, 50, 60, 70, 80, 90};
int total = 0;
//Checking for each word and adding it to each total
for (int pos = 1 ; pos <= twentyToNinetyInWords.length ; pos++)
if (numberString.indexOf (twentyToNinetyInWords [pos]) >= 0)
total += twentyToNinetyInNumbers [pos];
numberString = numberString.substring ((numberString.indexOf (twentyToNinetyInWords [pos])));
return total;
return total;
public static void main (String [] args)
Console c = new Console ("ConvertingWordsToNumbers");
//Variable Declaration
String numberString, millions, thousands;
String keyWords [] = {"million", "thousand"};
//User Input
c.println ("Please enter the number (in words) that you wish to convert: ");
numberString = c.readLine ();
numberString = numberString.toLowerCase ();
//Sectioning the millions and thousands
if (numberString.indexOf (keyWords [0]) > 0)
millions = numberString.substring (0, (numberString.indexOf (keyWords [0])));
c.println (millions);
c.println (convertingFromOneToNineteen (millions) + convertingFromTwentyToNinety (millions));
if (numberString.lastIndexOf (keyWords [1]) > 0)
thousands = numberString.substring ((numberString.indexOf (keyWords [0]) + 8),
(numberString.indexOf (keyWords [1])));
c.println (thousands);
c.println (convertingFromOneToNineteen (thousands) + convertingFromTwentyToNinety (thousands));
else if (numberString.lastIndexOf (keyWords [1]) > 0)
thousands = numberString.substring (0, (numberString.indexOf (keyWords [1])));
} // main method
} // ConvertingWordsToNumbers class
thanks again

Similar Messages

  • UFL to convert numbers to Turkish words

    Happy New Years to everyone and all that stuff.
    I have had a look through a couple posts that refer to Turkish characters and a am hoping my idea of
    creating a UFL that converts a number (passed in as a string) and then outputs the Turkish words for
    the number, is possible or atleast on the right track.
    This is my Turkish.properties file
    0=su0131fu0131r
    1=bir
    2=iki
    3=üç
    To get Eclipse to accept these characters I tried setting the encoding to UTF-8 but eclipse said
    UTF-8 conflicts with the encoding defined in the content type (ISO-8859-1)
    Do you with to set it anyways?
    Which I did and it seemed to keep the correct format for all that characters
    I then created my UFL to just take a str_Key which is the number and the resBundleName (Turkish)
    and I output the correct string. Just for testing I only worked with single digit numbers.
    I then made my UFL avaliable to all my reports and created a test report.
    The only problem was when previewing the output, it was no longer the correct UTF-8 characters
    but the incorrect ISO-8859-1 characters ( I assume its this encoding as I tested what happens if
    I save my properties file in that encoding and they seem the same messed up characters)
    I have tried setting the "Text file encoding" for the report (right click - properties) but that makes
    no difference.
    So my question is:
    Is it possible to create a UFL that will convert a number to Turkish words?
    If so, where am I going wrong, is there another encoding setting I need to set?
    Will I have future problems when trying to export to PDF?
    Does anyone else have another idea on how best to convert numbers to Turkish words
    if using a UFL and resource bundle is not the best idea?
    Sorry thats 4 questions not 1 but hey, its my first post of the new year
    Thanks all.

    Thanks Ted,
    I did a simple test (which I really should have done before) where I placed Turkish characters in a report
    formula and it displayed the correct characters, so that confirms what you said in that its not the report
    error, but rather on the java side of things.
    I will try fiddle with things and work out how to get the Java side of things accepting the Turkish characters.
    I might come back here to ask a few questions if I get stuck, so will leave this open as it still deals with the topic.
    Thanks again
    Darren
    Right Ted, thanks for that advice, I have managed to get correct characaters using the \u0131 format
    for example
    0=\u0131
    1=\u00D0
    2=\u00D0\u0131
    Now the big question is where can i find a list of all the Unicode escapes (\u....) for Turkish equivilant?
    Even though this is a real pain, to convert from English to Turkish to Unicode, would have thought
    there would be an easier why, but this does do the job.
    So I will continue looking for a list of all Unicode numbers (any body know if there is a app out there
    that can do it all for  me??)
    Edited by: Darren Jackson on Jan 6, 2009 1:36 PM

  • Is there a way to edit a PDF file without converting it into a word document?

    Is there a way to edit a PDF file without converting it into a word document?

    Then you posted in the wrong forum...
    At any rate, you can use the Edit Text & Images tool (under Tools - Content Editing) to make changes to the file. You'll need to be a bit more specific about what you want to change if you want more detailed instructions.

  • Convert numbers into words

    i work on release 11i application and converts some reports to run with xml publisher
    i want to convert a total field that exist in po report to words it seems to convert number into words isthat possible i tried to make this in oracle reports and it run successfully but there is a problem when converting that report to run with xml publisher .
    any help will be approtiated.

    Use ap_amount_utilities_pkg.ap_convert_number
    E.g.
    SQL> select ap_amount_utilities_pkg.ap_convert_number(trunc(12345678)) from dual;
    AP_AMOUNT_UTILITIES_PKG.AP_CONVERT_NUMBER(TRUNC(12345678))
    Twelve million three hundred forty-five thousand six hundred seventy-eight
    Gareth

  • Hi All, please help me...Real time cube planning layout creation...

    Hi All,
    Could you help me on below process please.
    Iam working with BI7.0. I have real time cube (daily sales) and user need to access and update/add records accordingly.
    So for this real time cube I have to create planning layout with the data. User can see that data and update/add.
    I dont how to create planning layout (i heared that rsplan) how to show the data.
    Also I need some help on ABAP, I need to map some fields from a table.
    Actually from a flat file iam uploading data into ODS. In ODS has 3 more extra infoObjects.
    Ex: Shopping mall code, tenent number and outlet number info i have to pick contract number from table with routine and pass that contact number into ODS one field. It means Contact number will not come from flat file, thats what need table and routine.
    So for that I have to create one table (SE11) with all the information. and i have write routine.
    I have to read flat file 2 fields( like A and B) and check the value in a table and get the value C and put into ODS one field. I have to do this with routines.
    In the table have A, B and C values. Table also I have to create. so also please can u tell me some steps.
    Could you please help on this. Also with process chains for this.
    Thanks in advance!
    anil

    Hi Anil,
    If you go to RSPLAN there you can go to Portal link (it must be configured properly in system)
    In portal there will be wizard where you can easily go step by step and create planning functions and sequences like below:
           1.      You choose the appropriate InfoProvider.
           2.      You create one or more aggregation levels.
           3.      You create one or more filters.
           4.      You create one or more planning functions.
           5.      You create a planning sequence.
           6.      You test the planning model.
    which is clearly explained in below link
    http://help.sap.com/saphelp_nw70/helpdata/en/43/1d2440301a06f4e10000000a422035/frameset.htm
    after doing this you can create a query on aggregates you have created above and then make query input ready i.e planning enabled for keyfigures you want like mentioned in below link:
    http://help.sap.com/saphelp_nw70/helpdata/en/43/1d023a41130bd5e10000000a422035/frameset.htm
    then you can run query in Analyzer and save it as a work book after proper drilldown which can be used as template.
    Hope you understood basic thing, as you going on doing u will know clearly every thing.
    Ravi

  • Please help, my "Numbers" won't open and when I looked up in my console, I see this message :13-03-04 1:18:19 PM     Numbers[601]     Incompatible applications: app=com.apple.iWork.Numbers, targetApp=com.apple.Safari

    I tried to  open my "Numbers" application today and it won't open saying it has "closed unexpectedly". When I looked up the messages in the console, this was there.  Please help!

    If you purchsed from the App store then delete the application and reinstall

  • Please help convert 8.2 vi to 8.0 (urgent)

    Hi all,
    Could anyone please help me convert the attached vi to labview 8.0. Thanks
    Attachments:
    Google_Earth-LV.llb ‏199 KB

    Try this...
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Google_Earth-LV_80.llb ‏197 KB

  • How to convert pdf into ms-word

    How to convert pdf to ms-word?

    Here's one I tried:
    PDF Converter
    And one I didn't,
    PDF2Office Personal
    Repeat after me, "google is your friend" (at least for searching).

  • Please help - cannot get into any of the icons, when i touch the icon it makes a square round it but won't go into it. Tried restarting and rebooting it but no change.

    Please help. Since yesterday whenever i try to use my ipod touch, all the icons won't let me enter the app. Every one whenever i touch it just shows a faint square round the icon, and it won't access the item. Tried re-starting & re-setting but it hasn't fixed it.

    Are some of your accessiblity features activated?
    Each accessibility feature can be turned on or off in Accessibility settings on iPod touch. You can also turn some features on or off in iTunes when iPod touch is connected to your computer.
    Turn on accessibility features using iPod touch: Go to Settings > General > Accessibility.
    Turn on accessibility features using iTunes: Connect iPod touch to your computer and select iPod touch in the iTunes device list. Click Summary, then click Configure Universal Access at the bottom of the Summary screen.

  • Need help converting PDF to a word document!

    I paid to have the ability to convert a PDF document to a Word document.  When I click on "convert" the area turns gray, and nothing happens.  Once before, the document converted, but it did not come out the same.  For example, the charts did not convert at all.  Any help will be appreciated.

    You need the ExportPDF Forum

  • Converting HTML into a Word document

    Hi all,
    I have a JSP whose content type is set so that the HTML it produces is opened up in Word. Now this works fine until images come into the equation, as these images must lie somewhere in order to be referenced from the HTML code. As this document must be 'stanalone', booting up the HTML in Word and simply changing the file extension is no good as it is still HTML under the hood.
    What I therefore would like to do it generate a Word document from this HTML that is independent in the fact that it 'holds' these images within itself and does not rely on external resources. Does anyone know how I can achieve this?
    I have looked into Jakarta POI and have written this off as an option because 1) it is still in development and 2) there is no documentation or examples of how to use what is already there. I am assuming someone has come across this problem before and knows of a solution out there that I could use.
    Many thanks in advance!

    HI,
    Thanks all for your replies! Unfortuantely it can't be PDF as the creator will need to edit it before the document is complete. I have actually looked into generating an RTF document instead, but the example I tried seemed to loose the image data. Unfortuantely I know nothing about RTF and so kind of gave up on it :(
    Here is the code I used:
    import java.io.ByteArrayOutputStream;
    import java.io.StringReader;
    import java.io.IOException;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.StyledEditorKit;
    import javax.swing.text.rtf.RTFEditorKit;
    import javax.swing.text.html.HTMLEditorKit;
    public class FormatConverter {
         private HTMLDocument tempHTMLDoc;
         private HTMLEditorKit htmlKit;
         private RTFEditorKit rtfKit;
         public FormatConverter() {
              tempHTMLDoc = new HTMLDocument();
              htmlKit = new HTMLEditorKit();
              rtfKit = new RTFEditorKit();
         private String fudge(String strText) {
              String strResult = "";
              StringReader reader = new StringReader(strText);
              try {
                   tempHTMLDoc.remove(0,tempHTMLDoc.getLength());
                   htmlKit.read(reader,tempHTMLDoc,0);
                   ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                   rtfKit.write(byteArrayOutputStream,tempHTMLDoc,0,tempHTMLDoc.getLength());
                   strResult = byteArrayOutputStream.toString();
              catch(IOException ie){}
              catch(BadLocationException ble){}
              return strResult;
         public static void main(String args[]) {
              FormatConverter conv = new FormatConverter();
              String strRTF = conv.fudge("<P><IMG src=\"http://intratestgbr/announcements/images/1093429553065.jpg\"></P><P> </P><P>50 <STRONG>pounds</STRONG>, <FONT color=#0000ff>wow</FONT></P>");
              System.out.println("RTF: '"+strRTF+"'");
              strRTF = conv.fudge("<html><head><p class=default><span style=\"color: #000000\">Description </span><span style=\"color: #000000\"><b>with</b> </span><span style=\"color: #000000\"><i>some</i> </span><span style=\"color: #000000\"><u>formatting</u> </span><span style=\"color: #000000\"></span></p></head></html>");
              System.out.println("RTF: '"+strRTF+"'");
              System.exit(0);
    }The output I got from this was:
        \rtf1\ansi
            \fonttbl\f0\fnil Monospaced;
            \colortbl\red0\green0\blue0;\red0\green0\blue255;
        \par
        \~50 pounds, \cf1 wow\par
    }Like I said, when I open the RTF output in Word, everything is fine apart from the missing image. If one of you very nice people could point me in the right direction of a way to convert it to RTF instead while still maintaining the images this would certainly be a very acceptable solution and I would be very grateful :)
    Many thanks again!

  • Please help converting filenames

    Thanks a lot for your help
    I am trying to set the creation date as the new file name in series of files within a folder
    I try to modify various scripts I found for my purpose
    [applescript]
    set source_folder to choose folder with prompt "Please select directory."
    set destination to choose folder with prompt "Please select directory."
    tell application "Finder"
              set file_list to every file of folder source_folder
    end tell
    tell application "Finder"
              launch
              try
                        duplicate source_folder to destination
              on error errorMsg number errorNum
                        display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
              end try
              repeat with aFile in file_list
                        set file_info to info for (aFile as alias)
                        set file_creation_date to creation date of file_info
                        set tPath to quoted form of (POSIX path of aFile)
                        set tName to name of (info for aFile)
                        set MD to do shell script "mdls -name kMDItemContentCreationDate " & aFile
                        set TID to AppleScript's text item delimiters
                        set AppleScript's text item delimiters to "= ("
                        set tDates to text item 1 of MD
                        set AppleScript's text item delimiters to ")"
                        set tDates to (text item 1 of tDates) as text
                        set AppleScript's text item delimiters to TID
                        set dateInfo to text 30 thru -1 of tDates
                        set newFilename to dateInfo
                        try
                                  tell application "Finder" to set name of aFile to newFilename
                        end try
              end repeat
    end tell
    [/applescript]
    the error I get is:
    Can’t make «class docf» "10 - TXT.doc" of «class cfol» "result" of «class cfol» "newfolder" of «class cfol» "ecco" of «class cfol» "my folder" of «class cfol» "Documents" of «class cfol» "ZZZ" of «class cfol» "Users" of «class sdsk» of application "Finder" into the expected type.

    OK, to do that you just need to tell the Finder to duplicate the file first (you had originally set a destination folder, but didn't do anything with it) - note that there isn't any error handing (a duplicate file name for example), the script just logs the error:
    set source_folder to (choose folder with prompt "Please select source directory.")
    set destination to choose folder with prompt "Please select destination directory."
    tell application "Finder"
       set file_list to every file of folder source_folder as alias list
    end tell
    repeat with aFile in file_list
       set tPath to quoted form of POSIX path of aFile
       set newFilename to (do shell script "mdls -name kMDItemContentCreationDate -raw " & tPath)
       set TID to AppleScript's text item delimiters
       set AppleScript's text item delimiters to ":"
       set pieces to text items of newFilename
       set AppleScript's text item delimiters to "-"
       set newFilename to pieces as text
       set AppleScript's text item delimiters to TID
       try
          tell application "Finder"
             set copiedFile to (duplicate aFile to destination)
             set name of copiedFile to newFilename
             -- set name of copiedFile to text 1 thru 19 of newFilename -- strip off time offset
          end tell
       on error errorMsg number errorNum
          log errorMsg
       end try
    end repeat
    You can find information about the AppleScript language in the AppleScript Language Guide, and an application's scripting dictionary (if it has one) can be opened in the AppleScript Editor to view the additional commands that it provides.

  • Please help convert MSSQL Stored Procedure to Oracle PL/SQL

    Hi there to all,
    this be my first post to these forums. I have already posted this question on a microsoft msdn forum, until someone advised that I ask my question here - dunno why I didnt think of that! ?:|
    Im working with an Oracle 10g Database from an ASP.NET 2.0 application, and want to know if it Oracle supports OPENXML (rhetorical question I fear!). The reason I ask is because I want to create an Oracle Stored Procedure that will accept an XML string as an input parameter, prepare it, select from it, and then insert it into an Oracle table.
    I have done this successfully in SQL server using the following as an example:
    CREATE PROCEDURE [dbo].[Employee_INSERT]
    bq. @INSERTRECORD XML
    AS
    BEGIN
    bq. DECLARE @XDOC INT; \\ EXEC sp_xml_preparedocument @XDOC OUTPUT, @INSERTRECORD; \\ INSERT INTO [dbo].[REC_Employees] (
    bq. bq. [EMPTITLE], \\ [EMPFNAME], \\ [EMPLNAME], \\ [EMPDEPTID], \\ [EMPBEGINDATE], \\ [EMPACTIVE], \\ [EMPDATEADDED]
    bq. )
    bq. SELECT
    bq. bq. [EMPTITLE] = Title, \\ [EMPFNAME] = Firstname, \\ [EMPLNAME] = LastName, \\ [EMPDEPTID] = DepartmentID, \\ [EMPBEGINDATE] = StartDate, \\ [EMPACTIVE] = IsActive, \\ [EMPDATEADDED] = GETUTCDATE()
    bq. FROM
    bq. bq. OPENXML(@XDOC, '/EMPREC/Table', 2) \\ WITH (
    bq. bq. Title VARCHAR(10), \\ FirstName VARCHAR(50), \\ LastName VARCHAR(50), \\ DepartmentID INT, \\ StartDate DATETIME, \\ IsActive BIT
    bq. bq. );
    bq. EXEC sp_xml_removedocument @XDOC;
    END
    I would sincerely appreciate any help in this regard!
    PS - Please excuse the formatting!
    Much Thanks!
    regards
    shalan

    Assuming your table is named DESTINATION
    Name                                      Null?    Type
    TITLE                                              VARCHAR2(10)
    FIRSTNAME                                          VARCHAR2(50)
    LASTNAME                                           VARCHAR2(50)
    DEPARTMENT                                         NUMBER
    STARTDATE                                          DATE
    ISACTIVE                                           NUMBERYou can use a procedure like:
    create or replace
    procedure test (p_xml in xmltype)
    is
    begin
      insert into destination
      select title
           , firstname
           , lastname
           , department
           , to_date (startdate, 'yyyy-dd-mm hh24:mi:ss') startdate
           , isactive
        from (xmltable ('/EMPREC/Table' passing p_xml
                       columns title varchar2(5) path 'Title'
                             , firstname varchar2(10) path 'FirstName'
                             , lastname varchar2(10) path 'LastName'
                             , department number path 'Department'
                             , startdate varchar2(20) path 'StartDate'
                             , isactive number path 'IsActive'
                      ) temp
    end test;to create records in the table
    Removed a unnecessary SELECT FROM DUAL...
    Edited by: Alex Nuijten on Jan 19, 2009 2:24 PM

  • Please help converting i-tunes from old computer to new computer!!?

    Hi there,
    Please keep in mind I am not very computer literate and therefore although I am sure this is a very easy question I can't do it and I need some help!!!
    I have upgraded my old computer. This had my i-tunes on it, however after a while it got so slow I started to keep music on an external hard drive, which resulted in my music files being split. I have now dragged and dropped everything on to my hard drive under one folder (I think) and I now want to put this on to my new computer.
    Well actually I want to keep my library on the hard drive so that anything I download etc goes on to there (this computer is just a stop gap for now). I have changed the file location in preferences but cannot seem to get it to pick up the music from the hard drive!!!
    What do I do!!? Any help appreciated...!
    Thanks in advance

    Hello and Welcome to Apple Discussions. 
    This Apple article (link) explains how to move your music library between computers and in addition it explains how you can ensure all your music is consolidated into one location. Hopefully that will cover everything you need.
    kind regards
    mrtotes

  • Please help convert from as2

    I never learnt as2 and I just purchased a fla file from a stock sight thinking it was in as3 and it isn't!!! doh
    can anyone help me convert this from as2 to as3:
    stop();
    import flash.filters.*;
    //--------------variables to change--------------------------//
    //set this value to true if you want sparkles to be created from the mouse
    //and false if you want automatic sparkles
    var createSparklesFromAnyMouse:Boolean = true;
    //set to true if you want sparkles to stop being created when the mouse
    //is still
    var createSparklesFromClick:Boolean = false;
    //modify the size of the sparkles
    var maxSparkSize:Number = 18;
    var minSparkSize:Number = 8;
    //increase this value to shorten the life, 0 to live forever
    var fadeSpeed:Number = 10;
    //the speed the sparkles fall, higher number quicker the speed
    var speed:Number = 1;
    //choose whether you want the sparkle colour to be random
    var randomColour:Boolean = true;
    //if you don't want a random colour pick a default colour
    defaultColour = 0xFFffFF;
    //do not modify code below here...
    var sparkle:Number = 0;
    var mousePosX:Number;
    var mousePosY:Number;
    var whichBat:Number;
    var count:Number = 0;
    this.createEmptyMovieClip("empty",this.getNextHighestDepth());
    howToCreate();
    function howToCreate() {
              if (createSparklesFromClick == true) {
                        trace("create sparkles every time I click the mouse");
                        //create sparkles from mouse clicks
                        activateClick();
              } else {
                        if (createSparklesFromAnyMouse == true) {
                                  trace("create sparkles from the mouse");
                                  //create sparkles from the mouse
                                  this.onEnterFrame = function() {
                                            createSparkle();
                                            createSparkle();
                        } else {
                                  trace("create sparkles every time I move the mouse");
                                  //create sparkles ONLY when the mouseMoves
                                  createWhenMoving();
    function createWhenMoving() {
              this.onEnterFrame = function() {
                        if (mousePosX != _root._xmouse && mousePosY != _root._ymouse) {
                                  createSparkle();
                        mousePosX = _root._xmouse;
                        mousePosY = _root._ymouse;
    function activateClick() {
              empty.onMouseDown = function() {
                        this.onEnterFrame = function() {
                                  createSparkle();
              empty.onMouseUp = function() {
                        delete this.onEnterFrame;
    function createSparkle() {
              movingSparkle = this.attachMovie("colouredSparkle", "s_"+sparkle, sparkle);
              movingSparkle2 = this.attachMovie("colouredSparkle", "ss_"+sparkle, sparkle+100);
              sparkle++;
                        if(sparkle>100){
                        sparkle = 0;
              setParams(movingSparkle);
              setParams(movingSparkle2);
    function setParams (movingSparkle){
              movingSparkle._x = _root._xmouse+randRange(-8, 8);
              movingSparkle._y = _root._ymouse+randRange(-15, 0);
              movingSparkle._xscale = movingSparkle._yscale=Math.random()*maxSparkSize+minSparkSize;
              movingSparkle._rotation = randRange(0, 360);
              if (randomColour == true) {
                        col = Math.round(Math.random()*0xFFFFFF);
              } else {
                        col = defaultColour;
              colouredFill = new Color(movingSparkle.colour_mc);
              colouredFill.setRGB(col);
              colouredFill = new Color(movingSparkle.white_mc);
              colouredFill.setRGB(col);
              moveSparkle(movingSparkle);
    function moveSparkle(movingSparkle) {
              var ySpeed = randRange(0, speed);
              var rot = randRange(-15, 15);
              var blurX = randRange(2, 5);
              var blurY = blurX;
              var blurFilter = new BlurFilter(blurX, blurY, 3);
              movingSparkle.white_mc.filters = [blurFilter];
              movingSparkle._alpha = randRange(85, 100);
              var alphaDrop = randRange(1, fadeSpeed);
              movingSparkle.onEnterFrame = function() {
                        //change speed
                        this._y += ySpeed;
                        //change rotation
                        this._rotation = this._rotation+rot;
                        //make it smaller
                        this._xscale = this._yscale=this._xscale*0.98;
                        //fade the sparkle
                        this._alpha = this._alpha-alphaDrop;
                        //remove the movieclip if it get tiny
                        if (this._alpha<10) {
                                  this.removeMovieClip();
                                  delete this.onEnterFrame();
                        if (this._height<4) {
                                  this.removeMovieClip();
                                  delete this.onEnterFrame();
    function setColour(mc, col) {
              colourIt = new Color(mc);
              colourIt.setRGB(col);
    function randRange(min:Number, max:Number):Number {
              var randomNum:Number = (Math.random()*(max-min))+min;
              return randomNum;

    Zhanbolat,
    In theory, conversion of this code is not difficult, especially because it is clear what the logic is designed to do. The issue is that you will not have an expected result once only this code is converted in isolation. This puppy uses some other objects that are written in AS2 including entities in the FLA library.
    In short, it looks like this application needs a total overhaul at every level in order for it to properly function as an AS3 program.
    With that said, although this is, again, not a difficult task, it is unlikely to find someone to do it for free. You may have a better luck if you start conversion yourself and post focused questions as you go.

Maybe you are looking for