Using JavaScript API commands in ActionScript file

637 views Asked by At

I am new to actionscript and jsfl programming. I am using Adobe Flash Professional CS5.5 and windows 7 operating system. I am trying to execute Javascript API commands in my .as file using the MMExecute() function. When publishing the swf file the statements before and after the 'MMExecute' statement are getting executed but the Javascript command string I am using in the MMExecute function doesn't seem to get executed. I am using a basic JSFL command to just trace to the output window in flash. Also, I am publishing the swf file to the WindowsSwf folder present in the Configuration folder. The fla file I have is a blank file with nothing added to it and the code I am using is as follows.

import flash.display.*;
import flash.text.*;
import flash.external.*;
import adobe.utils.MMExecute;

var str:String=new String();
str='fl.trace("Working..");';
MMExecute(str);

Please help me out. Thanks in advance.

1

There are 1 answers

2
Mambo4 On

I'm not a real JS programmer, just an artist who got into JSFL, but:

var str:String=new String();

seems odd to me. I don't typically declare var types in JSFL. (no idea if that's common or I'm just sloppy.)

I would typically just write

var str='fl.trace("Working..");';

it is also possible you may need to escape the first semicolon.