AS3 – Access root from a movie clip

Use like this to access root from a movie clip

MovieClip(root).someThing;

For example suppose you have a text box in root with instance name txtAddress in your root. If you need to set the text of txtAddress from a movie clip the code should be like

MovieClip(root).txtAddress.text = "Some text here."
Posted in ActionScript | Tagged , , | 4 Comments

ActionScript : Find code execution time

Using the script below you can find how much time it took to execute your ActionScript code

var startTime:Date = new Date();

// execute your code here

var endTime:Date = new Date();
trace("Time take to execute the code "+String(endTime.getTime()-startTime.getTime())+" milliseconds");

Check PHP version here

Check Javascript version here

Posted in ActionScript, Flash/Flex, Web development | Tagged , , | Leave a comment

VBScript : Find script execution time

Using the script below you can find how much time it took to execute your VBScript code.

Dim startTime
startTime = Now

'execute your code here

endTime = Now
MsgBox("Time taken to execute code : " & DateDiff("s",startTime,endTime)&" seconds")

You can try this example

Dim startTime
startTime = Now

'execute your code here
MsgBox("Wait for sometime")

endTime = Now
MsgBox("Time taken to execute code : " & DateDiff("s",startTime,endTime)&" seconds")

Check PHP version here

Posted in VBScript | Tagged , | Leave a comment

Javascript : Find script execution time

Using the script below you can find how much time it took to execute your javascript code.

var startDate = new Date();

// execute your tasks here

var endDate = new Date();

var timeTaken = endDate.getTime() - startDate.getTime();

alert('Time take to execute the script is '+timeTaken+' milliseconds');

You can try this example


// USE OF THIS FUNCTION IS NOT RECOMMENDED, CONSUMES LOT OF SYSTEM RESOURCES
function sleep(milliSeconds){
	var startTime = new Date().getTime(); // get the current time
	while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}

var startDate = new Date();

// execute your tasks here
sleep(300); // parameter is milliseconds

var endDate = new Date();
var timeTaken = endDate.getTime() - startDate.getTime();

alert('Time take to execute the script is '+timeTaken+' milliseconds');

sleep function taken from http://www.devcheater.com/#JavaScript sleep by loop. Usage of this sleep function is not recommended, shown only for demo purpose.

Check PHP version here

Posted in JavaScript, Web development | Tagged , | 4 Comments

Chrome : Find all installed plugins

about:plugins

Type about:plugins in Google Chrome address bar and hit Enter to view all installed plugins.

From this screen you can Enable or Disable a plugin.

Posted in Google Chrome, Web Browsers | Tagged , , | Leave a comment