  | | RE: [ExtendFlash] adding muliple lines of ASscriptusingJSFL(conti
nued from ar | RE: [ExtendFlash] adding muliple lines of ASscriptusingJSFL(conti
nued from ar 2004-05-27 - By Sharon Selden
Back Hi Andrew, I'm resending my response to this from a few days ago. Hope this helps:
The weirdness with any suppressed character is that MMExecute takes a string and then hands it off to the JS Interpreter, which converts it to JS code. In the case of the new line character, you want it to retain it's type of string. In other words, when it gets to the JS interpreter, the interpreter sees the "\n" as a literal new line character. It then inserts a line break in your code, causing it to throw an error. You have to double suppress it.
Try this in your ActionScript code: linebreak = "\"\\n\"";
If possible, you can also put your js in a separate jsfl file and call it from actionScript using: MMExecute("fl.runScript(\"myScript.jsfl\");");
- sharon
> -- --Original Message-- -- > From: Extendflash-bounces@(protected) > [mailto:Extendflash-bounces@(protected)]On Behalf Of Andrew Chew > Sent: Thursday, May 27, 2004 11:08 AM > To: Extending Flash > Subject: RE: [ExtendFlash] adding muliple lines of > ASscriptusingJSFL(continued from archive) > > > John, I tried that but was not able get flash to recognize the "\n". > > -- --Original Message-- -- > From: John Grden [mailto:john@(protected)] > Sent: Thursday, May 27, 2004 10:35 AM > To: Extending Flash > Subject: RE: [ExtendFlash] adding muliple lines of > ASscriptusingJSFL(continued from archive) > > Maybe run through the text and make sure that line breaks > have "\\n" and not the typical "\n"? You're just sending the > text straight from the textArea and that might be the problem. > > John Grden > Senior Flash Developer > Macromedia Certified Flash MX Designer > Blitz Digital Studios > > [e] John@(protected) > [c] 714.326.7211 > [b] 818.762.6888 x207 > [w] www.BlitzDS.com > > [a] Blitz DS > ??? 11336 Camarillo Street > ??? Suite 200 > ??? North Hollywood, CA 91602 > > > -- --Original Message-- -- > > From: Extendflash-bounces@(protected) [mailto:Extendflash- > > bounces@(protected)] On Behalf Of Andrew Chew > > Sent: Thursday, May 27, 2004 10:21 AM > > To: Extending Flash > > Subject: RE: [ExtendFlash] adding muliple lines of AS > > scriptusingJSFL(continued from archive) > > > > That doesn't seem to affect anything... same results. > > > > Thanks for the thought :) > > > > -- --Original Message-- -- > > From: John Grden [mailto:john@(protected)] > > Sent: Thursday, May 27, 2004 9:53 AM > > To: Extending Flash > > Subject: RE: [ExtendFlash] adding muliple lines of AS script > > usingJSFL(continued from archive) > > > > Also, you might have to escape the single quotes, so use "\'": > > > > > MMExecute("fl.getDocumentDOM().getTimeline().layers[0].frames[ 0].actionScr > > ipt += \'"+actionScriptTF.text+"\';"); > > > > Just a thought, > > > > John Grden > > Senior Flash Developer > > Macromedia Certified Flash MX Designer > > Blitz Digital Studios > > > > [e] John@(protected) > > [c] 714.326.7211 > > [b] 818.762.6888 x207 > > [w] www.BlitzDS.com > > > > [a] Blitz DS > > ??? 11336 Camarillo Street > > ??? Suite 200 > > ??? North Hollywood, CA 91602 > > > > > -- --Original Message-- -- > > > From: Extendflash-bounces@(protected) [mailto:Extendflash- > > > bounces@(protected)] On Behalf Of Andrew Chew > > > Sent: Thursday, May 27, 2004 9:18 AM > > > To: Extending Flash > > > Subject: RE: [ExtendFlash] adding muliple lines of AS script using > > > JSFL(continued from archive) > > > > > > Anyone had errors using MMExecute in a windowSWF to place > ActionScript > > > on a frame in a movie? > > > > > > Where "actionScriptTF" is an instance of the text area > component that is > > > used to input the ActionScript from a windowSWF, here is > the code that > > > places this input in the movie: > > > > > > > MMExecute("fl.getDocumentDOM().getTimeline().layers[0].frames[ 0].actionS > > > cript += '"+actionScriptTF.text+"';"); > > > > > > I keep getting the error "unterminated string literal" > when the pasted > > > code has a line break. No error when the input has no > line break. I'm > > > not finding a workaround. > > > > > > Any ideas? Thanks in advance! > > > > > > > > > -- --Original Message-- -- > > > From: Sharon Selden [mailto:sselden@(protected)] > > > Sent: Monday, May 24, 2004 11:17 PM > > > To: 'Extending Flash' > > > Subject: RE: [ExtendFlash] adding muliple lines of AS > script using JSFL > > > (continued from archive) > > > > > > Got it!! > > > > > > This is why I hate putting JS code directly into > MMExecute...converting > > > code > > > to a strings is a royal pain in the ... um ... butt. > > > > > > > > > The weirdness with any suppressed character is that > MMExecute takes a > > > string > > > and then hands it off to the JS Interpreter, which > converts it to JS > > > code. > > > In the case of the new line character, you want it to > retain it's type > > > of > > > string. In other words, when it gets to the JS interpreter, the > > > interpreter > > > sees the "\n" as a literal new line character. It then > inserts a line > > > break > > > in your code, causing it to throw an error. You have to > double suppress > > > it. > > > > > > > > > Try this in your ActionScript code: > > > linebreak = "\"\\n\""; > > > > > > - > > > sharon > > > > > > > -- --Original Message-- -- > > > > From: Extendflash-bounces@(protected) > > > > [mailto:Extendflash-bounces@(protected)]On Behalf > Of John Grden > > > > Sent: Monday, May 24, 2004 9:22 PM > > > > To: Extending Flash > > > > Subject: [ExtendFlash] adding muliple lines of AS > script using JSFL > > > > (continued from archive) > > > > > > > > > > > > I saw the posts about using \n for a return, and I had > > > > originally tried > > > > this, but when ever I add it in, flash throws an error. If I > > > > remove the > > > > returns, no error. I also tried chr(13) and chr(10) > and of course it > > > > failed. > > > > > > > > > > > > > > > > Any clues as to what I'm missing? > > > > > > > > > > > > > > > > Code (basically): > > > > > > > > > > > > > > > > private function buildAS(AS:String):Void > > > > > > > > { > > > > > > > > //... > > > > > > > > sAS += AS + "\n"; > > > > > > > > //... > > > > > > > > } > > > > > > > > > > > > > > > > public function writeAS():Void > > > > > > > > { > > > > > > > > var iLayer:Number > > > > MMExecute("fl.getDocumentDOM().getTimeline() .addNewLayer(\"aud > > > > ioCode\", > > > > \"normal\", true);"); > > > > > > > > > > > > > > > > sAS = ""; > > > > > > > > buildAS("function runMe()"); > > > > > > > > buildAS("{"); > > > > > > > > buildAS(" for(var x:Number=0;x<array.length;x++)"); > > > > > > > > buildAS(" {"); > > > > > > > > buildAS(" trace(x);"); > > > > > > > > buildAS(" }"); > > > > > > > > buildAS("}"); > > > > > > > > _global.view("sAS", sAS); > > > > > > > > > MMExecute("fl.getDocumentDOM().getTimeline().layers[" + iLayer + > > > > "].frames[0].actionScript = \"" + sAS + "\";"); > > > > > > > > } > > > > > > > > > > > > > > > > Tells me "a javascript error occurred" > > > > > > > > > > > > > > > > John Grden > > > > > > > > Senior Flash Developer > > > > > > > > Blitz Digital Studios > > > > > > > > > > > > > > > > [e] John@(protected) > > > > > > > > [c] 714.326.7211 > > > > > > > > [b] 818.762.6888 x207 > > > > > > > > [w] www.BlitzDS.com > > > > > > > > > > > > > > > > [a] Blitz DS > > > > > > > > 11336 Camarillo Street > > > > > > > > Suite 200 > > > > > > > > North Hollywood, CA 91602 > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > From: Extendflash-bounces@(protected) [mailto:Extendflash- > > > > > > > > > bounces@(protected)] On Behalf Of John Grden > > > > > > > > > Sent: Monday, May 24, 2004 10:27 AM > > > > > > > > > To: Extending Flash > > > > > > > > > Subject: RE: [ExtendFlash] loading Custom SWF > interface in Flash IDE > > > > > > > > > > > > > > > > > > Absolutely: > > > > > > > > > > > > > > > > > > When I load the interface, I iterate through the > library looking for > > > > all > > > > > > > > > sounds using itemType property of the item object. As I > > > > find a sound, > > > > I > > > > > > > > > create another row in the grid, update a global object for > > > > sounds etc. > > > > > > > > > > > > > > > > > > Now, I noticed that when I trace out the length of > the library, it's > > > > > > > > > exponentially larger as I add more items to it. Is > this correct? > > > > > > > > > > > > > > > > > > I'm assuming the slow down is directly related to the > > > > number of items > > > > in > > > > > > > > > the library. But I'm concerned that the way I'm > building my global > > > > object > > > > > > > > > might be the problem as well. When a sound is found, I make 5 > > > > different > > > > > > > > > MMExecute calls to grab variable information about > the sound object. > > > > So, > > > > > > > > > I'm wondering 3 things: > > > > > > > > > > > > > > > > > > 1. I haven't tried it, but should I just initialize > my object with > > > > the > > > > > > > > > item object? (IE: myGlobal_obj["sound_0"] = > ...library.items[x] ) > > > > > > > > > > > > > > > > > > 2. How much of a performance issue is it when using > MMExecute? > > > > > > > > > > > > > > > > > > 3. Is there a performance advantage to utilizing a > JSFL script over > > > > > > > > > making MMExecute calls? > > > > > > > > > > > > > > > > > > Thanks for your help and time Sharon, I really appreciate it > > > > > > > > > > > > > > > > > > John Grden > > > > > > > > > Senior Flash Developer > > > > > > > > > Blitz Digital Studios > > > > > > > > > > > > > > > > > > [e] John@(protected) > > > > > > > > > [c] 714.326.7211 > > > > > > > > > [b] 818.762.6888 x207 > > > > > > > > > [w] www.BlitzDS.com > > > > > > > > > > > > > > > > > > [a] Blitz DS > > > > > > > > > 11336 Camarillo Street > > > > > > > > > Suite 200 > > > > > > > > > North Hollywood, CA 91602 > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > > From: Extendflash-bounces@(protected) > [mailto:Extendflash- > > > > > > > > > > bounces@(protected)] On Behalf Of Sharon Selden > > > > > > > > > > Sent: Sunday, May 23, 2004 1:05 AM > > > > > > > > > > To: 'Extending Flash' > > > > > > > > > > Subject: RE: [ExtendFlash] loading Custom SWF interface > > > > in Flash IDE > > > > > > > > > > > > > > > > > > > > Can you be more specific about what you are trying to do? > > > > In general > > > > one > > > > > > > > > > would have to iterate over all the items in the library. But > > > > depending > > > > > > > > > on > > > > > > > > > > what specifically you are trying to do there might be a more > > > > efficient > > > > > > > > > way > > > > > > > > > > to do it. > > > > > > > > > > - > > > > > > > > > > sharon > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > > > From: Extendflash-bounces@(protected) > > > > > > > > > > > [mailto:Extendflash-bounces@(protected)]On > Behalf Of John > > > > Grden > > > > > > > > > > > Sent: Saturday, May 22, 2004 10:05 PM > > > > > > > > > > > To: Extending Flash > > > > > > > > > > > Subject: RE: [ExtendFlash] loading Custom SWF > interface in Flash > > > > IDE > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Yes, that does help Sharon! > > > > > > > > > > > > > > > > > > > > > > I had looked at that example, but for some reason (maybe > > > > > > > > > > > impatience), I couldn't find out where/how it was > loaded from > > > > > > > > > > > the commands menu. I located something in the > archives for a > > > > > > > > > > > batching process that was a perfect little example. > > > > > > > > > > > > > > > > > > > > > > One thing I could really use is a tutorial/info > on itterating > > > > > > > > > > > through the library efficiently. Right now, it > seems to take > > > > > > > > > > > a while with the initial load and I'm wondering > if there are > > > > > > > > > > > known better ways to go about it etc. Do you > have anything > > > > > > > > > > > out there that goes working with the library? > > > > > > > > > > > > > > > > > > > > > > Thanks for your help, much appreciated, > > > > > > > > > > > John > > > > > > > > > > > > > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ > > > > > > > > > > > > > > > > > > > > > > From: Extendflash-bounces@(protected) on > behalf of Sharon > > > > Selden > > > > > > > > > > > Sent: Sat 5/22/2004 10:00 PM > > > > > > > > > > > To: 'Extending Flash' > > > > > > > > > > > Subject: RE: [ExtendFlash] loading Custom SWF > interface in Flash > > > > IDE > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Don't know if this is what you're looking for but > it may help: > > > > > > > > > > > go to help >. samples > Building custom panels with the > > > > > > > > > > > Extensibility API > > > > > > > > > > > > > > > > > > > > > > I would advise though that instead of placing > your JS code in > > > > > > > > > > > a big string > > > > > > > > > > > and sending it through MMExecute, you put it in a separate > > > > > > > > > > > jsfl and call it > > > > > > > > > > > using MMExecute("fl.runscript(\"myScript.jsfl\")"); > > > > > > > > > > > > > > > > > > > > > > that example was written before we had implemented the > > > > > > > > > > > runScript command. > > > > > > > > > > > > > > > > > > > > > > Hope that helps, > > > > > > > > > > > sharon > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > > > > From: Extendflash-bounces@(protected) > > > > > > > > > > > > [mailto:Extendflash-bounces@(protected)]On > Behalf Of John > > > > Grden > > > > > > > > > > > > Sent: Saturday, May 22, 2004 9:20 PM > > > > > > > > > > > > To: Extendflash@(protected) > > > > > > > > > > > > Subject: [ExtendFlash] loading Custom SWF interface > > > > in Flash IDE > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I've figured out how to load a custom interface via > > > > > > > > > > > > "insert/timeline effects/..." but I know there > HAS to be a > > > > > > > > > > > > way to load one without having to select a movie clip on > > > > > > > > > > > > stage and so forth. > > > > > > > > > > > > > > > > > > > > > > > > Has anyone any info on this? Tutorials? Sites > that go over > > > > > > > > > > > > the specifics of designing a custom interface? > > > > > > > > > > > > > > > > > > > > > > > > Thanks for your help, > > > > > > > > > > > > > > > > > > > > > > > > John Grden > > > > > > > > > > > > Senior Flash Developer > > > > > > > > > > > > BlitzDS.com > > > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > > > > > > > > > > Extendflash mailing list > > > > > > > > > > > > Extendflash@(protected) > > > > > > > > > > > > > > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > > > > > > > > > Extendflash mailing list > > > > > > > > > > > Extendflash@(protected) > > > > > > > > > > > > > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > > > > > > > > Extendflash mailing list > > > > > > > > > > Extendflash@(protected) > > > > > > > > > > > > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > > > > > > > Extendflash mailing list > > > > > > > > > Extendflash@(protected) > > > > > > > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > > Extendflash mailing list > > > > Extendflash@(protected) > > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > Extendflash mailing list > > > Extendflash@(protected) > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > > Extendflash mailing list > > > Extendflash@(protected) > > > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > Extendflash mailing list > > Extendflash@(protected) > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > > Extendflash mailing list > > Extendflash@(protected) > > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > Extendflash mailing list > Extendflash@(protected) > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > Extendflash mailing list > Extendflash@(protected) > http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk >
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Extendflash mailing list Extendflash@(protected) http://flashguru.co.uk/mailman/listinfo/extendflash_flashguru.co.uk
|
|
 |