Re: [flexcoders] Dispatch an event from a non visual non IEventDispatcher class
You can use composition to acquire the functionality of EventDispather, in other words add the instance of EventDispatcher class as a property of your VO class More on this: http://www.gskinner.com/blog/archives/2007/07/building_a_stat_1.html http://www.gskinner.com/blog/archives/2007/07/building_a_stat_1.html -- Best regards, JabbyPanda On 11 July 2010 08:13, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com wrote: Is there a way to dispatch an event from a class that doesn't extend EventDispatcher? For example, lets say you have 30 different value object classes. You want to have one method called invalidateData() that dispatches an event to get the latest content from the server. Since I want to keep the data separate from the view I may need to call this in several different places. Any help would be appreciated.
Re: [flexcoders] Dispatch an event from a non visual non IEventDispatcher class
thank u! On Sun, Jul 11, 2010 at 4:16 AM, Andriy Panas a.pa...@gmail.com wrote: You can use composition to acquire the functionality of EventDispather, in other words add the instance of EventDispatcher class as a property of your VO class More on this: http://www.gskinner.com/blog/archives/2007/07/building_a_stat_1.html http://www.gskinner.com/blog/archives/2007/07/building_a_stat_1.html -- Best regards, JabbyPanda On 11 July 2010 08:13, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com wrote: Is there a way to dispatch an event from a class that doesn't extend EventDispatcher? For example, lets say you have 30 different value object classes. You want to have one method called invalidateData() that dispatches an event to get the latest content from the server. Since I want to keep the data separate from the view I may need to call this in several different places. Any help would be appreciated.
Re: [flexcoders] Re: Capturing ENTER key in a Numeric Stepper
Hi Andrew. Can you trap the ENTER (keyCode = 13) on a Numeric Stepper? I've been failing to do this... :( When a user presses the ENTER key, I want to perform an operation, such as a search... So I'm thinking I need to somehow trap the ENTER key and dispatch a custom event. Mmmm... Any ideas? Cheers, Nick On 11 July 2010 03:46, Andrew cottag...@gmail.com wrote: In my applications I use the change event to fire events( like change='doThisThing()'). Seems to work for the number stepper just fine. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Nick Middleweek n...@... wrote: Hello, I've got a form with a few fields on, one being a numeric stepper. On the TextInput, I can test the enter key being pressed using the enter event but there doesn't appear to be an equivalent for the numericstepper... -- Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774 035 5424, blog: http://blog.middleweek.co.uk } );
Re: [flexcoders] Capturing ENTER key in a Numeric Stepper
Hi dork, how you doing?... Thanks for the info on this... Have you managed to achieve this when using a NumericStepper for your form objects? i...@ve just this out as an example: http://flexmusings.wordpress.com/2008/10/30/using-default-button/ And it works when pressing ENTER in either of the TextInputs but if I pop a NS control on the form and press ENTER from within that it doesn't invoke the defaultButton?... Here's my code: http://pastebin.com/65HwfuGf Cheers for the help... Nick On 11 July 2010 01:26, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com wrote: the canvas tag has a defaultButton property that will dispatch a click event on your submitSearch button. i'm not sure what the eq would be in flex 4. On Sat, Jul 10, 2010 at 7:08 PM, Nick Middleweek n...@middleweek.co.ukwrote: Hello, I've got a form with a few fields on, one being a numeric stepper. On the TextInput, I can test the enter key being pressed using the enter event but there doesn't appear to be an equivalent for the numericstepper... Has anyone managed to acheive this and how did you do it please? On enter, I want to dispatch a submitSearch event but can't seem to detect this for the NS control.. Any ideas will be great.. Cheers, Nick -- Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774 035 5424, blog: http://blog.middleweek.co.uk } );
[flexcoders] Re: Capturing ENTER key in a Numeric Stepper
I would probably have an event handler to deal with ALL keystrokes, and within that have a switch statement. One case of the switch statement would be case '13': var searchValue:int = myNumericStepper.value; doTheSearch(searchValue); break; So when the enter key click is captured, the code goes and looks at the number stepper and sends whatever its current value is to the search function. a --- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote: Hi Andrew. Can you trap the ENTER (keyCode = 13) on a Numeric Stepper? I've been failing to do this... :( When a user presses the ENTER key, I want to perform an operation, such as a search... So I'm thinking I need to somehow trap the ENTER key and dispatch a custom event.
[flexcoders] stopping accodion animation
Hey all, I have to be able to dynamically remove children from an accordion container. Problem is, this causes a crash when the animation that runs on the selected child is running when I need to remove the panel. I see no way to force this animation to end or register for notification of it ending. Am I missing something? Turning animation off is not an option. I have worked around this to try to ensure it is impossible for a selected child change to occur anywhere near the remove child, but I would rather code this more defensively if possible. thanks! (ps, I am using 3.5 targeting FP 10.0.0)
Re: [flexcoders] Re: Capturing ENTER key in a Numeric Stepper
Andrew - cheers. My problem was that I am working with a custom Numeric Stepper, I had extended the base control it so it could support null entries and to be quite restrictive with the inputs... 0-9, delete key, backspace, etc... I forgot to include ENTER.. doh! :-) After your post, I decided to go back to basics and testing and trace(event.keyCode.toString()) on the keydownHander... Cheers, it's all sorted. I'm now firing out my own FlexEvent.ENTER from my custom numberstepper. nice! :-) On 11 July 2010 15:31, Andrew cottag...@gmail.com wrote: I would probably have an event handler to deal with ALL keystrokes, and within that have a switch statement. One case of the switch statement would be case '13': var searchValue:int = myNumericStepper.value; doTheSearch(searchValue); break; So when the enter key click is captured, the code goes and looks at the number stepper and sends whatever its current value is to the search function. a --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Nick Middleweek n...@... wrote: Hi Andrew. Can you trap the ENTER (keyCode = 13) on a Numeric Stepper? I've been failing to do this... :( When a user presses the ENTER key, I want to perform an operation, such as a search... So I'm thinking I need to somehow trap the ENTER key and dispatch a custom event. -- Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774 035 5424, blog: http://blog.middleweek.co.uk } );
[flexcoders] show points on linechart. display the Legend of each line series [1 Attachment]
Morning all of you. I need you help about adding the Legend Tag in your solution of showing points on lineChart mentioned in this link:http://www.mail-archive.com/flexcoders@yahoogroups.com/msg36175.html In fact, i do the same thing like you (all work good). but the only different thing that i would want it's to display the Legend of each line series. so when i add the tag mx:Legend dataProvider={myChart}/ which myChart represent the id of the lineChart, i have this error: TypeError:Error #1034: Type Coercion failed: cannot convert mx.charts.chartClasses::legendd...@cc33701 to mx.charts.ChartItem. i tried to add the import like import mx.charts.Legend; import mx.charts.LegendItem; import mx.charts.chartClasses.LegendData; thank you in advance( i attached the image of the error) that is the code: -LabelRenderer2.as package { import flash.display.Graphics; import flash.geom.Rectangle; import mx.charts.ChartItem; import mx.charts.chartClasses.GraphicsUtilities; import mx.core.IDataRenderer; import mx.graphics.IFill; import mx.graphics.IStroke; import mx.skins.ProgrammaticSkin; import mx.controls.Label; import mx.core.UIComponent; import mx.charts.LineChart; import mx.charts.series.items.LineSeriesItem; import mx.charts.Legend; import mx.charts.LegendItem; import mx.charts.chartClasses.LegendData; public class LabeledRenderer2 extends UIComponent implements IDataRenderer { private var _label:Label; public function LabeledRenderer2():void { super(); _label = new Label(); addChild(_label); _label.setStyle(color,0x00); } private var _chartItem:ChartItem; public function get data():Object { return _chartItem; } public function set data(value:Object):void { if (_chartItem == value) return; _chartItem = ChartItem(value); if(_chartItem != null) _label.text = LineSeriesItem(_chartItem).yValue.toString(); } private static const fills:Array = [0xFF,0x00FF00,0xFF, 0x00,0xFF00FF,0x00, 0xAAFFAA,0xFF,0xFF]; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); _label.setActualSize(_label.getExplicitOrMeasuredWidth(),_label.getExplicitOrMeasuredHeight()); _label.move(unscaledWidth - _label.getExplicitOrMeasuredWidth(), unscaledHeight/2 - _label.getExplicitOrMeasuredHeight()/2); } } } LineChart.mxml- ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;; styleName=plain mx:Script import mx.graphics.Stroke; [Bindable] public var expenses:Object = [{Month: Jan, Profit: 2000, Expenses: 1500, Amount: 450}, {Month: Feb, Profit: 1000, Expenses: 200, Amount: 600}, {Month: Mar, Profit: 1500, Expenses: 500, Amount: 300}]; public var s:Stroke = new Stroke(0x001100); /mx:Script mx:Panel title=Line Chart borderStyle=solid textAlign=center mx:Label text= / mx:LineChart id=myChart dataProvider={expenses} mx:horizontalAxis mx:CategoryAxis dataProvider={expenses} categoryField=Month / /mx:horizontalAxis mx:series mx:LineSeries yField=Profit itemRenderer=LabeledRenderer2/ mx:LineSeries yField=Expenses/ mx:LineSeries yField=Amount/ /mx:series /mx:LineChart mx:Legend dataProvider={myChart}/ /mx:Panel /mx:Application