How to get Flash to talk to Director

(The Swedish version of this page has been moved to www.heap.se)

Support for integrating Flash into Adobe Director (formerly Macromedia Director) has been around a long time. However, Director was constantly falling behind and not kept pace with the rapid development efforts that was put into Flash. ActionScript 3 was not supported in Director MX2004. Similarly, the support for Flash video was limited to the old Flash video codec, which was not very good. When Flash came with support for H264 (MPEG4), and the integration of On2, Flash video became one of the best thing that happened in a long time with regard to compatibility and quality for video on the web (YouTube).

The main advantage of using Flash media in Director is that it is vector based. This means that it is scalable in size without losing quality and sharpness as pixel based images does.

Flash ActionScript 2, (attached to a button)

// Flash AS2
on (release) {
    getURL ("event: myFlashEvent1 "This is Test 1" ");
    getURL ("event: myFlashEvent2 "This is Test 2" ");
    getURL ("event: myFlashEvent3 "This is Test 3" ");
    getURL ("lingo: sprite(5).setTrackEnabled(4, FALSE)");
}

ScriptText in Director

-- Lingo
on myFlashEvent1 str
  put str
end

Other ways to retrieve data from flash media. Sprite(1) is a Flash media and contains a text field with variable name "textfalt".

-- Director MX 2004
sprite(1).getVariable("_root.textfalt")
sprite(1).setVariable("_root.textfalt", "A new value")
 
-- Director
sprite(1).doThisFunction("Say this")

Flash ActionScript 2

// Flash MX AS2
function doThisFunction(varde:String) {
  _root.textfalt = varde;
}

Send Director lists to Flash as arrays

-- Director MX
-- Create a new flash object
caseLista = sp.newObject("Array")
-- loop
repeat with n=1 to gruppdb[ln].minter.count
  caseLista.push(gruppdb[ln].minter[n])
end repeat
 
-- syntax:
--caseLista = sprite(10).newObject("Array", "F1", "F3", "F4", "F5") 
sp.caseArray(caseLista)

Flash ActionScript 2

// Flash MX AS2
function caseArray(str:Array) {
    // Loop over the list
    var i:String;
    var out = "";
    for (i in str) {
        out += "" + str[i];
    }
    _root.stat += "" + out;
}
Copyright © 2017 HEAMEDIA,
heamusic

Login or Register | Privacy Policy