PDA

View Full Version : MMExecute return value ?


marcelfahle
07-26-2004, 04:02 PM
Hey guys,

could anybody out there explain, why the output below is "String"?
Should be Object...

var libraryItems:Array = MMExecute("fl.getDocumentDOM().library.items;");
output.text = "type: " + typeof libraryItems;

Thanks a lot!

Marcel

hangalot
07-27-2004, 10:26 AM
MMExecute always returns a string. if you want to manipulate the objects call functions in a jsfl file (i presume u r floking around with a windowSWF), u can call a jsfl like this

return MMExecute("fl.runScript(fl.configURI+\"WindowSWF/"+ filename + "\", \""+scriptName+"\");");


any arguments will be passed as parameters delimated by commas after the scriptname tag.
also:
in the jsfl function you can ofcourse go like this

var arr = fl.getDocumentDOM().library.items;
//where arr is an array then

marcelfahle
07-28-2004, 09:57 AM
Hi hangalot,

thanks for your help. That was, what I tried before. My code was just a shortcut. Here is my full code.

JSFL File:
function getLibrary() {
return fl.getDocumentDOM().library.items;
}

WindowSWF Actionscript:
var libraryItems = MMExecute("fl.runScript('"+jsflFile+"', 'getLibrary');");
output.text = "lšnge: " + libraryItems.length + newline;
output.text += "type: " + typeof libraryItems + newline;
output.text += "content: " + libraryItems + newline;

I'm still getting a String Output:
Screenshot (http://files.marcelfahle.com/screens/as_org1.jpg)

Do you know what's wrong in my Script?

hangalot
07-28-2004, 10:16 AM
as i said, with MMexecute you will always get a string as a return. the array object is only availible in the jsfl itself. you will have to parse that string in order to represent it in the windowSWF level.

marcelfahle
07-28-2004, 10:38 AM
Damn! Now I understand :)
Thanks a lot!!