Re: [Flashcoders] Iterator question
Hello :) AST'r is the code example ;) http://code.google.com/p/astr/ You install the sources (and the sources of VEGAS) and you can read the source code to understand my methodology to create an application. AST'r is a Conceptual framework (templates).. With AST'r i'm going to write tutorials to understand the FrontController and MVC pattern with VEGAS, the Localization and config tools based on eden (http://code.google.com/p/edenrr/ - like JSON but more complete ), my W3C DOM2/3 event model in AS2/AS3/SSAS ( http://code.google.com/p/vegas/wiki/VegasTutorialsEvents) etc... For the moment in AST'r you can find in AS2 the main source code with an easy example to create the basic implementation of the application : http://astr.googlecode.com/svn/trunk/AS2/trunk/src/astro/ To test and launch the code you can open the AS2/trunk/bin/_fla/asto.fla file and compile with Flash or MTASC. You can find too ... two examples : http://astr.googlecode.com/svn/trunk/AS2/trunk/examples/ - eGallery : A first example to creates a dynamic picture gallery with local data or MYSQL/AMFPHP datas - eChat (in progress, no stable for the moment) : an example to use VEGAS with an client/server(FMS) application EKA+ :) 2007/8/31, Austin Kottke [EMAIL PROTECTED]: Hey eka, In the vegas framework there is a mention of #ASTr'O. It says it does templates however I dont understand what you mean here. Can you elaborate with a code example? Best, Austin eka wrote: Hello :) You can use if you want my opensource framework and all this ADT (abstract data type) : In VEGAS you can find the package vegas.data.* with an ADT library based on the JAVA Collections and the Jakarta Collections Framework. Page of the project : http://code.google.com/p/vegas/ Install tutorial : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN Example to use my ADT in AS2 in the SVN directory : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/vegas/data/ The documentation : http://vegas.ekameleon.net/ (see vegas.data package) See the vegas.data.iterator and vegas.data.map packages ;) EKA+ :) 2007/8/27, Andy Herrman [EMAIL PROTECTED]: Why not use a hashtable instead of an array? Give your elements all unique IDs (you could even just do an incrementing integer). A hashtable would give you faster lookup (don't have to iterate over the array searching for it) and you can remove hashtable entries without messing up any kind of ordering. -Andy On 8/27/07, dr.ache [EMAIL PROTECTED] wrote: hi. dont delete the elements from your array. when you call page.destroy() method generate another array in which you push a true, whenever onElementKilled is called.Check also, if the array contains as much elements as your children array contains. If true, delete the whole array with childs. possible? dr.ache Jiri Heitlager | dadata.org schrieb: Hello list, i have a page object that contains has a Array that holds pageElements. This is a storage for elements with an iPageElement interface. The page object has an destroy() method. When page.destroy() is called, it will loop trough the page.pageElements Array using an iterator. Every iPageElement broadcasts an onElementKilled message when is has been destroyed. When a pageElement broadcast this message, the page need to continue in deleting the next element in the page.pageElement Array. The callback method onElementKilled in the page instance, searches for the element that has been deleted and then removes it from the page.pageElements Array. This is where i think a problem rises, because if the page.pageElements array is updated during the process, the index does not match the element to remove anymore. How can I solve this potential risk? Another question, the array that is passes into the iterator is a reference to the pageElements Array. Does this mean, that if I delete an element from this array from within the iterator, the page.pageElements array is modified? I hope my question is clear.. thank you in advance. Jiri Below a snippet: private function getPageElementIterator() : Void { return new PageElementIterator(this.pageElements) } //initiated the deleting proces, by starting with the first element. public function destroyPageElements() : Void { destroyElement(this.pageElements[0]); } private function destroyElement(element:iPageElement) : Void { curElement.addEventListener('onElementKilled' , this) curElement.destroy(); } private function onElementKilled(eventObj:Object) : Void { var killElement:iPageElement = eventObj.target; var iter:PageElementIterator = this.getPageElementIterator(); while(iter.hasNext()){ var curElement:iPage = iPage
Re: [Flashcoders] Iterator question
Why not use a hashtable instead of an array? Give your elements all unique IDs (you could even just do an incrementing integer). A hashtable would give you faster lookup (don't have to iterate over the array searching for it) and you can remove hashtable entries without messing up any kind of ordering. -Andy On 8/27/07, dr.ache [EMAIL PROTECTED] wrote: hi. dont delete the elements from your array. when you call page.destroy() method generate another array in which you push a true, whenever onElementKilled is called.Check also, if the array contains as much elements as your children array contains. If true, delete the whole array with childs. possible? dr.ache Jiri Heitlager | dadata.org schrieb: Hello list, i have a page object that contains has a Array that holds pageElements. This is a storage for elements with an iPageElement interface. The page object has an destroy() method. When page.destroy() is called, it will loop trough the page.pageElements Array using an iterator. Every iPageElement broadcasts an onElementKilled message when is has been destroyed. When a pageElement broadcast this message, the page need to continue in deleting the next element in the page.pageElement Array. The callback method onElementKilled in the page instance, searches for the element that has been deleted and then removes it from the page.pageElements Array. This is where i think a problem rises, because if the page.pageElements array is updated during the process, the index does not match the element to remove anymore. How can I solve this potential risk? Another question, the array that is passes into the iterator is a reference to the pageElements Array. Does this mean, that if I delete an element from this array from within the iterator, the page.pageElements array is modified? I hope my question is clear.. thank you in advance. Jiri Below a snippet: private function getPageElementIterator() : Void { return new PageElementIterator(this.pageElements) } //initiated the deleting proces, by starting with the first element. public function destroyPageElements() : Void { destroyElement(this.pageElements[0]); } private function destroyElement(element:iPageElement) : Void { curElement.addEventListener('onElementKilled' , this) curElement.destroy(); } private function onElementKilled(eventObj:Object) : Void { var killElement:iPageElement = eventObj.target; var iter:PageElementIterator = this.getPageElementIterator(); while(iter.hasNext()){ var curElement:iPage = iPage (iter.next()); if(killElement == curElement) { //deleted the element now clear the listener and continue killElement.removeEventListener('onElementKilled' , this) /* * POTENTIAL RISK, if a new element is added, then the index, does not match the right element anymore * * get the current index from the deleted element by checking what * the currentIndex of the iterator is, and remove it from this.pageElements Array */ this.pageElements = this.pageElements.splice((iter.getCurrentIndex() , 0) //get the next element in the iterator array if(iter.hasNext()) this.destroyElement( iPage(iter.next()) ); delete killedElement; break; } } } if(this.pageElements.length == 0){ trace('all page elements have been removed') } } ___ 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] Iterator question
Hello :) You can use if you want my opensource framework and all this ADT (abstract data type) : In VEGAS you can find the package vegas.data.* with an ADT library based on the JAVA Collections and the Jakarta Collections Framework. Page of the project : http://code.google.com/p/vegas/ Install tutorial : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN Example to use my ADT in AS2 in the SVN directory : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/vegas/data/ The documentation : http://vegas.ekameleon.net/ (see vegas.data package) See the vegas.data.iterator and vegas.data.map packages ;) EKA+ :) 2007/8/27, Andy Herrman [EMAIL PROTECTED]: Why not use a hashtable instead of an array? Give your elements all unique IDs (you could even just do an incrementing integer). A hashtable would give you faster lookup (don't have to iterate over the array searching for it) and you can remove hashtable entries without messing up any kind of ordering. -Andy On 8/27/07, dr.ache [EMAIL PROTECTED] wrote: hi. dont delete the elements from your array. when you call page.destroy() method generate another array in which you push a true, whenever onElementKilled is called.Check also, if the array contains as much elements as your children array contains. If true, delete the whole array with childs. possible? dr.ache Jiri Heitlager | dadata.org schrieb: Hello list, i have a page object that contains has a Array that holds pageElements. This is a storage for elements with an iPageElement interface. The page object has an destroy() method. When page.destroy() is called, it will loop trough the page.pageElements Array using an iterator. Every iPageElement broadcasts an onElementKilled message when is has been destroyed. When a pageElement broadcast this message, the page need to continue in deleting the next element in the page.pageElement Array. The callback method onElementKilled in the page instance, searches for the element that has been deleted and then removes it from the page.pageElements Array. This is where i think a problem rises, because if the page.pageElements array is updated during the process, the index does not match the element to remove anymore. How can I solve this potential risk? Another question, the array that is passes into the iterator is a reference to the pageElements Array. Does this mean, that if I delete an element from this array from within the iterator, the page.pageElements array is modified? I hope my question is clear.. thank you in advance. Jiri Below a snippet: private function getPageElementIterator() : Void { return new PageElementIterator(this.pageElements) } //initiated the deleting proces, by starting with the first element. public function destroyPageElements() : Void { destroyElement(this.pageElements[0]); } private function destroyElement(element:iPageElement) : Void { curElement.addEventListener('onElementKilled' , this) curElement.destroy(); } private function onElementKilled(eventObj:Object) : Void { var killElement:iPageElement = eventObj.target; var iter:PageElementIterator = this.getPageElementIterator(); while(iter.hasNext()){ var curElement:iPage = iPage (iter.next()); if(killElement == curElement) { //deleted the element now clear the listener and continue killElement.removeEventListener('onElementKilled' , this) /* * POTENTIAL RISK, if a new element is added, then the index, does not match the right element anymore * * get the current index from the deleted element by checking what * the currentIndex of the iterator is, and remove it from this.pageElements Array */ this.pageElements = this.pageElements.splice((iter.getCurrentIndex() , 0) //get the next element in the iterator array if(iter.hasNext()) this.destroyElement( iPage(iter.next()) ); delete killedElement; break; } } } if(this.pageElements.length == 0){ trace('all page elements have been removed') } } ___ 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] Iterator question
Hey eka, In the vegas framework there is a mention of #ASTr'O. It says it does templates however I dont understand what you mean here. Can you elaborate with a code example? Best, Austin eka wrote: Hello :) You can use if you want my opensource framework and all this ADT (abstract data type) : In VEGAS you can find the package vegas.data.* with an ADT library based on the JAVA Collections and the Jakarta Collections Framework. Page of the project : http://code.google.com/p/vegas/ Install tutorial : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN Example to use my ADT in AS2 in the SVN directory : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/vegas/data/ The documentation : http://vegas.ekameleon.net/ (see vegas.data package) See the vegas.data.iterator and vegas.data.map packages ;) EKA+ :) 2007/8/27, Andy Herrman [EMAIL PROTECTED]: Why not use a hashtable instead of an array? Give your elements all unique IDs (you could even just do an incrementing integer). A hashtable would give you faster lookup (don't have to iterate over the array searching for it) and you can remove hashtable entries without messing up any kind of ordering. -Andy On 8/27/07, dr.ache [EMAIL PROTECTED] wrote: hi. dont delete the elements from your array. when you call page.destroy() method generate another array in which you push a true, whenever onElementKilled is called.Check also, if the array contains as much elements as your children array contains. If true, delete the whole array with childs. possible? dr.ache Jiri Heitlager | dadata.org schrieb: Hello list, i have a page object that contains has a Array that holds pageElements. This is a storage for elements with an iPageElement interface. The page object has an destroy() method. When page.destroy() is called, it will loop trough the page.pageElements Array using an iterator. Every iPageElement broadcasts an onElementKilled message when is has been destroyed. When a pageElement broadcast this message, the page need to continue in deleting the next element in the page.pageElement Array. The callback method onElementKilled in the page instance, searches for the element that has been deleted and then removes it from the page.pageElements Array. This is where i think a problem rises, because if the page.pageElements array is updated during the process, the index does not match the element to remove anymore. How can I solve this potential risk? Another question, the array that is passes into the iterator is a reference to the pageElements Array. Does this mean, that if I delete an element from this array from within the iterator, the page.pageElements array is modified? I hope my question is clear.. thank you in advance. Jiri Below a snippet: private function getPageElementIterator() : Void { return new PageElementIterator(this.pageElements) } //initiated the deleting proces, by starting with the first element. public function destroyPageElements() : Void { destroyElement(this.pageElements[0]); } private function destroyElement(element:iPageElement) : Void { curElement.addEventListener('onElementKilled' , this) curElement.destroy(); } private function onElementKilled(eventObj:Object) : Void { var killElement:iPageElement = eventObj.target; var iter:PageElementIterator = this.getPageElementIterator(); while(iter.hasNext()){ var curElement:iPage = iPage (iter.next()); if(killElement == curElement) { //deleted the element now clear the listener and continue killElement.removeEventListener('onElementKilled' , this) /* * POTENTIAL RISK, if a new element is added, then the index, does not match the right element anymore * * get the current index from the deleted element by checking what * the currentIndex of the iterator is, and remove it from this.pageElements Array */ this.pageElements = this.pageElements.splice((iter.getCurrentIndex() , 0) //get the next element in the iterator array if(iter.hasNext()) this.destroyElement( iPage(iter.next()) ); delete killedElement; break; } } } if(this.pageElements.length == 0){ trace('all page elements have been removed') } } ___ 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] Iterator question
Hello list, i have a page object that contains has a Array that holds pageElements. This is a storage for elements with an iPageElement interface. The page object has an destroy() method. When page.destroy() is called, it will loop trough the page.pageElements Array using an iterator. Every iPageElement broadcasts an onElementKilled message when is has been destroyed. When a pageElement broadcast this message, the page need to continue in deleting the next element in the page.pageElement Array. The callback method onElementKilled in the page instance, searches for the element that has been deleted and then removes it from the page.pageElements Array. This is where i think a problem rises, because if the page.pageElements array is updated during the process, the index does not match the element to remove anymore. How can I solve this potential risk? Another question, the array that is passes into the iterator is a reference to the pageElements Array. Does this mean, that if I delete an element from this array from within the iterator, the page.pageElements array is modified? I hope my question is clear.. thank you in advance. Jiri Below a snippet: private function getPageElementIterator() : Void { return new PageElementIterator(this.pageElements) } //initiated the deleting proces, by starting with the first element. public function destroyPageElements() : Void { destroyElement(this.pageElements[0]); } private function destroyElement(element:iPageElement) : Void { curElement.addEventListener('onElementKilled' , this) curElement.destroy(); } private function onElementKilled(eventObj:Object) : Void { var killElement:iPageElement = eventObj.target; var iter:PageElementIterator = this.getPageElementIterator(); while(iter.hasNext()){ var curElement:iPage = iPage (iter.next()); if(killElement == curElement) { //deleted the element now clear the listener and continue killElement.removeEventListener('onElementKilled' , this) /* * POTENTIAL RISK, if a new element is added, then the index, does not match the right element anymore * * get the current index from the deleted element by checking what * the currentIndex of the iterator is, and remove it from this.pageElements Array */ this.pageElements = this.pageElements.splice((iter.getCurrentIndex() , 0) //get the next element in the iterator array if(iter.hasNext()) this.destroyElement( iPage(iter.next()) ); delete killedElement; break; } } } if(this.pageElements.length == 0){ trace('all page elements have been removed') } } ___ 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