Re: [Flashcoders] breaking up long actions
Hi, well it's easy if you have a single for loop:), I had a deeply nested tree, but I'm flattening it out now using a stack of nodes to process. So the interval itself doesnt really allow you to edit large datasets, it allows you to edit lots of little ones:). tnx again JC On 7/6/07, Smeets, Ben <[EMAIL PROTECTED]> wrote: It doesn't break things in pieces for you but (I might get the problem the wrong way ;) ) that's the easy part isn't it? The interval does let you create/parse/edit large datasets without distorting the flow of the swf (the animation isn't distorted). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: vrijdag 6 juli 2007 16:21 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] breaking up long actions Hi Ben, tnx for the example, too bad setInterval in itself does not make content run in the background or my life would be a lot easier:). The problem is in the breaking up, but I think I got it figured now. thanks again JC On 7/6/07, Smeets, Ben <[EMAIL PROTECTED]> wrote: > > Hi Hans, > > The way I used to fix it, was indeed by using some sort of interval > solution. Only to break up the loop in more parts so the animations > won't get bothered with it. I have an example online at > http://www.bensmeets.com/2007/04/09/using-threads-inside-flash/ > (download the zip, it contains an animated example and source also). > > HTH, > > Ben > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Hans > Wichman > Sent: vrijdag 6 juli 2007 14:10 > To: Flashcoders mailing list > Subject: [Flashcoders] breaking up long actions > > Hi list, > > I'm running a process on a tree of objects that require lots of > objects to be created. > This takes somewhere around 300ms on my pc, and will usually be run as > the swf starts or as all classes have been loaded. > > 300ms is enough for a stutter let alone when its run on slower pc's so > I want to break down the task in subtasks to have it more processor > friendly. > > I know this has been discussed a few times but cant seem to find any > resources on it. > > At the moment I'm thinking of using a stack of nodes to process, and > using the stack and an alloted time, to complete the whole process, eg > in pseudo: > > onInterval() { > if (process.isDone()) { > clearInterval and send done event > } else { > process.continue(); > } > } > > The problem is old but I was wondering if anyone has come up with good > solution to this. Usually by the time we find out a process is slow, > the way we built it doesnt really allow us to break it up in chunks > easily, especially with recursive structures etc. > > regards, > JC > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com > > > This e-mail and any attachment is for authorised use by the intended > recipient(s) only. It may contain proprietary material, confidential > information and/or be subject to legal privilege. It should not be > copied, disclosed to, retained or used by, any other party. If you are > not an intended recipient then please promptly delete this e-mail and > any attachment and all copies and inform the sender. Thank you. > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] breaking up long actions
It doesn't break things in pieces for you but (I might get the problem the wrong way ;) ) that's the easy part isn't it? The interval does let you create/parse/edit large datasets without distorting the flow of the swf (the animation isn't distorted). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: vrijdag 6 juli 2007 16:21 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] breaking up long actions Hi Ben, tnx for the example, too bad setInterval in itself does not make content run in the background or my life would be a lot easier:). The problem is in the breaking up, but I think I got it figured now. thanks again JC On 7/6/07, Smeets, Ben <[EMAIL PROTECTED]> wrote: > > Hi Hans, > > The way I used to fix it, was indeed by using some sort of interval > solution. Only to break up the loop in more parts so the animations > won't get bothered with it. I have an example online at > http://www.bensmeets.com/2007/04/09/using-threads-inside-flash/ > (download the zip, it contains an animated example and source also). > > HTH, > > Ben > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Hans > Wichman > Sent: vrijdag 6 juli 2007 14:10 > To: Flashcoders mailing list > Subject: [Flashcoders] breaking up long actions > > Hi list, > > I'm running a process on a tree of objects that require lots of > objects to be created. > This takes somewhere around 300ms on my pc, and will usually be run as > the swf starts or as all classes have been loaded. > > 300ms is enough for a stutter let alone when its run on slower pc's so > I want to break down the task in subtasks to have it more processor > friendly. > > I know this has been discussed a few times but cant seem to find any > resources on it. > > At the moment I'm thinking of using a stack of nodes to process, and > using the stack and an alloted time, to complete the whole process, eg > in pseudo: > > onInterval() { > if (process.isDone()) { > clearInterval and send done event > } else { > process.continue(); > } > } > > The problem is old but I was wondering if anyone has come up with good > solution to this. Usually by the time we find out a process is slow, > the way we built it doesnt really allow us to break it up in chunks > easily, especially with recursive structures etc. > > regards, > JC > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com > > > This e-mail and any attachment is for authorised use by the intended > recipient(s) only. It may contain proprietary material, confidential > information and/or be subject to legal privilege. It should not be > copied, disclosed to, retained or used by, any other party. If you are > not an intended recipient then please promptly delete this e-mail and > any attachment and all copies and inform the sender. Thank you. > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] breaking up long actions
Hi Hans, The way I used to fix it, was indeed by using some sort of interval solution. Only to break up the loop in more parts so the animations won't get bothered with it. I have an example online at http://www.bensmeets.com/2007/04/09/using-threads-inside-flash/ (download the zip, it contains an animated example and source also). HTH, Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: vrijdag 6 juli 2007 14:10 To: Flashcoders mailing list Subject: [Flashcoders] breaking up long actions Hi list, I'm running a process on a tree of objects that require lots of objects to be created. This takes somewhere around 300ms on my pc, and will usually be run as the swf starts or as all classes have been loaded. 300ms is enough for a stutter let alone when its run on slower pc's so I want to break down the task in subtasks to have it more processor friendly. I know this has been discussed a few times but cant seem to find any resources on it. At the moment I'm thinking of using a stack of nodes to process, and using the stack and an alloted time, to complete the whole process, eg in pseudo: onInterval() { if (process.isDone()) { clearInterval and send done event } else { process.continue(); } } The problem is old but I was wondering if anyone has come up with good solution to this. Usually by the time we find out a process is slow, the way we built it doesnt really allow us to break it up in chunks easily, especially with recursive structures etc. regards, JC ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] breaking up long actions
I'm not sure you can interrupt the loop without modifying your code a little bit... I'm also not sure what the most suitable solution would be given your code structure, but I would say the cleanest way to do this is to break the loop out into a function that takes a parameter for the amount of iterations it should process for each interval. I like onEnterFrame as flash executes code in frames, so with that in mind, you can set the function to return the result of the test for the loop to indicate whether it has finished, and by such, end or resume the onEnterFrame. If you are using actionscript 2, you can also set properties on the function. You can then track the iterator index using a function property. function onEnterFrame() { var resume:Boolean = operateLoop(3); if(!resume) onEnterFrame = null; } function operateLoop(iterations:Number){ var iterationsI:Number = operateLoop.i+iterations; if(iterationsI>operateLoop.max) iterationsI = operateLoop.max; for(;operateLoop.i wrote: Hi, well it might be somewhere around that yes, and Im afraid I need them in memory at runtime:) greetz JC On 7/6/07, Mark Lapasa <[EMAIL PROTECTED]> wrote: > > Do you really need to have all the objects running in memory at runtime? > If it's really really big, you might want to offload those objects to > the backend and modify your current solution into one that paginates > only what is needed. Are we talking like 10,000+ objects? > > > > > > > Hans Wichman wrote: > > Hi list, > > > > I'm running a process on a tree of objects that require lots of > > objects to > > be created. > > This takes somewhere around 300ms on my pc, and will usually be run as > > the > > swf starts or as all classes have been loaded. > > > > 300ms is enough for a stutter let alone when its run on slower pc's so I > > want to break down the task in subtasks to have it more processor > > friendly. > > > > I know this has been discussed a few times but cant seem to find any > > resources on it. > > > > At the moment I'm thinking of using a stack of nodes to process, and > > using > > the stack and an alloted time, to complete the whole process, eg in > > pseudo: > > > > onInterval() { > > if (process.isDone()) { > > clearInterval and send done event > > } else { > > process.continue(); > > } > > } > > > > The problem is old but I was wondering if anyone has come up with good > > solution to this. Usually by the time we find out a process is slow, > > the way > > we built it doesnt really allow us to break it up in chunks easily, > > especially with recursive structures etc. > > > > regards, > > JC > > ___ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > > > > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] breaking up long actions
Hi, well it might be somewhere around that yes, and Im afraid I need them in memory at runtime:) greetz JC On 7/6/07, Mark Lapasa <[EMAIL PROTECTED]> wrote: Do you really need to have all the objects running in memory at runtime? If it's really really big, you might want to offload those objects to the backend and modify your current solution into one that paginates only what is needed. Are we talking like 10,000+ objects? Hans Wichman wrote: > Hi list, > > I'm running a process on a tree of objects that require lots of > objects to > be created. > This takes somewhere around 300ms on my pc, and will usually be run as > the > swf starts or as all classes have been loaded. > > 300ms is enough for a stutter let alone when its run on slower pc's so I > want to break down the task in subtasks to have it more processor > friendly. > > I know this has been discussed a few times but cant seem to find any > resources on it. > > At the moment I'm thinking of using a stack of nodes to process, and > using > the stack and an alloted time, to complete the whole process, eg in > pseudo: > > onInterval() { > if (process.isDone()) { > clearInterval and send done event > } else { > process.continue(); > } > } > > The problem is old but I was wondering if anyone has come up with good > solution to this. Usually by the time we find out a process is slow, > the way > we built it doesnt really allow us to break it up in chunks easily, > especially with recursive structures etc. > > regards, > JC > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] breaking up long actions
Hi Ben, tnx for the example, too bad setInterval in itself does not make content run in the background or my life would be a lot easier:). The problem is in the breaking up, but I think I got it figured now. thanks again JC On 7/6/07, Smeets, Ben <[EMAIL PROTECTED]> wrote: Hi Hans, The way I used to fix it, was indeed by using some sort of interval solution. Only to break up the loop in more parts so the animations won't get bothered with it. I have an example online at http://www.bensmeets.com/2007/04/09/using-threads-inside-flash/ (download the zip, it contains an animated example and source also). HTH, Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: vrijdag 6 juli 2007 14:10 To: Flashcoders mailing list Subject: [Flashcoders] breaking up long actions Hi list, I'm running a process on a tree of objects that require lots of objects to be created. This takes somewhere around 300ms on my pc, and will usually be run as the swf starts or as all classes have been loaded. 300ms is enough for a stutter let alone when its run on slower pc's so I want to break down the task in subtasks to have it more processor friendly. I know this has been discussed a few times but cant seem to find any resources on it. At the moment I'm thinking of using a stack of nodes to process, and using the stack and an alloted time, to complete the whole process, eg in pseudo: onInterval() { if (process.isDone()) { clearInterval and send done event } else { process.continue(); } } The problem is old but I was wondering if anyone has come up with good solution to this. Usually by the time we find out a process is slow, the way we built it doesnt really allow us to break it up in chunks easily, especially with recursive structures etc. regards, JC ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] breaking up long actions
Do you really need to have all the objects running in memory at runtime? If it's really really big, you might want to offload those objects to the backend and modify your current solution into one that paginates only what is needed. Are we talking like 10,000+ objects? Hans Wichman wrote: Hi list, I'm running a process on a tree of objects that require lots of objects to be created. This takes somewhere around 300ms on my pc, and will usually be run as the swf starts or as all classes have been loaded. 300ms is enough for a stutter let alone when its run on slower pc's so I want to break down the task in subtasks to have it more processor friendly. I know this has been discussed a few times but cant seem to find any resources on it. At the moment I'm thinking of using a stack of nodes to process, and using the stack and an alloted time, to complete the whole process, eg in pseudo: onInterval() { if (process.isDone()) { clearInterval and send done event } else { process.continue(); } } The problem is old but I was wondering if anyone has come up with good solution to this. Usually by the time we find out a process is slow, the way we built it doesnt really allow us to break it up in chunks easily, especially with recursive structures etc. regards, JC ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] breaking up long actions
Hi list, I'm running a process on a tree of objects that require lots of objects to be created. This takes somewhere around 300ms on my pc, and will usually be run as the swf starts or as all classes have been loaded. 300ms is enough for a stutter let alone when its run on slower pc's so I want to break down the task in subtasks to have it more processor friendly. I know this has been discussed a few times but cant seem to find any resources on it. At the moment I'm thinking of using a stack of nodes to process, and using the stack and an alloted time, to complete the whole process, eg in pseudo: onInterval() { if (process.isDone()) { clearInterval and send done event } else { process.continue(); } } The problem is old but I was wondering if anyone has come up with good solution to this. Usually by the time we find out a process is slow, the way we built it doesnt really allow us to break it up in chunks easily, especially with recursive structures etc. regards, JC ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com