PlayStation Unwrapped!

Here’s a little something we put together for SCEE this Christmas. They have been having a free gift givaway. No catch! Pure free gifty goodness! There were some amazing prizes to win, and a big juicy present to throw about to give you a clue to what’s inside!!!!

Hurry, it ends in two days!!

Oh well! It’s all finished now. According to our stats 311,377 people unwrapped 474,436 layers!! Not bad going.

Merry Christmas!

http://unwrapped.eu.playstation.com/

Targeting Flash Player 11 & AIR3 for Flash Builder 4.5

Step-by-step for overlaying AIR3 into Flex 4.5.1, and targeting FP11. Unfortunately it’s a little bit complicated at the moment. So here’s what I’ve learnt.

1. First download these:

Adobe AIR3 SDK

PlayerGlobal.swc

 

2. In finder go to “Mac HD > Applications > Adobe Flash Builder 4.5 > sdks” and duplicate “4.5.1”, rename it to “4.5.1-FP11” or something.

3. Create a folder 4.5.1-FP11/frameworks/libs/player/11.0/ and paste the downloaded playerglobal.swc inside (make sure you rename it to playerglobal.swc)

4. Place the Adobe AIR3 sdk .tbz2 file in the root of the sdk: “4.5.1-FP11/air3.tbz2”.

5. Mac OS: In Terminal, cd to the root directory of the new “4.5.1-FP11” and run this command:

1
tar jxvf air3X.tbz2

6. Run Flashbuilder.

7. Create a new ActionScript project, then click “configure flex sdks…” then add your new one targeting FP11.

8. Create a new project, then edit html-template/index.template and add this after line 48:

1
params.wmode ='direct';

9. Right-click on your project in FB navigate to “Properties > ActionScript Compiler”, then add the following compiler argument:

1
-swf-version=13

 

You should be good to go!

 

 

Other resources:
http://kb2.adobe.com/cps/495/cpsid_49532.html

 

Posted in AS3

functionToString: Return function name as String in AS3

As simple as this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import flash.utils.describeType;

function functionToString(target:*, f:Function):String
{
  var functionName:String = "error!";
  var type:XML = describeType(target)
  for each (var node:XML in type..method) {
    if (target[node.@name] == f) {
      functionName = node.@name;
      break;
    }
  }
 
  return functionName;
}


function foo():void {
}

function bar():void {
}

trace(functionToString(this, foo)); // returns "foo"
trace(functionToString(this, bar)); // returns "bar"
Posted in AS3

Ableton Live to Flash (AS3)

After seeing Surya Buchwald (http://www.mmmlabs.com) demoing Ableton Live to Flash at Flash on the Beach 2011, I had to find out how it was done. So I got in touch and was led to a link to download their ‘Music Event Description System’. It is a ‘Max for Live’ addon that enables Ableton Live to output OSC messages. I then recieve this data in Flosc which converts the OSC messages from UDP to XML so the data can be used in AS3 via an XML Socket. The rest is magic, and a couple of MovieClips 🙂

Set Properties Function AS3

Here’s a simple, but very useful function that sets the properties of a specified target, with properties of an object.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* Set properties from object
*/

function setProps($target:Object, $props:Object):void
{
  for(var p:String in $props)
  {
    $target[p] = $props[p];
  }
}

// Example use
import flash.text.TextFormat;

var props:Object = {leading:12, color:0xFF0000, size:24};
var tf:TextFormat = new TextFormat();

setProps(tf, props);    // Set the properties of tf with props object

trace(tf.leading + ", " + tf.color + ", " + tf.size);     // check the result
Posted in AS3

YouTube Player API – Sound but No Video (AS3 Gotcha)

Here is a gotcha for the YouTube Player AS3 API . I was trying to use the chromeless player, hearing sound, but not seeing any video. The player was added to the display list, alpha=1, visible=true and it was the only display object.

Solution…

If you use the embedded player, you can call the player.resize() method before the video is playing because the video has already been cued. But if you want to use the chromeless player, you can only call player.resize() after you have cued/loaded a video, not just when the player has dispatched the ‘ready’ event.

Hope this helps someone!

Posted in AS3