Re: [Flashcoders] AS2: Multilanguage-Listener
hello :) you can use my opensource framework and this extensions with the localization model of ASGard (ext of VEGAS) Page of the Framework project : http://code.google.com/p/vegas/ Install VEGAS and this extensions : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN Example to use the localization model in the svn of the project : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/asgard/system/ My event localization model is based on the W3C dom2/3 event model test the Localization 02 - Eden.fla example.. i use Eden format to creates external files to configurate my localizations. but you can use JSON with my framework or use my framework and this implementation to use XML(in AS2 xml is no speed... Eden more easy to use) More information about Eden format : http://code.google.com/p/edenrr/ More information about JSON format : http://www.json.org/ I use eden to create my configuration file too... http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/asgard/config/ You can use too my Opensource documentation framework AST'r : http://code.google.com/p/astr/ AST'r is a little application framework to implement config/localization/sounds/ in a application based with VEGAS. EKA+ :) 2007/6/12, Cristo @ cryzto.ch [EMAIL PROTECTED]: Hi everybody I'm working on a multilanguage configurator and want to update every textareas, labels etc. by clicking on one of the available lang-buttons (english, german, spanish ect.). My configurator consists of different movieclips/layers of course. Now I've tried to reach this by creating an evenlistener on those buttons, but without success. Code (layer: _level0): var langListener:Object = new Object(); langListener.click = function (EvtObj:Object){ trace(it worked!); }; // ie: english-button _level0.langP_mc.en_btn.addEventListener(click, langListener); Can anyone help? Cryzto No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 12.06.2007 06:39 ___ 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] AS2: Multilanguage-Listener
You have to initialize the object before you can add listeners; var listener:Object = new Object(); listener.click = function ( evt:Object) { trace(it worked!); }; var obj:Object = new Object(); mx.events.EventDispatcher.initialize ( obj ); obj.addEventListener( click, listener ); obj.dispatchEvent ( {type:'click', target:obj } ); _ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cristo @ cryzto.ch Sent: Tuesday, June 12, 2007 12:45 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] AS2: Multilanguage-Listener Hi everybody I'm working on a multilanguage configurator and want to update every textareas, labels etc. by clicking on one of the available lang-buttons (english, german, spanish ect.). My configurator consists of different movieclips/layers of course. Now I've tried to reach this by creating an evenlistener on those buttons, but without success. Code (layer: _level0): var langListener:Object = new Object(); langListener.click = function (EvtObj:Object){ trace(it worked!); }; // ie: english-button _level0.langP_mc.en_btn.addEventListener(click, langListener); Can anyone help? Cryzto No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 12.06.2007 06:39 ___ 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] AS2: Multilanguage-Listener
@ Cryzto where's the practical difference between this solution and the solution where I just tell the Buttons to do what I want There is nothing I could say that Muzak hasn't already said better and repeatedly. With that, search this list on EventDispatcher, encapsulation, and dirty ass code. http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg31071.html http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg31112.html Hasta! // // NO EVENTS // var main = this; var array = [ 'de', 'fr', 'it', 'en' ]; for ( var i in array ) { var btn = this[array[i]]; btn.onRelease = function(){_root.lang_xml.load(conf_+this.label.toLowerCase()+.xml);}; } // // WITH EVENTS // var array = [ 'de', 'fr', 'it', 'en' ]; for ( var i in array ) { var btn = this[array[i]]; mx.events.EventDispatcher.initialize( btn ); btn.addEventListener( 'click', mx.utils.Delegate.create ( this, loadLanguage ) ); btn.onRelease = releaseHandler; } function releaseHandler () { this.dispatchEvent({type:'click',target:this, lang:this.label.toLowerCase() }); } function loadLanguage ( evt:Object ) { _root.lang_xml.load(conf_+evt.lang+.xml); } _ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cristo @ cryzto.ch Sent: Tuesday, June 12, 2007 5:34 PM To: flashcoders@chattyfig.figleaf.com Subject: AW: [Flashcoders] AS2: Multilanguage-Listener @ eka: thanks but for the moment i just want to understand why my code doesn't work... but I sure will take a look at your OpdenSource-project :-) @ Jesse: Thanx fort he hint, I modified now my code to my needs... it works, only: where's the practical difference between this solution and the solution where I just tell the Buttons to do what I want (= onRelease( lang_xml.load(XMLFile); updateTextfields(); ))? Here my code (it works): this.de.onRelease = function() { this.dispatchEvent({type:'click',target:this}); //trace(DE-Button was pressed); } this.fr.onRelease = function() { this.dispatchEvent({type:'click',target:this}); //trace(FR-Button was pressed); } this.it.onRelease = function() { this.dispatchEvent({type:'click',target:this}); //trace(IT-Button was pressed); } this.en.onRelease = function() { this.dispatchEvent({type:'click',target:this}); //trace(EN-Button was pressed); } var langListener:Object = new Object(); langListener.click = function (EvtObj:Object){ var str:String = EvtObj.target.label.toLowerCase(); _root.lang_xml.load(conf_+str+.xml); } for (var prop in this) { mx.events.EventDispatcher.initialize(this[prop]); this[prop].addEventListener(click, langListener); //trace(this[prop]); } stop(); -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Jesse Graupmann Gesendet: Dienstag, 12. Juni 2007 22:09 An: flashcoders@chattyfig.figleaf.com Betreff: RE: [Flashcoders] AS2: Multilanguage-Listener You have to initialize the object before you can add listeners; var listener:Object = new Object(); listener.click = function ( evt:Object) { trace(it worked!); }; var obj:Object = new Object(); mx.events.EventDispatcher.initialize ( obj ); obj.addEventListener( click, listener ); obj.dispatchEvent ( {type:'click', target:obj } ); _ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cristo @ cryzto.ch Sent: Tuesday, June 12, 2007 12:45 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] AS2: Multilanguage-Listener Hi everybody I'm working on a multilanguage configurator and want to update every textareas, labels etc. by clicking on one of the available lang-buttons (english, german, spanish ect.). My configurator consists of different movieclips/layers of course. Now I've tried to reach this by creating an evenlistener on those buttons, but without success. Code (layer: _level0): var langListener:Object = new Object(); langListener.click = function (EvtObj:Object){ trace(it worked!); }; // ie: english-button _level0.langP_mc.en_btn.addEventListener(click, langListener); Can anyone help? Cryzto No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 12.06.2007 06:39 ___ 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