A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Im confused i need someone to look at this please.

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Location
    wolverhampton, united kingdom
    Posts
    8

    Exclamation Im confused i need someone to look at this please.


    //get date info from system
    mydate_ist = new Date();
    hrs_ist = mydate_ist.getHours();
    mins_ist = mydate_ist.getMinutes();
    //put zeros where needed
    if (hrs_ist<10) {
    hrs_ist = "0" add hrs_ist;
    } else {
    hrs_ist = hrs_ist;
    }
    if (mins_ist<10) {
    mins_ist = "0" add mins_ist;
    } else {
    mins_ist = mins_ist;
    }
    if (mydate_ist.getsec_istonds()<10) {
    sec_ist = "0" add mydate_ist.getsec_istonds();
    } else {
    sec_ist = mydate_ist.getsec_istonds();
    }
    //send to text field
    digitalClock.text = "IST "+hrs_ist+":"+mins_ist+":"+sec_ist;


    this is the code that im using to try to get the time for my project but everytime i use it in adobe flash CS5.5 it comes up with these compiler errors

    can someone help me please ??

    Scene 1, Layer 'CodeLayer', Frame 1, Line 54 1086: Syntax error: expecting semicolon before add.
    Scene 1, Layer 'CodeLayer', Frame 1, Line 54 1084: Syntax error: expecting rightbrace before semicolon.
    Scene 1, Layer 'CodeLayer', Frame 1, Line 59 1084: Syntax error: expecting rightbrace before add.
    Scene 1, Layer 'CodeLayer', Frame 1, Line 64 1084: Syntax error: expecting rightbrace before add.

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    try:

    PHP Code:
    //get date info from system
    mydate_ist = new Date();
    hrs_ist mydate_ist.getHours();
    mins_ist mydate_ist.getMinutes();
    sec_ist mydate_ist.getSeconds();
    //put zeros where needed
    if (hrs_ist 10)
    {
        
    hrs_ist "0" hrs_ist;
    }
    else
    {
        
    hrs_ist hrs_ist;
    }
    if (
    mins_ist 10)
    {
        
    mins_ist "0" mins_ist;
    }
    else
    {
        
    mins_ist mins_ist;
    }
    if (
    sec_ist 10)
    {
        
    sec_ist "0" sec_ist;
    }
    else
    {
        
    sec_ist sec_ist;
    }
    //send to text field
    digitalClock.text "IST " hrs_ist ":" mins_ist ":" sec_ist

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Location
    wolverhampton, united kingdom
    Posts
    8
    does not work =/ im thinking of creating them in action script 3 and then using the get time function in that =S but im not sure any advice ??

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    the code does work, as for as3 , sorry, cant help you

  5. #5
    Junior Member
    Join Date
    Oct 2012
    Location
    wolverhampton, united kingdom
    Posts
    8
    i have tried the code in my product but it doesn't show up the time i have checked all the names the code and put it all in the correct places and i cant seem to get it to work

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Post your fla, or a chunk of code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center