Wednesday, April 29, 2009

Useful HTML Meta Tags

Note the keywords "HTTP-EQUIV", "Name" and "Content" are case-insensitive. Their values are also case-insensitive.

Tag Name Example(s) Description
Author <META NAME="AUTHOR" CONTENT="Tex Texin" /> The author's name.

Public - may be cached in public shared caches

Private - may only be cached in private cache

no-Cache - may not be cached

no-Store - may be cached but not archived

The directive CACHE-CONTROL:NO-CACHE indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the PRAGMA:NO-CACHE.

Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.

Also see EXPIRES.

Note: It may be better to specify cache commands in HTTP than in META statements, where they can influence more than the browser, but proxies and other intermediaries that may cache information.

Content-Language <META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="en-US,fr" /> Declares the primary natural language(s) of the document. May be used by search engines to categorize by language.
CONTENT-TYPE <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8" /> The HTTP content type may be extended to give the character set. It is recommended to always use this tag and to specify the charset.
Copyright <META NAME="COPYRIGHT" CONTENT="&copy; 2004 Tex Texin" /> A copyright statement.
DESCRIPTION <META NAME="DESCRIPTION" CONTENT="...summary of web page..." /> The text can be used when printing a summary of the document. The text should not contain any formatting information. Used by some search engines to describe your document. Particularly important if your document has very little text, is a frameset, or has extensive scripts at the top.
EXPIRES <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT" /> The date and time after which the document should be considered expired. An illegal EXPIRES date, e.g. "0", is interpreted as "now". Setting EXPIRES to 0 may thus be used to force a modification check at each visit.

Web robots may delete expired documents from a search engine, or schedule a revisit.

HTTP 1.1 (RFC 2068) specifies that all HTTP date/time stamps MUST be generated in Greenwich Mean Time (GMT) and in RFC 1123 format.

RFC 1123 format = wkday "," SP date SP time SP "GMT"

wkday = (Mon, Tue, Wed, Thu, Fri, Sat, Sun)

date = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982)

time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; 00:00:00 - 23:59:59

month = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)

Keywords <META NAME="KEYWORDS" CONTENT="sex, drugs, rock & roll" /> The keywords are used by some search engines to index your document in addition to words from the title and document body. Typically used for synonyms and alternates of title words. Consider adding frequent misspellings. e.g. heirarchy, hierarchy.
PRAGMA NO-CACHE <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" /> This directive indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the CACHE-CONTROL:NO-CACHE directive and is provided for backwards compatibility with HTTP/1.0.

Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.

HTTP/1.1 clients SHOULD NOT send the PRAGMA request-header. HTTP/1.1 caches SHOULD treat "PRAGMA:NO-CACHE" as if the client had sent "CACHE-CONTROL:NO-CACHE".

Also see EXPIRES.
Refresh <META HTTP-EQUIV="REFRESH" CONTENT="15;URL=" /> Specifies a delay in seconds before the browser automatically reloads the document. Optionally, specifies an alternative URL to load, making this command useful for redirecting browsers to other pages.




default = empty = "ALL"


The CONTENT field is a comma separated list:

INDEX: search engine robots should include this page.

FOLLOW: robots should follow links from this page to other pages.

NOINDEX: links can be explored, although the page is not indexed.

NOFOLLOW: the page can be indexed, but no links are explored.

NONE: robots can ignore the page.

NOARCHIVE: Google uses this to prevent archiving of the page. See

GOOGLEBOT <META NAME="GOOGLEBOT" CONTENT="NOARCHIVE" /> In addition to the ROBOTS META Command above, Google supports a GOOGLEBOT command. With it, you can tell Google that you do not want the page archived, but allow other search engines to do so. If you specify this command, Google will not save the page and the page will be unavailable via its cache.

See Google's FAQ.

Sunday, April 26, 2009

Flash AS3 - Draw lines

var lineDrawing:MovieClip = new MovieClip();;,0); //start from 0,0, 50); //draw line to 50,50

//to clear the drawings:;

Thursday, April 23, 2009

Flash AS3 TransitionManager class

//Imports TransitionManager class along with all available transition types and easing functions.
import fl.transitions.*;
import fl.transitions.easing.*;

// Declare global variables
var tMgr:TransitionManager;

// apply the transition to MovieClip object
tMgr = new TransitionManager(MovieClip);
tMgr.startTransition({type:Iris, direction:Transition.OUT, duration:2, easing:Regular.easeOut});
tMgr.addEventListener("allTransitionsOutDone", whenDone); // when the transition done, execute whenDone function

function whenDone(e:Event):void {
//some actions here

transition types available:

Flash AS3 Tweening

// Importing classes from fl package must be done explicitly
import fl.transitions.Tween;
import fl.transitions.easing.*;

// Declare variables for the tween movement. These could just as easily be local below.
var moveBackX:Tween;
var moveBackY:Tween;
var moveRound:Tween;

moveBackX = new Tween(dragger, "x", Strong.easeOut, dragger.x, holder.x, 0.5, true);
moveBackY = new Tween(dragger, "y", Strong.easeOut, dragger.y, holder.y, 0.5, true);
moveRound = new Tween(dragger, "rotation", Strong.easeIn, 0, 180, 0.5, true);

Tuesday, April 21, 2009

AS3 - Set frameRate at runtime

Framerate can now be set at runtime on per-VM instance basis (ie. it will affect all timelines, including loaded SWFs).

stage.frameRate = fps; //0.01 - 1000

AS3 - Use getStackTrace for debugging

You can use the getStackTrace method of an Error instance for general debugging purposes. This will output the execution stack like so:

Test condition @Error
at Untitled_fla::MainTimeline/testingSomething()
at Untitled_fla::MainTimeline/MyThing_fla::frame1()


function testingSomething():void {
if (testCondition) {
//include a stack trace with our debug trace:
trace("Test condition @" + (new Error()).getStackTrace());

Depths in AS3

In AS3 it is easiest to work with depths in relative terms: Which element should be on top of the other?

Most people think this way anyway, the language reflects that now.

// get the depth of an existing sprite:
var depth:uint = getChildIndex(topMC);

//place mySprite under topMC:
addChildAt(mySprite, depth);

// or just:
addChildAt(mySprite, getChildIndex(topMC));

// directly set depth index:
setChildIndex(myMC, depth);

AS3 New TextField methods

There are a number of new methods on text fields that allow you to work with text in more interactive manner, including methods to convert character indexes to pixel positions, find lengths of lines and paragraphs, get line metrics (ascent, descent, leading, etc), and more.

//px position of chars & vice versa:

//and a TON more:

Flash - Double click event in AS3

AS3 adds a DOUBLE_CLICK event that uses the system setting for double click speed. Note that you will still get a click event before the double click event.

myButton.addEventListener(MouseEvent.DOUBLE_CLICK, handleDoubleClick);
myButton.doubleClickEnabled = true;

Flash - Create text link in AS3

HTML text fields no longer support "asfunction:" links. Instead they support "event:" links, which will generate a TextEvent.

myTextField.htmlText = "<a href="event:text">test</a>";
myTextField.addEventListener(TextEvent.LINK, handleLink);

function handleLink(evt:TextEvent):void {