  | | | Speed of looping library items | Speed of looping library items 2004-05-26 - By John Grden
Back When iterating through a library of sounds, if I access the name property of the item object, it's fast. If I access a property of the soundItem (subclass of the item class - IE: bitRate), it slows drastically.
Anyone experienced this? Have a suggestion for doing this more efficiently or a workaround?
Basically, I need to list out all sounds, but when there's a library of, say, 50, I get an error about the script running slowly etc.
Run this against any FLA that has sounds in the library. Change the "bitRate" var to "itemType" and you'll see a huge difference in speed.
var dom = fl.getDocumentDOM().library; libe = dom.items;
fl.trace(libe.length);
for(x=0;x<libe.length;x++) { dom.selectItem(dom.items[x].name); var selItems = fl.getDocumentDOM().library.getSelectedItems(); fl.trace(selItems[0].name + ", " + selItems[0].bitRate); }
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 11:43 PM > To: Extending Flash > Subject: RE: [ExtendFlash] adding muliple lines of AS script using > JSFL(continued from archive) > > No worries! But it is nice to know it wasn't just me ;) > > 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: Monday, May 24, 2004 11:29 PM > > To: 'Extending Flash' > > Subject: RE: [ExtendFlash] adding muliple lines of AS script using JSFL > > (continued from archive) > > > > BTW: I lied, I had this problem a long time ago. I was thinking just > > straight JavaScript when I first replied. Sorry about that. > > > > > -- --Original Message-- -- > > > From: Extendflash-bounces@(protected) > > > [mailto:Extendflash-bounces@(protected)]On Behalf Of Sharon Selden > > > Sent: Monday, May 24, 2004 10:46 PM > > > To: 'Extending Flash' > > > Subject: RE: [ExtendFlash] adding muliple lines of AS script > > > using JSFL > > > (c ontinued from archive) > > > > > > > > > I'll give it a whirl right now. I've never had any problems with "\n". > > > > > > > -- --Original Message-- -- > > > > From: Extendflash-bounces@(protected) > > > > [mailto:Extendflash-bounces@(protected)]On Behalf Of John Grden > > > > Sent: Monday, May 24, 2004 10:37 PM > > > > To: Extending Flash > > > > Subject: RE: [ExtendFlash] adding muliple lines of AS script > > > > using JSFL > > > > (continued from archive) > > > > > > > > > > > > Yeah, done that and it traces out perfectly. > > > > > > > > I've also stripped it to bare basics, and it still throws an error: > > > > MMExecute("fl.getDocumentDOM().getTimeline().layers[" + > > > > iLayer + "].frames[0].actionScript > > > \"stop();\ntrace(\"test\");\"; ") > > > > > > > > If I take out the escape character, no error and it writes > > > > the line to the frame. > > > > > > > > I've also tested with using other escape characters (\t, \r) > > > > and all work without error. So, I've narrowed it to the fact > > > > that it throws it on "\n" only. > > > > > > > > I've tried every conceivable combination and all error out. > > > > > > > > So, my thought is to pass an object to a JSFL script and > > > > execute it there. Can you see that making any difference at all? > > > > > > > > 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: Monday, May 24, 2004 10:27 PM > > > > > To: 'Extending Flash' > > > > > Subject: RE: [ExtendFlash] adding muliple lines of AS > > > > script using JSFL > > > > > (continued from archive) > > > > > > > > > > Did you try substituting trace for MMExecute to verify the > > > > strings are > > > > > being > > > > > concatenated and converted properly? Chances are there's a > > > > problem there. > > > > > > > > > > > > > > > > > > > > > -- --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
|
|
 |