How to display elapsed/current time of a song in Actionscript.

Hi I have a question on how I can make my code display a total time for a song from a media player I created with Actionscript 3.0, using XML to load the song track.
This is my current function which I have done and I am unsure on what the problem is that is not allowing the elapsed time to display in a textfield on my stage.
stage.addEventListener(Event.ENTER_FRAME, timeElapsed);
function timeElapsed(e:Event):void
                    var minutesCurr:Number = Math.floor((my_channel.position /1000) /60);
                    var secondsCurr = Math.floor((my_channel.position /1000) % 60);
        if (secondsCurr < 10)
            secondsCurr = "0" + secondsCurr;
        var minutesTot:Number = Math.floor((my_sound.length /1000) /60);
        var secondsTot = Math.floor((my_sound.length /1000) % 60);
        if (secondsTot < 10)
            secondsTot = "0" + secondsTot;
        completeText_txt.text = minutesCurr + ":" + secondsCurr + "/" + minutesTot + ":" + secondsTot;
I tried adding to the stage and I am getting a null object reference.
Thanks Casey

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
- is declared but not instantiated
- doesn't have an instance name (or the instance name is mispelled)
- does not exist in the frame where that code is trying to talk to it
- is animated into place but is not assigned instance names in every keyframe for it
- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

Similar Messages

  • How to display the current time in a UIX page

    Hi All,
    another UIX question....
    A requirement of a customer is to display to current data and time in every page.
    It should be done in a <header>. So i'm writing a new (template based) renderer for that element. How can i display the current time and date on it?
    Thanks in advance for any help...
    Regards,
    Robert Willems

    Hi Robert -
    When you say you are writing a template-based Renderer, do you mean that you are creating a custom look and feel and replacing the header Renderer? If so, I'd recommend instead simply creating your own template (not template-based Renderer), and reference your template directly from your uiXML pages where you want to insert the timestamp.
    You'll probably want to write a method data provider which calls System.currentTime(), convert the result to a date, and then use Java's date formatting capabilities (see java.text.format.DateFormat) to produce a user presentable String that you can return from your data provider.
    For more info (and samples) on templates and data binding, see the "Templates and Data Binding" section of the "Includes and Templating in ADF UIX" help topic:
    http://tinyurl.com/5b7bf
    Andy

  • Please provide an example of how to display the system time in CNiNumEdit.

    I need to display elapsed time in a numeric edit control. The value must be a double. Using MFC, please show me an example that displays the system time in a CNiNumEdit control.

    The trick is to set the FormatString of the num edit control to a format that displays dates/times and to use the COleDateTime class to handle converting the date/time to a double. COleDateTime encapsulates time stored as a DATE, which is a typedef for double. COleDateTime uses the same conversion factor for date/time as what the num edit expects, and since it supports a conversion operator to a DATE, which is really a double, and the num edit Value property is a double, displaying the current time in a num edit can be as simple as this:
    // Assuming you have a member variable called m_numEdit for a CNiNumEdit
    m_numEdit.FormatString = _T("hh:nn:ss");
    m_numEdit.Value = COleDateTime::GetCurrentTime();
    Hope this helps.
    - Elton

  • How to display the current day value in Numbers app?

    In Numbers 3.2.2, where the current date and time happens to be 17 Dec. 2014 11:46am:
    What formula will display the current date's numeral value?
    What formula will display the current month's short name as text?
    What formula will display the current year in four digits?
    What formula will display the current time in the style "11:46am"?
    Appreciated.

    I've taken the liberty of tweaking that handy script to format the date as requested by the OP:
    on run {}
      set right_now to (current date)
      set short_month to text 1 thru 3 of (month of right_now as string)
      set the_year to year of right_now as string
      set the_day to day of right_now as string
      set short_time to text 1 thru 5 of time string of right_now
      set the_secs to time of right_now
      if (the_secs / 2 as integer) < 21600 then
      set am_pm to "am"
      else
      set am_pm to "pm"
      end if
      set s to space
      set text_date to the_day & s & short_month & ". " & the_year & s & short_time & am_pm
      set the clipboard to text_date
      my paste_date()
    end run
    on paste_date()
      tell application "Numbers"
      activate
      tell application "System Events"
      keystroke "v" using {command down}
      end tell
      end tell
    end paste_date
    This considers 11:59:59 to be "am" and 12:00:00 to be "pm". (Edited after further consideration.) It has to be run either as an Automator service, or saved in ~/Library/Scripts/Applications/Numbers/ and run from Numbers' script menu. If run from Script Editor, it pastes the date into the end of the script itself.
    Hope it helps,
    H

  • How to display the current date in the prompt value.

    Hi,
    How to display the current date in the prompt value. When the user runs the query he want the current date to be displayed in the prompt value and he should also be able to change the date if required ...... I am using web Intellegency BO XI3.0.
    Thanks,
    Shakthi.

    Please refer the below link.
    Prompt  with  default  date   (  currentdate-1  and current date-8)
    http://www.dagira.com/2008/07/15/how-can-i-make-today-my-default-prompt-value/
    http://www.dagira.com/2008/07/21/using-a-magic-date-value-in-prompts/
    Regards,
    Bilahari

  • How can i get current time of a given timezone

    how can i get current time of a given timezone
    for example: Asia/Hong_Kong
    my code is like this, but the result is not correct.
    what's wrong?
    import java.util.*;
    public class test {
    public static void main(String[] args){
              String s = "Asia/Hong_Kong";
              String tempS = "";
              TimeZone myTime = new SimpleTimeZone(s);
              //TimeZone myTime = TimeZone.getTimeZone(s);
              Calendar myCal = new GregorianCalendar(myTime);
              tempS = myCal.get(Calendar.YEAR)+"-"+
                        (myCal.get(Calendar.MONTH)+"-"+
                        myCal.get(Calendar.DATE)+" "+
                        (myCal.get(Calendar.HOUR)+":"+
                        myCal.get(Calendar.MINUTE)+":"+
                        myCal.get(Calendar.SECOND);
              System.out.println(tempS);
    output is : 2001-7-15 11:16:48
    but the correct time should be: 2001-8-16 7:17:48
    the correct time should be 2001-8-16

    Certain indexes in the Calendar API start at 0 rather then 1, so, when you get the value, you may want to increment.
    I'm not sure why the time is incorrect. You may want to call getAvailableIDs() and make sure that the desired TimeZone ID is supported by your version. I doubt that Sun would have incorrect support for the time zone, but it may not be included, or perhaps it is included with a diffrent ID. You can always create your own time zone as well, by passing the String offset to getTimeZone(), the offset being how many hours beyond or before GMT. Hopefully this helps.

  • How can i get current time in different TimeZone

    Hi alls,
    How can i get current time in different TimeZone.
    I've tried
    final Calendar calendar = Calendar.getInstance(GMT0_TIME_ZONE);
    final Date date = calendar.getTime();
    but it returns current time in my time zone not in GMT0

    a simple way would be:Sometimes gets you the right result (not during daylight saving), but always the wrong way.
    I would strongly recommend getting into the habit of handling Dates correctly. A Date is a universal instant in time - the number of milliseconds since midnight GMT on 1 January 1970. That instant corresponds to various dates and times, depending on your time zone and the effect of daylight saving. You make that conversion of a universal instant to a localized date/time using Calendar and DateFormat.

  • How to display date and time on jsf page

    Hi,
    how to display date and time on jsf page
    we are using 11.2.0.0 jdeveloper on windows.
    thanks
    Edited by: user12187801 on 26-Jul-2012 01:42

    Your question is certainly lacking some information.
    If you want a constantly updating date/time - then JavaScript is your best bet, and Google would find you examples like [url http://www.webestools.com/scripts_tutorials-code-source-7-display-date-and-time-in-javascript-real-time-clock-javascript-date-time.html]this
    If you meant something else, then it's back to you to explain.

  • How can we get current time date with resultset?

    Dear All,
    I have to insert current time date in the table.So,i need to get the current time and date with result set.So,I will first get the time date and then insert it into the table.
    I know how can we get current time and date without resultset.i have created this function its working.But now i want to use this.mean using resultset i want to put in the table.
    How can i do this?
    public static String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
    public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
    }

    yuck. Why not simply set a "new java.sql.Date()" to the SQL parameter in question?

  • How to display the current Date and time in xslt version 1

    i am using xslt version 1 .i want to display the current date and time in the output xml using xslt(Jdeveloper) ..i just added the namespace xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
         xmlns:ns1="urn:oracle:integration:b2b:7D30046DC68A4FA689956D8241FA3B99">
    and used thsi function <xsl:value-of select = "xp20:current-date()"/>
    but it does not works for me ..help needed????
    Edited by: user9519185 on Jan 20, 2009 3:04 AM

    Use a formula: =NOW()
    Format the cell for Date and Time, with both the Date part and the Time part displayed. Format the two parts as you wish, using the choices in the Inspector's menus.
    The cell will update each time the table is recalculated.
    (Description is for Numbers '09 (Mac), Numbers for iOS will be similar, but not necessarly identical in details.)
    Regards,
    Barry

  • How to check whether current time satisfies the schedule?

    I am working on a task, which is opposite of cron tab. My application is in groovy but can call all Java api. Can you please provide some pointers?
    User is allowed to schedule a rule to be executed the way crontab gives the options. For example he wants the rule to be executed from Monday to Friday from 8 am to 5 pm.
    I can’s schedule in crontabe or Quartz. At run time I have to match, whether the current time satisfy the time condition entered by user.
    I may have to store this information in the database the way we put in the cron. Eg. my tables will have following
    Id|| Policy Id|| seconds|| minutes|| hours|| Day|| Date|| month|| year
    1 || 5 || 1     || 1 || 8-17 || M-F||? || * ||*
    Now while my code is getting executing, how can I match whether the current time matches the condition mentioned above.
    Thanks in advance.

    [Using Span|http://tus.svn.sourceforge.net/viewvc/tus/tjacobs/util/] would make this easy

  • How to put the current timer in the frame

    I am doing one application and i am using frame. I want to show the current time( hour and minute). But i don't know how to implement it. Please help me to solve my problem. Below is the sample code of my program. How to put the timer in the bottom part.
    //AdminMenu.java
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class AdminMenu extends JFrame{
    private JLabel lblmenu;
    private JLabel lblvideo;
    private JLabel lbladmin;
    private JButton cmdaddvideo, cmddeletevideo, cmdeditvideo;
    private JButton cmdaddadmin, cmddeleteadmin, cmdchangepass;
    private Container c;
    private GridBagLayout gdlayout;
    private GridBagConstraints gdconstraints;
    private Color colorValues[] =
    { Color.black, Color.blue, Color.red, Color.green };
    public AdminMenu()
    super("Administration Menu");
    JMenu fileMenu = new JMenu( "File" );
    fileMenu.setMnemonic( 'F' );
    JMenu openMenu = new JMenu ("Open");
    openMenu.setMnemonic('O');
    fileMenu.add( openMenu );
    JMenuItem exitItem = new JMenuItem( "Exit" );
    exitItem.setMnemonic( 'x' );
    exitItem.addActionListener(
    new ActionListener() {
    public void actionPerformed( ActionEvent event )
    System.exit( 0 );
    } // end anonymous inner class
    ); // end call to addActionListener
    fileMenu.add( exitItem );
    // create menu bar and attach it to MenuTest window
    JMenuBar bar = new JMenuBar();
    setJMenuBar( bar );
    bar.add( fileMenu );
    setSize(300,250);
    setLocation(350,200);
    this.setResizable(true);
    show();
    //---------------------- Main -------------------------------
    public static void main(String args[])
    AdminMenu app = new AdminMenu();
    app.setDefaultCloseOperation(
         JFrame.EXIT_ON_CLOSE );
    Thanks for helping me

    e.g. use a thread that invokes new Date() (every minute), format the Date with SimpleDateFormat and print the result String on a Label that you can put on your frame ...

  • How to display the current date witout chane anyone

    Hi all
    I have some problem in date field.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS :   S_INDATE TYPE SY-DATUM DEFAULT  SY-DATUM.
    SELECTION-SCREEN END OF BLOCK B1 .
    This the code of selection screens. Normally default it will display the current date. But in my program it can change the user… but I want to display the date and it cant be the change anybody.. How should I do it…??????????…
    Regards,
    nawa

    hi ,
    Chk this.
    SELECT-OPTIONS : s_kunnr for kna1-kunnr.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
         if (SCREEN-NAME EQ 'S_KUNNR-HIGH') OR (SCREEN- NAME EQ 'S_KUNNR-LOW').
         SCREEN-input = 0.
         MODIFY SCREEN.
      ENDLOOP.
    Rgds
    Anver

  • How can display date and time in text item ?

    Hello all,
    I have placed two text items (named text_item1,text_item2).
    I want to place the current date in one text item and place current time in another text item. how can i place this?

    Hi
    This depends on ur needs
    WHEN-NEW-FORM-INSTANCE > if u want to appear it on the very begining moment
    --=============
    u can use
    WHEN-VALIDATE-ITEM > on ur date fields
    Here is a link that may help u decide where to take off with this code...
    http://www.dotnetspider.com/resources/22433-Triggers.aspx
    http://www.slideshare.net/magupta26/oracle-forms-tutorial
    Hope this helps ,
    Regards,
    Abdetu...

  • How to display the current date in a CP5 project?

    What is the best way to display the current date into captivate?

    Hello,
    Use a Text Caption in which you insert the system variable cpInfoCurrentDate.
    Inserting a variable is possible with the X in the Format accordion of the Properties panel of the Text Caption:

Maybe you are looking for