PageRenderTime 25ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/projects/jag-6.1/templates/java5_2_tier/src/web-tapestry4/js/dojo/src/flash.js

https://gitlab.com/essere.lab.public/qualitas.class-corpus
JavaScript | 703 lines | 274 code | 70 blank | 359 comment | 69 complexity | 8009fb0b9743692380b1a97a3db47310 MD5 | raw file
  1. /*
  2. Copyright (c) 2004-2005, The Dojo Foundation
  3. All Rights Reserved.
  4. Licensed under the Academic Free License version 2.1 or above OR the
  5. modified BSD license. For more information on Dojo licensing, see:
  6. http://dojotoolkit.org/community/licensing.shtml
  7. */
  8. dojo.provide("dojo.flash");
  9. dojo.require("dojo.string.*");
  10. dojo.require("dojo.uri.*");
  11. /**
  12. Provides an easy object for interacting with the Flash plugin. This
  13. object provides methods to determine the current version of the Flash
  14. plugin (dojo.flash.info); execute Flash instance methods
  15. independent of the Flash version
  16. being used (dojo.flash.comm); write out the necessary markup to
  17. dynamically insert a Flash object into the page (dojo.flash.Embed; and
  18. do dynamic installation and upgrading of the current Flash plugin in
  19. use (dojo.flash.Install).
  20. To use dojo.flash, you must first wait until Flash is finished loading
  21. and initializing before you attempt communication or interaction.
  22. To know when Flash is finished use dojo.event:
  23. dojo.event.bind(dojo.flash, "loaded", myInstance, "myCallback");
  24. Then, while the page is still loading provide the file name
  25. and the major version of Flash that will be used for Flash/JavaScript
  26. communication (see "Flash Communication" below for information on the
  27. different kinds of Flash/JavaScript communication supported and how they
  28. depend on the version of Flash installed):
  29. dojo.flash.setSwf({flash8: "src/storage/storage_flash8.swf"});
  30. This will cause dojo.flash to load and initialize your
  31. Flash file "src/storage/storage_flash8.swf, and use the Flash 8
  32. ExternalInterface for Flash/JavaScript communication.
  33. If you want to use Flash 6 features for communication between
  34. Flash and JavaScript, use the following:
  35. dojo.flash.setSwf({flash6: "src/storage/storage_flash6.swf"});
  36. Flash 6 is currently the best way to do Flash/JavaScript communication
  37. (see the section "Flash Communication" below for further
  38. details), but doesn't work on all browers. If you want dojo.flash to
  39. pick the best way of communicating
  40. based on the platform, specify Flash files for both forms of
  41. communication:
  42. dojo.flash.setSwf({flash6: "src/storage/storage_flash6.swf",
  43. flash8: "src/storage/storage_flash8.swf"});
  44. If no SWF files are specified, then Flash is not initialized.
  45. Your Flash must use DojoExternalInterface to expose Flash methods and
  46. to call JavaScript; see "Flash Communication" below for details.
  47. setSwf can take an optional 'visible' attribute to control whether
  48. the Flash file is visible or not; the default is visible:
  49. dojo.flash.setSwf({flash6: "src/storage/storage_flash6.swf",
  50. flash8: "src/storage/storage_flash8.swf",
  51. visible: false});
  52. Once finished, you can query Flash version information:
  53. dojo.flash.info.version
  54. Or can communicate with Flash methods that were exposed:
  55. var results = dojo.flash.comm.sayHello("Some Message");
  56. Only string values are currently supported.
  57. -------------------
  58. Flash Communication
  59. -------------------
  60. dojo.flash allows Flash/JavaScript communication in
  61. a way that can pass large amounts of data back and forth reliably,
  62. very fast, and with synchronous method calls. The dojo.flash
  63. framework encapsulates the specific way in which this communication occurs,
  64. presenting a common interface to JavaScript irrespective of the underlying
  65. Flash version.
  66. There are currently three major ways to do Flash/JavaScript communication
  67. in the Flash community:
  68. 1) Flash 6+ - Uses Flash methods, such as SetVariable and TCallLabel,
  69. and the fscommand handler to do communication. Strengths: Very fast,
  70. mature, and can send extremely large amounts of data; can do
  71. synchronous method calls. Problems: Does not work on Safari; works on
  72. Firefox/Mac OS X only if Flash 8 plugin is installed; cryptic to work with.
  73. 2) Flash 8+ - Uses ExternalInterface, which provides a way for Flash
  74. methods to register themselves for callbacks from JavaScript, and a way
  75. for Flash to call JavaScript. Strengths: Works on Safari; elegant to
  76. work with; can do synchronous method calls. Problems: Extremely buggy
  77. (fails if there are new lines in the data, for example); two orders of
  78. magnitude slower than the Flash 6+ method; locks up the browser while
  79. it is communicating.
  80. 3) Flash 6+ - Uses two seperate Flash applets, one that we
  81. create over and over, passing input data into it using the PARAM tag,
  82. which then uses a Flash LocalConnection to pass the data to the main Flash
  83. applet; communication back to Flash is accomplished using a getURL
  84. call with a javascript protocol handler, such as "javascript:myMethod()".
  85. Strengths: the most cross browser, cross platform pre-Flash 8 method
  86. of Flash communication known; works on Safari. Problems: Timing issues;
  87. clunky and complicated; slow; can only send very small amounts of
  88. data (several K); all method calls are asynchronous.
  89. dojo.flash.comm uses only the first two methods. This framework
  90. was created primarily for dojo.storage, which needs to pass very large
  91. amounts of data synchronously and reliably across the Flash/JavaScript
  92. boundary. We use the first method, the Flash 6 method, on all platforms
  93. that support it, while using the Flash 8 ExternalInterface method
  94. only on Safari with some special code to help correct ExternalInterface's
  95. bugs.
  96. Since dojo.flash needs to have two versions of the Flash
  97. file it wants to generate, a Flash 6 and a Flash 8 version to gain
  98. true cross-browser compatibility, several tools are provided to ease
  99. development on the Flash side.
  100. In your Flash file, if you want to expose Flash methods that can be
  101. called, use the DojoExternalInterface class to register methods. This
  102. class is an exact API clone of the standard ExternalInterface class, but
  103. can work in Flash 6+ browsers. Under the covers it uses the best
  104. mechanism to do communication:
  105. class HelloWorld{
  106. function HelloWorld(){
  107. // Initialize the DojoExternalInterface class
  108. DojoExternalInterface.initialize();
  109. // Expose your methods
  110. DojoExternalInterface.addCallback("sayHello", this, this.sayHello);
  111. // Tell JavaScript that you are ready to have method calls
  112. DojoExternalInterface.loaded();
  113. // Call some JavaScript
  114. DojoExternalInterface.call("someJavaScriptMethod");
  115. }
  116. function sayHello(){ ... }
  117. static main(){ ... }
  118. }
  119. DojoExternalInterface adds to new functions to the ExternalInterface
  120. API: initialize() and loaded(). Initialize() must be called before
  121. any addCallback() or call() methods are run, and loaded() must be
  122. called after you are finished adding your callbacks. Calling loaded()
  123. will fire the dojo.flash.loaded() event, so that JavaScript can know that
  124. Flash has finished loading and adding its callbacks, and can begin to
  125. interact with the Flash file.
  126. To generate your SWF files, use the ant task
  127. "buildFlash". You must have the open source Motion Twin ActionScript
  128. compiler (mtasc) installed and in your path to use the "buildFlash"
  129. ant task; download and install mtasc from http://www.mtasc.org/.
  130. buildFlash usage:
  131. ant buildFlash -Ddojo.flash.file=../tests/flash/HelloWorld.as
  132. where "dojo.flash.file" is the relative path to your Flash
  133. ActionScript file.
  134. This will generate two SWF files, one ending in _flash6.swf and the other
  135. ending in _flash8.swf in the same directory as your ActionScript method:
  136. HelloWorld_flash6.swf
  137. HelloWorld_flash8.swf
  138. Initialize dojo.flash with the filename and Flash communication version to
  139. use during page load; see the documentation for dojo.flash for details:
  140. dojo.flash.setSwf({flash6: "tests/flash/HelloWorld_flash6.swf",
  141. flash8: "tests/flash/HelloWorld_flash8.swf"});
  142. Now, your Flash methods can be called from JavaScript as if they are native
  143. Flash methods, mirrored exactly on the JavaScript side:
  144. dojo.flash.comm.sayHello();
  145. Only Strings are supported being passed back and forth currently.
  146. -------------------
  147. Notes
  148. -------------------
  149. If you have both Flash 6 and Flash 8 versions of your file:
  150. dojo.flash.setSwf({flash6: "tests/flash/HelloWorld_flash6.swf",
  151. flash8: "tests/flash/HelloWorld_flash8.swf"});
  152. but want to force the browser to use a certain version of Flash for
  153. all platforms (for testing, for example), use the djConfig
  154. variable 'forceFlashComm' with the version number to force:
  155. var djConfig = { forceFlashComm: 6 };
  156. Two values are currently supported, 6 and 8, for the two styles of
  157. communication described above.
  158. Also note that dojo.flash can currently only work with one Flash applet
  159. on the page; it and the API do not yet support multiple Flash applets on
  160. the same page.
  161. @author Brad Neuberg, bkn3@columbia.edu
  162. */
  163. dojo.flash = {
  164. flash6_version: null,
  165. flash8_version: null,
  166. _visible: true,
  167. /** Sets the SWF files and versions we are using. */
  168. setSwf: function(fileInfo){
  169. if(fileInfo == null || dojo.lang.isUndefined(fileInfo)){
  170. return;
  171. }
  172. if(fileInfo.flash6 != null && !dojo.lang.isUndefined(fileInfo.flash6)){
  173. this.flash6_version = fileInfo.flash6;
  174. }
  175. if(fileInfo.flash8 != null && !dojo.lang.isUndefined(fileInfo.flash8)){
  176. this.flash8_version = fileInfo.flash8;
  177. }
  178. if(fileInfo.visible){
  179. this._visible = fileInfo.visible;
  180. }
  181. // now initialize ourselves
  182. this._initialize();
  183. },
  184. /** Returns whether we are using Flash 6 for communication on this platform. */
  185. useFlash6: function(){
  186. if(this.flash6_version == null){
  187. return false;
  188. }else if (this.flash6_version != null && dojo.flash.info.commVersion == 6){
  189. // if we have a flash 6 version of this SWF, and this browser supports
  190. // communicating using Flash 6 features...
  191. return true;
  192. }else{
  193. return false;
  194. }
  195. },
  196. /** Returns whether we are using Flash 8 for communication on this platform. */
  197. useFlash8: function(){
  198. if(this.flash8_version == null){
  199. return false;
  200. }else if (this.flash8_version != null && dojo.flash.info.commVersion == 8){
  201. // if we have a flash 8 version of this SWF, and this browser supports
  202. // communicating using Flash 8 features...
  203. return true;
  204. }else{
  205. return false;
  206. }
  207. },
  208. /** Initializes dojo.flash. */
  209. _initialize: function(){
  210. // do nothing if no SWF files are defined
  211. if(this.flash6_version == null && this.flash8_version == null){
  212. this.info = new Object();
  213. this.info.capable = false;
  214. return;
  215. }
  216. // find out if Flash is installed
  217. this.info = new dojo.flash.Info();
  218. // if we are not installed, install Flash
  219. if(this.info.capable == false){
  220. var installer = new dojo.flash.Install();
  221. installer.install();
  222. }else if(this.info.capable == true){
  223. // write the flash object into the page
  224. dojo.flash.obj = new dojo.flash.Embed();
  225. dojo.flash.obj.setVisible(this._visible);
  226. dojo.flash.obj.write();
  227. // initialize the way we do Flash/JavaScript communication
  228. dojo.flash.comm = new dojo.flash.Communicator();
  229. }
  230. },
  231. /**
  232. A callback when the Flash subsystem is finished loading and can be
  233. worked with. To be notified when Flash is finished loading, connect
  234. your callback to this method using the following:
  235. dojo.event.connect(dojo.flash, "loaded", myInstance, "myCallback");
  236. */
  237. loaded: function(){
  238. }
  239. };
  240. /**
  241. A class that helps us determine whether Flash is available,
  242. it's major and minor versions, and what Flash version features should
  243. be used for Flash/JavaScript communication. Parts of this code
  244. are adapted from the automatic Flash plugin detection code autogenerated
  245. by the Macromedia Flash 8 authoring environment.
  246. An instance of this class can be accessed on dojo.flash.info after
  247. the page is finished loading.
  248. This constructor must be called before the page is finished loading.
  249. */
  250. dojo.flash.Info = function(){
  251. // Visual basic helper required to detect Flash Player ActiveX control
  252. // version information on Internet Explorer
  253. if(dojo.render.html.ie){
  254. document.writeln('<script language="VBScript" type="text/vbscript"\>');
  255. document.writeln('Function VBGetSwfVer(i)');
  256. document.writeln(' on error resume next');
  257. document.writeln(' Dim swControl, swVersion');
  258. document.writeln(' swVersion = 0');
  259. document.writeln(' set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))');
  260. document.writeln(' if (IsObject(swControl)) then');
  261. document.writeln(' swVersion = swControl.GetVariable("$version")');
  262. document.writeln(' end if');
  263. document.writeln(' VBGetSwfVer = swVersion');
  264. document.writeln('End Function');
  265. document.writeln('</script\>');
  266. }
  267. this._detectVersion();
  268. this._detectCommunicationVersion();
  269. }
  270. dojo.flash.Info.prototype = {
  271. /** The full version string, such as "8r22". */
  272. version: -1,
  273. /**
  274. The major, minor, and revisions of the plugin. For example, if the
  275. plugin is 8r22, then the major version is 8, the minor version is 0,
  276. and the revision is 22.
  277. */
  278. versionMajor: -1,
  279. versionMinor: -1,
  280. versionRevision: -1,
  281. /** Whether this platform has Flash already installed. */
  282. capable: false,
  283. /**
  284. The major version number for how our Flash and JavaScript communicate.
  285. This can currently be the following values:
  286. 6 - We use a combination of the Flash plugin methods, such as SetVariable
  287. and TCallLabel, along with fscommands, to do communication.
  288. 8 - We use the ExternalInterface API.
  289. -1 - For some reason neither method is supported, and no communication
  290. is possible.
  291. */
  292. commVersion: 6,
  293. /**
  294. Asserts that this environment has the given major, minor, and revision
  295. numbers for the Flash player. Returns true if the player is equal
  296. or above the given version, false otherwise.
  297. Example: To test for Flash Player 7r14:
  298. dojo.flash.info.isVersionOrAbove(7, 0, 14)
  299. */
  300. isVersionOrAbove: function(reqMajorVer, reqMinorVer, reqVer){
  301. // make the revision a decimal (i.e. transform revision 14 into
  302. // 0.14
  303. reqVer = parseFloat("." + reqVer);
  304. if(this.versionMajor > reqMajorVer && this.version >= reqVer){
  305. return true;
  306. }else if(this.version >= reqVer && this.versionMinor >= reqMinorVer){
  307. return true;
  308. }else{
  309. return false;
  310. }
  311. },
  312. _detectVersion: function(){
  313. var versionStr;
  314. // loop backwards through the versions until we find the newest version
  315. for(var testVersion = 25; testVersion > 0; testVersion--){
  316. if(dojo.render.html.ie){
  317. versionStr = VBGetSwfVer(testVersion);
  318. }else{
  319. versionStr = this._JSFlashInfo(testVersion);
  320. }
  321. if(versionStr == -1 ){
  322. this.capable = false;
  323. return;
  324. }else if(versionStr != 0){
  325. var versionArray;
  326. if(dojo.render.html.ie){
  327. var tempArray = versionStr.split(" ");
  328. var tempString = tempArray[1];
  329. versionArray = tempString.split(",");
  330. }else{
  331. versionArray = versionStr.split(".");
  332. }
  333. this.versionMajor = versionArray[0];
  334. this.versionMinor = versionArray[1];
  335. this.versionRevision = versionArray[2];
  336. // 7.0r24 == 7.24
  337. versionString = this.versionMajor + "." + this.versionRevision;
  338. this.version = parseFloat(versionString);
  339. this.capable = true;
  340. break;
  341. }
  342. }
  343. },
  344. /**
  345. JavaScript helper required to detect Flash Player PlugIn version
  346. information. Internet Explorer uses a corresponding Visual Basic
  347. version to interact with the Flash ActiveX control.
  348. */
  349. _JSFlashInfo: function(testVersion){
  350. // NS/Opera version >= 3 check for Flash plugin in plugin array
  351. if(navigator.plugins != null && navigator.plugins.length > 0){
  352. if(navigator.plugins["Shockwave Flash 2.0"] ||
  353. navigator.plugins["Shockwave Flash"]){
  354. var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
  355. var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
  356. var descArray = flashDescription.split(" ");
  357. var tempArrayMajor = descArray[2].split(".");
  358. var versionMajor = tempArrayMajor[0];
  359. var versionMinor = tempArrayMajor[1];
  360. if(descArray[3] != ""){
  361. tempArrayMinor = descArray[3].split("r");
  362. }else{
  363. tempArrayMinor = descArray[4].split("r");
  364. }
  365. var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
  366. var version = versionMajor + "." + versionMinor + "."
  367. + versionRevision;
  368. return version;
  369. }
  370. }
  371. return -1;
  372. },
  373. /**
  374. Detects the mechanisms that should be used for Flash/JavaScript
  375. communication, setting 'commVersion' to either 6 or 8. If the value is
  376. 6, we use Flash Plugin 6+ features, such as GetVariable, TCallLabel,
  377. and fscommand, to do Flash/JavaScript communication; if the value is
  378. 8, we use the ExternalInterface API for communication.
  379. */
  380. _detectCommunicationVersion: function(){
  381. // we prefer Flash 6 features over Flash 8, because they are much faster
  382. // and much less buggy
  383. // does the Flash plugin have some of the Flash methods?
  384. // otherwise, is the ExternalInterface API present?
  385. }
  386. };
  387. /** A class that is used to write out the Flash object into the page. */
  388. dojo.flash.Embed = function(){
  389. }
  390. dojo.flash.Embed.prototype = {
  391. /**
  392. The width of this Flash applet. The default is the minimal width
  393. necessary to show the Flash settings dialog.
  394. */
  395. width: 215,
  396. /**
  397. The height of this Flash applet. The default is the minimal height
  398. necessary to show the Flash settings dialog.
  399. */
  400. width: 138,
  401. /** The id of the Flash object. */
  402. id: "flashObject",
  403. /** Controls whether this is a visible Flash applet or not. */
  404. _visible: true,
  405. /**
  406. Writes the Flash into the page. This must be called before the page
  407. is finished loading.
  408. */
  409. write: function(){
  410. // determine our container div's styling
  411. var containerStyle = new dojo.string.Builder();
  412. containerStyle.append("width: " + this.width + "px; ");
  413. containerStyle.append("height: " + this.height + "px; ");
  414. if(this._visible == false){
  415. containerStyle.append("position: absolute; ");
  416. containerStyle.append("z-index: 100; ");
  417. containerStyle.append("top: -1000px; ");
  418. containerStyle.append("left: -1000px; ");
  419. }
  420. containerStyle = containerStyle.toString();
  421. // Flash 6
  422. if(dojo.flash.useFlash6()){
  423. var swfloc = dojo.flash.flash6_version;
  424. document.writeln('<div id="' + this.id + 'Div" style="' + containerStyle + '">');
  425. document.writeln(' <embed id="' + this.id + '" src="' + swfloc + '" ');
  426. document.writeln(' quality="high" bgcolor="#ffffff" ');
  427. document.writeln(' width="' + this.width + '" height="' + this.height + '" name="' + this.id + '" ');
  428. document.writeln(' align="middle" allowScriptAccess="sameDomain" ');
  429. document.writeln(' type="application/x-shockwave-flash" swLiveConnect="true" ');
  430. document.writeln(' pluginspage="http://www.macromedia.com/go/getflashplayer"> ');
  431. document.writeln('</div>');
  432. }
  433. // Flash 8
  434. else if (dojo.flash.useFlash8()){
  435. var swfloc = dojo.uri.dojoUri(dojo.flash.flash8_version).toString();
  436. }
  437. },
  438. /** Gets the Flash object DOM node. */
  439. get: function(){
  440. return (dojo.render.html.ie) ? window[this.id] : document[this.id];
  441. },
  442. /** Sets the visibility of this Flash object. */
  443. setVisible: function(){
  444. //FIXME: Dynamically make the movie visible or not
  445. },
  446. /** Centers the flash applet on the page. */
  447. center: function(){
  448. }
  449. };
  450. /**
  451. A class that is used to communicate between Flash and JavaScript in
  452. a way that can pass large amounts of data back and forth reliably,
  453. very fast, and with synchronous method calls. This class encapsulates the
  454. specific way in which this communication occurs,
  455. presenting a common interface to JavaScript irrespective of the underlying
  456. Flash version.
  457. */
  458. dojo.flash.Communicator = function(){
  459. if(dojo.flash.useFlash6()){
  460. this._writeFlash6();
  461. }else if (dojo.flash.useFlash8()){
  462. this._writeFlash8();
  463. }
  464. }
  465. dojo.flash.Communicator.prototype = {
  466. _writeFlash6: function(){
  467. var id = dojo.flash.obj.id;
  468. // global function needed for Flash 6 callback;
  469. // we write it out as a script tag because the VBScript hook for IE
  470. // callbacks does not work properly if this function is evalled() from
  471. // within the Dojo system
  472. document.writeln('<script language="JavaScript">');
  473. document.writeln(' function ' + id + '_DoFSCommand(command, args){ ');
  474. document.writeln(' dojo.flash.comm._handleFSCommand(command, args); ');
  475. document.writeln('}');
  476. document.writeln('</script>');
  477. // hook for Internet Explorer to receive FSCommands from Flash
  478. if(dojo.render.html.ie){
  479. document.writeln('<SCRIPT LANGUAGE=VBScript\> ');
  480. document.writeln('on error resume next ');
  481. document.writeln('Sub ' + id + '_FSCommand(ByVal command, ByVal args)');
  482. document.writeln(' call ' + id + '_DoFSCommand(command, args)');
  483. document.writeln('end sub');
  484. document.writeln('</SCRIPT\> ');
  485. }
  486. },
  487. _writeFlash8: function(){
  488. // nothing needed for Flash 8 communication; happens automatically
  489. },
  490. /** Handles fscommand's from Flash to JavaScript. Flash 6 communication. */
  491. _handleFSCommand: function(command, args){
  492. if(command == "addCallback"){ // add Flash method for JavaScript callback
  493. this._fscommandAddCallback(command, args);
  494. }else if (command == "call"){ // Flash to JavaScript method call
  495. this._fscommandCall(command, args);
  496. }
  497. },
  498. _fscommandAddCallback: function(command, args){
  499. var functionName = args;
  500. // do a trick, where we link this function name to our wrapper
  501. // function, _call, that does the actual JavaScript to Flash call
  502. var callFunc = function(){
  503. return dojo.flash.comm._call(functionName, arguments);
  504. };
  505. dojo.flash.comm[functionName] = callFunc;
  506. // indicate that the call was successful
  507. dojo.flash.obj.get().SetVariable("_succeeded", true);
  508. },
  509. _fscommandCall: function(command, args){
  510. var plugin = dojo.flash.obj.get();
  511. var functionName = args;
  512. // get the number of arguments to this method call and build them up
  513. var numArgs = parseInt(plugin.GetVariable("_numArgs"));
  514. var flashArgs = new Array();
  515. for(var i = 0; i < numArgs; i++){
  516. var currentArg = plugin.GetVariable("_" + i);
  517. flashArgs.push(currentArg);
  518. }
  519. // get the function instance; we technically support more capabilities
  520. // than ExternalInterface, which can only call global functions; if
  521. // the method name has a dot in it, such as "dojo.flash.loaded", we
  522. // eval it so that the method gets run against an instance
  523. var runMe;
  524. if(functionName.indexOf(".") == -1){ // global function
  525. runMe = window[functionName];
  526. }else{
  527. // instance function
  528. runMe = eval(functionName);
  529. }
  530. // make the call and get the results
  531. var results = null;
  532. if(!dojo.lang.isUndefined(runMe) && runMe != null){
  533. results = runMe.apply(null, flashArgs);
  534. }
  535. // return the results to flash
  536. plugin.SetVariable("_returnResult", results);
  537. },
  538. /**
  539. The actual function that will execute a JavaScript to Flash call; used
  540. by the Flash 6 communication method.
  541. */
  542. _call: function(functionName, args){
  543. // we do JavaScript to Flash method calls by setting a Flash variable
  544. // "_functionName" with the function name; "_numArgs" with the number
  545. // of arguments; and "_0", "_1", etc for each numbered argument. Flash
  546. // reads these, executes the function call, and returns the result
  547. // in "_returnResult"
  548. var plugin = dojo.flash.obj.get();
  549. plugin.SetVariable("_functionName", functionName);
  550. plugin.SetVariable("_numArgs", args.length);
  551. for(var i = 0; i < args.length; i++){
  552. plugin.SetVariable("_" + i, args[i]);
  553. }
  554. // now tell Flash to execute this method using the Flash Runner
  555. plugin.SetVariable("_execute", true);
  556. plugin.Play();
  557. // get the results
  558. var results = plugin.GetVariable("_returnResult");
  559. dojo.debug("inside, results="+results);
  560. return results;
  561. }
  562. }
  563. /**
  564. Figures out the best way to automatically install the Flash plugin
  565. for this browser and platform.
  566. */
  567. dojo.flash.Install = function(){
  568. }
  569. dojo.flash.Install.prototype = {
  570. install: function(){
  571. }
  572. }
  573. // vim:ts=4:noet:tw=0: