Calculating Elapsed Time ActionScript

by Nathan 27. July 2009 09:58

 

function calculateTimeElapsed(startTime:Date,endTime:Date) {
    
    var sHours = startTime.getHours();
    var sMinutes = startTime.getMinutes();
     var sSeconds = startTime.getSeconds();
    var sMilliSeconds = startTime.getMilliseconds();

    var eHours = endTime.getHours();
    var eMinutes = endTime.getMinutes();
     var eSeconds = endTime.getSeconds();
    var eMilliSeconds = endTime.getMilliseconds();
    
    var sTimeSpan = (sHours*3600*1000) + (sMinutes*60*1000) + (sSeconds*1000) + (sMilliSeconds);
    var eTimeSpan = (eHours*3600*1000) + (eMinutes*60*1000) + (eSeconds*1000) + (eMilliSeconds);
    return eTimeSpan - sTimeSpan;
    
}

Tags: ,

Flash

Dynamically Creating Movie Clips in Flash

by Nathan 16. July 2009 05:19

var myText:TextField;

for (var i:Number = 1; i<6; i++) {
        this["clip"+i] = new MovieClip();
        this["clip"+i].graphics.beginFill(0xFFFF00);
        this["clip"+i].graphics.drawCircle(40, 40, 40);
        this["clip"+i].x=i*80;
        myText=new TextField;
        myText.width=250;
        myText.height=250;
        myText.text="clip" +i;
        myText.x=10;
        myText.y=20;
        this["clip"+i].addChild(myText);
        addChild(this["clip"+i]);
}

Tags: ,

Flash

Clearing All Textbox Programatically in ASP.NET Web Form

by Nathan 15. July 2009 11:04

There are multiple ways of doing this ie using JavaScript, but this is the server side solution.

You can adapt this method for several other solutions:

        foreach (Control c in this.Page.Controls)
        {                        
            if(c.GetType().FullName.Equals("System.Web.UI.HtmlControls.HtmlForm")) {
                foreach (Control cForm in c.Controls)
                {                        
                    if(cForm.GetType().Equals(typeof(TextBox))) {   
                        ((TextBox)(cForm)).Text = "";
                    }
                }
            }
        }

Tags:

ASP.NET

SQL UPDATE INNER JOIN

by Nathan 13. July 2009 06:41

 

If you want to update the data in a table by getting information from another table.  You can acheive this by using an update inner join query.

For example if i wanted to update the phone numbers in my table using a list of contacts from a secondary table, the UPDATE INNER JOIN Query would be like the one below:

UPDATE c
SET c.PhoneNumber = c2.PhoneNumber
FROM Contact AS c
INNER JOIN ContactTable2 c2 on c.Id = c2.Id
WHERE DateCreated > GETDATE()-60

Tags:

SQL

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen