How to add leading zero using the toString() function?

Hi,
I've looked in the user manual and I can't find any reference to toString() for syntax information.  Isn't there a parameter for me to use to specify the string lenght?  And whether to add leading zeros or not?
Here's the code I need to add leading zeros:
playbutt.addEventListener(MouseEvent.CLICK, playSound);
function playSound(e:Event)
SoundMixer.stopAll();
var num:Number = Math.ceil(Math.random()*43);
bigNum.text = num.toString();
var path:String = "Track No" + bigNum.text + ".mp3";
trace(path);
var s:Sound = new Sound(new URLRequest(path));
s.play();
The files I'm trying to open starts at "Track No01".
Any ideas?
Ron

Thank you for the code replacement.
By the way, instead of having the user click a button to start a random music file (MP3), I'd like to get the music going as soon as one loads a webpage and once the first tune is finished playing jump to another randomly selected music file (MP3).
I've search via Google for ideas but couldn't find anything that came close to what I need done.
Any ideas?
Regards,
Ronald

Similar Messages

  • How to add leading zeros ?

    Hi Friends,
    I have a shipment no say 10 char long . Now the thing is in my program I need to add leading zeros if the shipment no is not 10 char long .
    For eg : if the tknum is 99919 . I need to make use of a command to make it 10 char long lke 0000099919.
    Also I need to be able to add zeros if tkum is 5 or 7 or 8 char long .
    How do i add these leading zeros to fill up the remaining positions ?
    Thanks,

    hi ,
      use the following code.
    data : lv_vbeln(10) type c.
           lv_sonumber like vbak-vbeln.
    <b>This function module will convert the data into the required format based on the data type of the variable that you are passing in import paramter of the funcation module.</b>
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                        INPUT         = lv_vbeln
                     IMPORTING
                       OUTPUT        = lv_sonumber
    Thanks
    mahesh

  • Urgent........How to add leading zeros to negative values.....

    Hi,
    I want to add leading zeros to negative values.
    <b>Present Value    :</b> -567
    <b>Expected Value :</b> -0000000567
    I know to adding leading zeros with the help of CONVERSION_EXIT FM.
    Thanks in advance.
    Regards,
    Kumar.

    Hi
    Use below FM.
    CONVERSION_EXIT_ALPHA_INPUT
    Try out below FM with the above one.
    <b>CLOI_PUT_SIGN_IN_FRONT</b>
    <b>ISJP_GET_SIGN</b>
    or you can use
    <b>WRITE variable USING EDIT MASK '-___________'.</b>
    or
    <b>CONCATENATE syntax</b>
    Hope it will solve your problem
    <b>Reward Points if it is helpful.</b>
    Message was edited by:
            ilesh 24x7
    Message was edited by:
            ilesh 24x7

  • How to add leading zeros to a packed variable

    Hi all,
    I have a to add leading zeros for a packed field.
    eg.
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    but I have to display the field as '0000000000012.063'.
    How can we achieve this?
    Regards.

    Execute the code .
    REPORT zex13 .
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    data:val(18) type c,
         in(13) type n ,
         dec(6) type c.
    data :  a type i ,
            b type i.
            a = TRUNC( brgew ).
            write:/ a .
    in = a.
    write:/ in.
            dec = frac( brgew ).
            write:/ dec.
            concatenate in  dec+2(4) into val separated by '.'.
            write:/ val.
    see if this works for u .
    regards,
    vijay

  • How to add leading zeros to kunnr field

    Hi All,
    I need to add leading zeros to KUNNR field runtime.
    i.e for some customer it is displaying '2001084606'
    some customer's it si displaying '10434'.
    I want add leading zeros when customer length is
    not equal to ten '10'.
    plz kind let me know this is urgent.
    Regards
    Bhaskar

    Hi there,,
    Kunnr is using a dataelement with Char 10.
    You can do in this fashion to resolve your issue.
    len = strlen (itab-kunnr).
    len is having the lenght of the customer number.
    if len < 10..
       while len < 10.
          concatenate '0'  itab-kunnr into temp_text.
          add 1 to len.
       endwhile.
    endif.
    now finally you can assign temp_text to your itab-kunnr.
    hope this way you can resolve your issue.
    if found helpful,, don't forget to reward points.
    Thanks-
    Rahul.

  • How to add leading zeros to a characteristic in CT04

    The business is requesting that we change a class characteristic so that it adds leading zeros.  Currently the characteristic is set as numeric with length of 6, no decimals.  Is there any way via template or otherwise to force this characteristic to store leading zeros, as recorded against the characteristic?

    Hi David,
    1. If you are mentioning about the "Characteristics"This is Standard Field name.
    2. You will not be able to influence the same,
    3. Also i doubt if you are talking about the Characteristic Value - Since only in the Char Value we will be able to define the length, etc.
    4. In case of Charvalues if you want leading zeros then create it as character , where you can store with leading zero
    Reg,
    Dsk

  • How to remove leading zeros from the screen?

    Hello friends,
    I am working on dialog programming.
    I have a field with is NUMC 13. so when value is populated, It removes the leading zeros.
    How can I display the my value with leading zeros on the screen painter?

    Call SE51, layout, double-click on field, attributes, tab Program, check Leading zeros.
    Regards,
    Raymond

  • Add leading zeroes in the IDOC segment data

    Hi,
    How to populate the Document number and EAN code  in the segment with leading zeroes because I have checked that all fields in the segment are of charcter type.
    I want to know can this be handled by customizing or coding but how?
    Thanks
    Prince

    Hi,
    You can use :
       call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exportiong
          input = c1
        importing
          output = c1.
    Regards,
    Subramanian

  • How to keep leading zeros using SAP_CONVERT_TO_XLS_FORMAT

    my leading zeros  drop when download using FM-SAP_CONVERT_TO_XLS_FORMAT, how to fix it?

    Hi,
    You can try as below.
    Let's for the 10 digit numeric field, using the function module CONVERSION_EXIT_ALPHA_INPUT, you can get the 10 digit number with leading zeroes.
    Now if you declare the char of 10 in length field in the internal table will be replaced with the above value.
    Now it will be downloaded as required.
    Regards,
    Nishant Malhotra

  • How to add leading zeros to hex string?

    Hi, I've got the following problem:
    I have a string that represents a 8-digits hexadecimal number. But if the number has less as 8 digits, I need to add the leading zeros. I can't use DecimalFormat, 'cause it works only with decimal numbers. Is there any elegant solution to add the leading zeros to hex string (for example "A3F" to "00000A3F")

    Or better use a StringBuffer for that, though I doubt it's a performance problem in your case.

  • Need to add leading zeros to the field if field length is less than 6

    Actually the field length is 16.
    But for some manual entries it is comming as 4 chars.
    so if field length is less than 6 then it should be replaced by leading zeros.
    Moderator message: very basic, please (re)search yourself before asking, @all: please do not reply to basic questions, points removed.
    locked by: Thomas Zloch on Sep 9, 2010 11:43 AM

    Hi Ravi,
    Do it in 2 steps.
    1. check the length of your entry by strlen function and get the length.
    2. If the output is less than 6 call the FM CONVERSION_EXIT_ALPHA_INPUT to get leading zero
    Regards,
    anirban

  • How to bee able to use the anchor functionality as is used in APEX develop

    Hi
    First of all APEX is great !
    I have been using APEX to do some small applications in Norway. Now i am in a position to make a sales presentation for Norwegian Civil Aviation authority department. I hope we winn the contract and then we are going to use APEX for building the system.
    I need to bee able to navigate between many regions on an effective way. We would have the pages with 3-8 regions on each page and it would bee very suitable do have the functionality which is used in APEX Application builder where it is possible to show all regions on the page and then bee able to scroll through all regions on the page.
    But also bee able to user #ANCHOR_NAME at the end of the URL and then just switch to one of the regions (show just one region on the page).
    I have made a test page with use of #ANCHOR_NAME and this is ok, but i don't know how to just hide all other regions when you navigate to the anchor name. In application builder it is very nice when you navigate between regions and when you hit the "Show All" link, all regions is displayed on the same page.
    I also need to have each region the same size in width as in Application Builder, and the theme used in Application builder would also bee nice to used (in another color) is it possible to have a copy of the theme and make some adjustments to it ?.
    I would bee very greatfull for any feed back about this subject. I am going to make a demonstration 19 Descember.
    jon.

    The Builder links you mention at the top of the Component Definition pages use markup like
    < a href="#N" onclick="qF(this,'#N');return false;" ... >Name< /a >That "qF" function is a slick piece of Javascript. You can review it at http://htmldb.oracle.com/i/javascript/htmldb_html_elements.js. The DOM nodes that the function uses are specific to the Builder page template, but the code is fairly generic enough that you can adapt it to meet your needs. [Not sure what your comfort and experience level with Javascript is]
    That function also saves the selected region/section in a client-side cookie so that it persists the next time you visit the page.
    Hope this helps.
    Carl: The following line in the "uR" function seems mighty strange!
    if(gThis == $x('ALL')){gThis = $x('ALL');}

  • How to read data after using the PRINT function in visual basic

    I know the benchlink can capture the spectrum analyzer screen for me, but I want to integrate it into my application. I use NI spy to detect the communications from the benchlink and put it into my application. After sending the "PRINT 0" command, my "ilrd SpectrumAnalyzer, temp, 500" command doesn't work, giving me EARG error. Does anyone knows if it is because I can not define the temp to be string or some other problem?
    b.t.w, the communications I get from NI Spy actually read some unknown characters from the instrument, what kind of data it is? Any idea how to use it?
    thanks.

    Hello elm,
    This is completely dependent on your instrument; if you are getting the data then you are halfway there. Look in your instrument's programmer's reference manual to see if they mention how the picture is encoded in bytes. There are so many different ways to encode a picture in binary that speculating and guessing would probably never yield the true result. If there is no mention in the manual, contact the instrument manufacturer.
    Sorry I could not be of more help.
    Scott B.
    Applications Engineer
    National Instruments

  • Add leading zero to matnr in a conversion program

    Hi All,
    When uploading matnr from a text legacy file , should i add leading zeroes to the sku value. For ex the data from the lagacy is 1000123456 (10 digits length). The values are always numbers. The matnr in SAP is 18 chars. Should my program transform it into 000000001000123456 before saving it into mara-matnr?
    Regards, Oli

    Are you sure that in configuration, the Indicator for lexicographical material numbers is unchecked?  If it checked, then SAP will not then the all numeric material numbers will not get leading zeros by default.   =====>
    Indicator for lexicographical material numbers
    Defines the way numeric material numbers are stored in the database.
    Use
    Caution
    It is only possible to set or reset (cancel) this indicator if no numeric material numbers have been used yet in the system since they would no longer be interpretable after setting or resetting this indicator.
    If this indicator is not set, numeric material numbers are padded with leading zeros and stored right-justified

  • BADI to add leading zero to material in DP

    Hello,
    I wanted to check if there is a BADI that can be used while generating CVC (/sapapo/mc62) that will add leading zeros to the product number (9amatnr) while uploading CVCs from FLAT FILE.
    Thanks,
    Sanju

    Hello,
    I am basically trying to create CVC from a TAB delimited file using tcode /sapapo/mc62. The file will be loaded on Application server and  /sapapo/mc62 will pick up the tab delimited file in background. I want a FM or BADI that can pad leading zero in front of the material Characteristics when CVCs are generated.
    Please advise.
    I am not planning to load the file into infocube and generate CVC from infocube.
    Thanks

