Labels

Thursday, July 7, 2011

Associative arrays in ActionScript 3

The Array class provides methods and properties that work with number-indexed arrays only--and not with associative arrays. Associative arrays should be instances of the Object class.

Technically, since the Object class is the base class for all ActionScript classes, all ActionScript objects can be used as associative arrays. However, unless you have some specific reason for using another class as an associative array, it is best to simply use the generic Object class.

var memebers:Object = {scribe: "Franklin",
                      chairperson: "Gina",
                       treasurer: "Sindhu"};
var members:Object = new Object( );
members.scribe = "Franklin";
members.chairperson = "Gina";
members.treasurer = "Sindhu";
var members:Object = new Object( );
members["councilperson"] = "Ruthie";
trace(members.councilperson);         // Displays: Ruthie
members.councilperson = "Rebecca";
trace(members["councilperson"]);      // Displays: Rebecca
More information at the source:
http://digitalmedia.oreilly.com/helpcenter/actionscript30cookbook/chapter5.html?page=8

Friday, September 10, 2010

Inspiring Quote by Steve Jobs

Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure — these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.

Sunday, September 5, 2010

Upgrade your WordPress site or blog for free..

Yes, you heard that right... got a WordPress site or blog ? if yes, MULTIDOTS offers free upgradation to latest version of WordPress.




visit : http://www.guptaanil.com/free-wordpress-upgrade-at-multidots/

Its a campaign cum activity started by WordPress group at MULTIDOTS.
So hurry up and avail yourself of new features offered by latest version of wp....

Thursday, August 5, 2010

jQuery: How to submit a form with AJAX in jQuery

Excellent explanation of how to submit a form with ajax using jquery - visit :

http://www.ajaxlines.com/ajax/stuff/article/how_to_submit_a_form_with_ajax_in_jquery.php

jQuery: Access value of selected/checked radio button

if you have a group of radio buttons (grouping done using same value for name attribute in all) and you want to get value of selected radio button out of them,
using jquery you can do that with below code snippet:

Suppose you have:

Diya [name="bolly",value="diya"]
Kareena [name="bolly",value="kareena"]
Katrina [name="bolly",value="katrina"]

Then,
var sel_val = $('input:radio[name=bolly]:checked').val();

You will get: sel_val = "diya"


For more reference:
http://stackoverflow.com/questions/986120/how-to-get-select-radiobutton-value-using-its-name-in-jquery

Monday, June 28, 2010

Javascript: Inline javascript function in event handler declaration

If you want to write javascript function code directly in the onclick event handler declaration instead of using a separate function for that code, you can do it as follows:

<input type="button" value="Save" onclick="javascript:(function(){ //your code; })();"/>

Monday, May 31, 2010

Google Maps: Best Fit Zoom Level and Center Point.

If you are working with Google maps and have an array of latitude longitude points to plot as markers on map, then you might need to calculate the best fit zoom level and map center point so that all the lat lng points can accommodate comfortably. Here's the code snippet:
// map: an instance of GMap2
// latlng: an array of instances of GLatLng
var latlngbounds = new GLatLngBounds();
for (var i = 0; i < latlng.length; i++)
{
latlngbounds.extend(latlng[i]);
}
map.setCenter(latlngbounds.getCenter(),map.getBoundsZoomLevel(latlngbounds));

For further reference:
http://911-need-code-help.blogspot.com/2009/03/zoom-to-fit-all-markers-polylines-or.html