Archive for the ‘ActionScript 3.0’ Category

Passing Object from Flash AS3 to PHP

This item was filled under [ ActionScript 3.0, PHP ]

In previous post, we learnt how to pass an JSON encoded object from PHP to AS3. How about passing an Object from AS3 to PHP?
This example will show you how to do it. Take a look at the Flash ActionScript.

import flash.net.URLRequest;
import flash.net.URLLoader;
import com.adobe.serialization.json.JSON;

var people:Array = new Array();
var person:Object = new Object();
person.firstname = "Kobe";
person.lastname = "Bryant";
people.push(person);

var [...]

Continue reading...

Tagged with: [ , , , , ]

Communication between Flash & Javascript

This item was filled under [ ActionScript 3.0, Javascript ]

Sometimes there is a need for communication between Flash & Javascript. Below is the sample codes that work for ActionScript 3.0 and Javascript. The code might work for AS2 as well
To call a Javascript function from Actionscript,

function clickSend(eventObj:Object) {
jsArgument = "something";
var resultFromJS:Object=ExternalInterface.call("getTextFromFlash",jsArgument); call getTextFromFlash in Javascript;
received_ti.text; // return the text from JS
}

function getTextFromFlash(str) [...]

Continue reading...