Maybe you are looking for

  • Decimal places on forms

    The decimal places in General Settings>Display is set to 6 for Amounts and Prices.  They would like only 2 decimal places to acutally print on the SO and AR Invoice.  How can we do this?

  • How to remove my payment option on iTunes App Store and iTunes on the iPhone?

    I've had this problem many times and eventually it would just work out after a week or so but I'm tired of that so here's what happens: I use prepaid credit cards for iTunes (I've also used a real credit card and had the same problem) and when they m

  • 10.6.8 how to upgrade to Lion, or Mtn Lion?

    Tried installing Lion from my App Store purchased version onto my Mac Book 10.6.8 but it says I need 10.7?? Ditto for my Pages, and Numbers programs? They will not install any advice is appreciated! ARGH!

  • Assessment cycle

    Hi guys. I need help on how to create gl assessment cycle step by step.  I created a cycle using FAGLGA11 but i keep getting an error message that the sender and receiver doesn't exist. Is there something that I am missing. My goal is to do profit ce

  • Configure SQL*plus with InstantClient to use TNSNAMES

    I got following configuration: Database - 10.2.0.4 EE x64 running on separate server, e.g. 192.168.1.1 with SID test Client - clean CentOS 6.3 x86 installation. I've downloaded oracle-instantclient-basic-10.2.0.4-1.i386.rpm and oracle-instantclient-s