But if i would have a dynamic object like mine one and the reads values in the correct order, for example: first object: production test monday 23 tuesday 45 second object: production test 2 monday 34 tuesday 56
and so on... when i try to rint the object fields are not in the correct order... tuesday 45 production test monday 23 instead of dynamic object how can i craete a not dynamic one and then print values cuple field-value?i'll prefer to have a not dynamic object and pass it to an array collection.. thanks thanks thanks --- In [email protected], "Haykel BEN JEMIA" <hayke...@...> wrote: > > This is a bit different. In the last example, the objects were generic with > dynamic properties (are not declared). The class CustomProvider is dynamic, > which means it can hold dynamic properties, but the properties in your code > (monday, tuesday) are declared, hence not dynamic. The for..in loop only > iterates over dynamic properties and methods. To make them dynamic, don't > declare them, just add them at runtime. > > More info here: > http://livedocs.adobe.com/flex/3/html/help.html?content=usingas_8.html > > > Haykel Ben Jemia > > Allmas > Web & RIA Development > http://www.allmas-tn.com > > > > > On Thu, Dec 18, 2008 at 5:56 PM, lorenzo.boaro <lore...@...> wrote: > > > hi, > > > > i'll hope that you are very patient... > > > > i'll try your code...but not works..maybe i made mistake in creating > > the custom provider... > > > > i have this class > > > > public dynamic class CustomProvider extends Object > > { > > private var test:String; > > private var monday:String; > > private var tuesday:String; > > > > public function CustomAdvancedBaseGridProvider(test:String, > > monday:String, tuesday:String) > > { > > super(); > > this.test= test; > > this.monday= monday; > > this.tuesday= tuesday; > > } > > > > and then plus instances of CustomProvider are passed to an > > Arraycolection... > > > > thanks > > > > Lorenzo > > > > > > --- In [email protected] <flexcoders%40yahoogroups.com>, "Haykel > > BEN JEMIA" <haykelbj@> > > wrote: > > > > > > If your array has the id "a" for example, you can do: > > > > > > for each (var o:Object in a) > > > { > > > for (var p:Object in o) > > > { > > > trace(p + " " + o[p]); > > > } > > > } > > > > > > You can access the properties of an object like with an array. > > > > > > Haykel Ben Jemia > > > > > > Allmas > > > Web & RIA Development > > > http://www.allmas-tn.com > > > > > > > > > > > > > > > On Thu, Dec 18, 2008 at 3:30 PM, lorenzo.boaro <loreboa@> wrote: > > > > > > > you have perfectly reason!!! > > > > > > > > thanks a lot... > > > > > > > > can i pose you the last question? > > > > > > > > i've an array collection like this (written completely from as3!!) > > > > > > > > <mx:Array> > > > > <mx:Object monday="23" tuesday="45" /> > > > > <mx:Object monday="33" tuesday="90" /> > > > > <mx:Object monday="13" tuesday="15" /> > > > > </mx:Array> > > > > > > > > can i access fields names (monday for example) and values (23 for > > > > example) from as3 with a for cycle? how can i do this? > > > > > > > > for example i would print > > > > > > > > monday 23 > > > > tuesday 45 > > > > > > > > and so on... > > > > > > > > thanks again..you are right! > > > > > > > > > > > > --- In [email protected] <flexcoders%40yahoogroups.com><flexcoders% > > 40yahoogroups.com>, > > "Haykel > > > > BEN JEMIA" <haykelbj@> > > > > wrote: > > > > > > > > > > The panel that fired the event is e.target! The curentPanel is a > > > > property of > > > > > the NewEvent itself, so you access it directly through > > > > e.currentPanel, but > > > > > before, you have either to make it public or implement a public > > > > getter for > > > > > it. As I said, if with currentPanel you just want to save a > > > > reference to the > > > > > panel that fired the event, then you don't need it, it's in > > e.target. > > > > > > > > > > For the stopPropagation functions, which one to use depends on what > > > > you want > > > > > to do, you can find more information here: > > > > > > > http://livedocs.adobe.com/flex/3/html/help.html?content=events_08.html > > > > > > > > > > Haykel Ben Jemia > > > > > > > > > > Allmas > > > > > Web & RIA Development > > > > > http://www.allmas-tn.com > > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Dec 18, 2008 at 12:55 PM, lorenzo.boaro <loreboa@>wrote: > > > > > > > > > > > tahnks > > > > > > > > > > > > now it works... > > > > > > > > > > > > an other question... > > > > > > > > > > > > if i modify theevent class to pass a panel > > > > > > > > > > > > > > > > > > public static const NEW_EVENT:String = "newEvent"; > > > > > > > > > > > > private var currentPanel:Panel; > > > > > > > > > > > > override public function clone():Event { > > > > > > return new FlipEvent(type, currentPanel); > > > > > > } > > > > > > > > > > > > public function NewEvent(type:String, currentPanel:Panel) > > > > > > { > > > > > > super(type); > > > > > > this.currentPanel = currentPanel; > > > > > > } > > > > > > > > > > > > then when i fire the event how my function test can know about the > > > > > > currentPanel > > > > > > > > > > > > for example like this.. > > > > > > > > > > > > function test(e:NewEvent) { > > > > > > trace(e.target.currentPanel); > > > > > > } > > > > > > > > > > > > then i would stop the propagation of the event > > > > > > > > > > > > there are two methods > > > > > > > > > > > > stopPropagation or stopImmediatePropagation ..how can i use? > > > > > > > > > > > > thanks again > > > > > > > > > > > > --- In [email protected] <flexcoders%40yahoogroups.com> > > <flexcoders%40yahoogroups.com><flexcoders% > > > > > > 40yahoogroups.com>, > > > > > > > > "Haykel > > > > > > BEN JEMIA" <haykelbj@> > > > > > > wrote: > > > > > > > > > > > > > > You have to add the event listener to the object that > > dispatches the > > > > > > event > > > > > > > you want to listen to. If your panels have the ids "panel1" and > > > > > > "panel2" for > > > > > > > example, you have to do: > > > > > > > > > > > > > > panel1.addEventListener(NewEvent.FLIP_EVENT, test); > > > > > > > panel2.addEventListener(NewEvent.FLIP_EVENT, test); > > > > > > > > > > > > > > and not > > > > > > > > > > > > > > this.addEventListener(NewEvent.FLIP_EVENT, test); > > > > > > > > > > > > > > If in the event listener function (test) you need to know which > > > > panel > > > > > > > dispatched the event, you can use the event.target property > > or you > > > > > > can use a > > > > > > > different event listener for every panel. > > > > > > > > > > > > > > > > > > > > > Haykel Ben Jemia > > > > > > > > > > > > > > Allmas > > > > > > > Web & RIA Development > > > > > > > http://www.allmas-tn.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Dec 18, 2008 at 12:09 PM, lorenzo.boaro <loreboa@>wrote: > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > i can't understand the custom event business! > > > > > > > > > > > > > > > > can you help me? > > > > > > > > > > > > > > > > i'll explain the problem.. > > > > > > > > > > > > > > > > i've created this class: > > > > > > > > > > > > > > > > package events > > > > > > > > { > > > > > > > > import flash.events.Event; > > > > > > > > > > > > > > > > import mx.containers.Panel; > > > > > > > > > > > > > > > > public class NewEvent extends Event > > > > > > > > { > > > > > > > > public static const NEW_EVENT:String = "newEvent"; > > > > > > > > > > > > > > > > override public function clone():Event { > > > > > > > > return new NewEvent(type); > > > > > > > > } > > > > > > > > > > > > > > > > public function NewEvent(type:String) > > > > > > > > { > > > > > > > > super(type); > > > > > > > > } > > > > > > > > > > > > > > > > } > > > > > > > > } > > > > > > > > > > > > > > > > the i have two custom panels that have 2 buttons respectively > > > > and in > > > > > > > > the mouse click event they dispatch the NewEvent event: > > > > > > > > > > > > > > > > var ne:NewEvent = new NewEvent(NewEvent.FLIP_EVENT); > > > > > > > > dispatchEvent(ne); > > > > > > > > > > > > > > > > after class definitions i put the event metadata tag > > correctly. > > > > > > > > > > > > > > > > finally a custom viewstack listens for panel events, in the > > > > > > > > constructor of the viewstack i put > > > > > > > > > > > > > > > > this.addEventListener(NewEvent.FLIP_EVENT, test); > > > > > > > > > > > > > > > > the function prova use the trace function to print a message. > > > > > > > > > > > > > > > > but i can't undestand why not works...maybe i made > > mistakes or i > > > > > > > > misunderstood listener concepts? > > > > > > > > > > > > > > > > thanks a lot > > > > > > > > > > > > > > > > Regards Lorenzo > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >

