Archive for the 'Flash' Category

Parsing YouTube’s JSON data in Flash

To save other people from this headache:

import com.adobe.serialization.json.JSON;

var loader :URLLoader = new URLLoader();

var vid : String = "qE5hpp4YaH4";
loader.load(new URLRequest("http://gdata.youtube.com/feeds/api/videos/" + vid + "?v=2&alt=json-in-script&callback=remove"))

loader.addEventListener(Event.COMPLETE, onLoaded)

function onLoaded(e:Event):void{
	var youTubeDataString : String = e.target.data
	youTubeDataString=youTubeDataString.split("remove(").join("");
	youTubeDataString=youTubeDataString.split(");").join("");
	var youTubeDataObject : Object =JSON.decode(youTubeDataString)
	trace("Title: " + youTubeDataObject.entry.title.$t)
	var thumbnails : Object = youTubeDataObject.entry.media$group.media$thumbnail;
	trace("Thumbnail: " + youTubeDataObject.entry.media$group.media$thumbnail[thumbnails.length-1].url)
	trace("Description: " + youTubeDataObject.entry.media$group.media$description.$t)
}

The thumbnail section of this code grabs the HQ version which is 480×360 and is the last entry in the response JSON’s media$thumbnail area.

Good info: http://911-need-code-help.blogspot.com/2010/01/retrieve-youtube-video-title.html

Shine Draw

A great resource for side-by-side learning to grasp Silverlight from a Flash background: http://www.shinedraw.com/

Good, smart state management notifications.

The import:

import flash.utils.getQualifiedClassName;

In the constructors:

trace(getQualifiedClassName(this) + " started.");

In the clean up method:

trace(getQualifiedClassName(this) + " stopped.");

It pays to be overly retentive, especially on complex games ;)

Flash Platform Game Technology Center

http://www.adobe.com/devnet/games/

Custom Events…

I can never remember: http://www.charglerode.com/blog/?p=51

ASDocs…

Finally, how to make them… thanks Nick!

here.

Good to visit daily

http://www.adobe.com/devnet/

SWF MetaData

http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postId=12868

Getting some control over b2IDE

Best way to gain focus on the b2World that b2IDE creates to allow a custom collision listener:

//Stall for b2world adjustment:
addEventListener( Event.EXIT_FRAME, alterPhysics, false, 0, true );
function alterPhysics(e:Event) {
physics.world.SetContactListener(new ContactListener());
removeEventListener(Event.EXIT_FRAME, alterPhysics);
}

Cool AS3 Source

http://wonderfl.kayac.com/

Next Page »