facebook pixel Using Flash ActionScript 3 in GrandVJ 1.2b1 | ArKaos VJ/DJ
By ArKaos Team
on 19 Oct 2009 12:00 AM
  • development
  • flash
  • grandvj

As you might have seen from the list of new features in GrandVJ 1.2, we now have support for Flash ActionScript 3.
(Update: MediaMaster also supports AS3 as of version 1.2, so this is valid forMediaMaster also).

The issue that prevented previous version to support ActionScript 3 was that Adobe has upgraded their security mechanism preventing global variable declarations to be exposed to external parties (as explained in this great tutorial by Ben Guerrette).

However, in ActionScript 3, you can declare functions to act as external interface, allowing to communicate with the Flash movie through a specified channel.

So in order to retrieve/set variables in ActionScript 3, you need to create two functions “arkSetVariable” & “arkGetVariable” and declare them as external interface:

import flash.external.ExternalInterface;


function arkSetVariable(varname:String, varval:String):void {

function arkGetVariable(varname:String):String {

The way you decide to implement these function is pretty much up to you. Since ActionScript 3 supports named arrays, an easy implementation would be:

function arkSetVariable(varname:String, varval:String):void {
arkVariable[varname]=varval ;

function arkGetVariable(varname:String):String {
return arkVariable[varname] ;

As these function use an array arkVariable using the variable name as index.

One last thing we need to do is to make sure the variable we need are initialised at startup. Failing to do this, they won’t exist in the array and GrandVJ will think they don’t exist and won’t update them.

Something like:

arkSetVariable("text","undefined") ;

Will call our function to set the “text” variable to “undefined” so that it is seen and updated by GrandVJ.

Here’s a little zip file containing a Flash file and it’s source code so you have a place to start with.

Let us know how it works for you!

Back to All posts