[flexcoders] No, Flex Flash Are Not Dead
http://www.tricedesigns.com/2011/11/16/no-flex-flash-are-not-dead/
[flexcoders] Re: Binding behaviour
I have to disagree. If a child property is a class or a collection, you will be setting a reference to the same objects in the cloned parent. Thus, updates to the child property will be made to both the clone and the original. ObjectUtil.copy() is another good way to clone, but does not always work for deeply nested objects. -TH --- In flexcoders@yahoogroups.com, The Real Napster myadi.h@... wrote: Ok. But Its Not compulsory that you have to write a clone method. Anyways other way you can try is public function cloneLeaf():CallMonitoringLeaf { var obj:CallMonitoringLeaf = new CallMonitoringLeaf(); obj.optionCallMonitoring = this.optionCallMonitoring; obj.nodesSelected =this.nodesSelected; obj.dataCallMonitoring = this.dataCallMonitoring; obj.nodeName = this.nodeName; return obj; } So now calling cloneLeaf() returns new duplicated object. Hope this works for you. I did't test it, however your reply will tell about that. :) Thanks On Thu, Nov 3, 2011 at 9:26 PM, turbo_vb TimHoff@... wrote: ** If nodeName is a class, you'll need to create a clone method in that class as well, and do this: obj.nodeName = nodeName.clone(); If it's just a string, you can try: obj.nodeName = nodeName.toString(); -TH --- In flexcoders@yahoogroups.com, geckko geckko80@ wrote: Hi all, I'm trying to duplicate one object but when i modify the master object the child object is modified too. My code is something similar to this private function cloneLeaf():CallMonitoringLeaf{ var obj:CallMonitoringLeaf = new CallMonitoringLeaf(); obj.optionCallMonitoring = optionCallMonitoring; obj.nodesSelected = nodesSelected; obj.dataCallMonitoring = dataCallMonitoring; obj.nodeName = nodeName; return obj; } But when i modify nodeName (for example) in the object that i use to duplicate (master object), the child object modifies its name too. Is there any way to avoid this behaviour? Thanks in advance
[flexcoders] Re: Binding behaviour
If nodeName is a class, you'll need to create a clone method in that class as well, and do this: obj.nodeName = nodeName.clone(); If it's just a string, you can try: obj.nodeName = nodeName.toString(); -TH --- In flexcoders@yahoogroups.com, geckko geckko80@... wrote: Hi all, I'm trying to duplicate one object but when i modify the master object the child object is modified too. My code is something similar to this private function cloneLeaf():CallMonitoringLeaf{ var obj:CallMonitoringLeaf = new CallMonitoringLeaf(); obj.optionCallMonitoring = optionCallMonitoring; obj.nodesSelected = nodesSelected; obj.dataCallMonitoring = dataCallMonitoring; obj.nodeName = nodeName; return obj; } But when i modify nodeName (for example) in the object that i use to duplicate (master object), the child object modifies its name too. Is there any way to avoid this behaviour? Thanks in advance
[flexcoders] Re: ModuleLoader.child is null
Perhaps you're getting an error on load; probably due to the path. Try adding an event listener for ModuleEvent.ERROR. Also, this line is missing an equal sign: var test:ITest ITest(this._moduleLoader.child); Should be: var test:ITest = ITest(this._moduleLoader.child); -TH --- In flexcoders@yahoogroups.com, method_air loudjazz@... wrote: Can anyone explain why ModuleLoader.child is null in the module event 'ready' event listener: this._moduleLoader = new ModuleLoader(); this._moduleLoader.url = ImageComparisonModule.swf; // this._moduleLoader.addEventListener(ModuleEvent.READY, onReady); private function onReady(e:ModuleEvent):void { var test:ITest ITest(this._moduleLoader.child); // null } Module code: ?xml version=1.0 encoding=utf-8? s:Module xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx implements=com.storefront.interfaces.controller.ITest fx:Declarations !-- Place non-visual elements (e.g., services, value objects) here -- /fx:Declarations s:VGroup width=100% / /s:Module Cheers, Philip
[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid
Cast the owner property to DataGrid. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote: I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need to get access to the Datagrid from the custom itemrenderer. What's the best way to do this? Thanks, in advance.
[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid
That error looks like you were trying to cast parent instead of owner. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote: Thanks. I should have mentioned that I did initially that and was getting the following error: TypeError: Error #1034: Type Coercion failed: cannot convert spark.components.gridClasses::GridLayer@260fac29 to spark.components.DataGrid --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Cast the owner property to DataGrid. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need to get access to the Datagrid from the custom itemrenderer. What's the best way to do this? Thanks, in advance.
[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid
hmm, don't know what to tell you. The following works fine: var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as ArrayCollection; -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote: No, I was casting owner and got that error. i.e. - Datagrid(owner).dataprovider --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: That error looks like you were trying to cast parent instead of owner. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: Thanks. I should have mentioned that I did initially that and was getting the following error: TypeError: Error #1034: Type Coercion failed: cannot convert spark.components.gridClasses::GridLayer@260fac29 to spark.components.DataGrid --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Cast the owner property to DataGrid. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need to get access to the Datagrid from the custom itemrenderer. What's the best way to do this? Thanks, in advance.
[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid
Try sticking that in override prepare() or set data(), and make sure that data isn't null, and I bet you that it'll work. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@... wrote: hmm, don't know what to tell you. The following works fine: var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as ArrayCollection; -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: No, I was casting owner and got that error. i.e. - Datagrid(owner).dataprovider --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: That error looks like you were trying to cast parent instead of owner. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: Thanks. I should have mentioned that I did initially that and was getting the following error: TypeError: Error #1034: Type Coercion failed: cannot convert spark.components.gridClasses::GridLayer@260fac29 to spark.components.DataGrid --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Cast the owner property to DataGrid. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need to get access to the Datagrid from the custom itemrenderer. What's the best way to do this? Thanks, in advance.
[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid
Cool! -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote: That worked! I put it in prepare() and was able to get a reference to the datagrid. Thanks to all for the assistance. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Try sticking that in override prepare() or set data(), and make sure that data isn't null, and I bet you that it'll work. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: hmm, don't know what to tell you. The following works fine: var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as ArrayCollection; -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: No, I was casting owner and got that error. i.e. - Datagrid(owner).dataprovider --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: That error looks like you were trying to cast parent instead of owner. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: Thanks. I should have mentioned that I did initially that and was getting the following error: TypeError: Error #1034: Type Coercion failed: cannot convert spark.components.gridClasses::GridLayer@260fac29 to spark.components.DataGrid --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Cast the owner property to DataGrid. -TH --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote: I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need to get access to the Datagrid from the custom itemrenderer. What's the best way to do this? Thanks, in advance.
[flexcoders] Re: right align the gridcolumn text
ClassFactory doesn't support setting styles; they're different than properties. You can get around this by either: 1) use a custom item renderer that has a styleName or css selector. 2) extend ClassFactory to support setting styles on the item renderer instances. See com.blogagic.core.UIComponentFactory at http://blogagic.com/_flex/libagic_source/srcview/index.html -TH --- In flexcoders@yahoogroups.com, bhaq1972 mbhaque@... wrote: GridColumn doesn't have the textAlign style. Instead we can do this - s:GridColumn id=col dataField=etc s:itemRenderer fx:Component s:DefaultGridItemRenderer textAlign=right color=black/ .. How can I do this in actionscript? I've tried the following but doesn't work var renderer1:ClassFactory = new ClassFactory(DefaultItemRenderer); renderer1.properties = { textAlign:right, color:0xff00ff }; col.itemRenderer = renderer1; //doesnt work
[flexcoders] Re: Flex 4.1 VBOX background renderer fails
In practice, itemRenderers actually tend to be the best candidate for skins. -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@... wrote: You cannot set the backgroundColor of the renderer. Backgrounds are removed in order to allow alternating background colors to show through. But you should be able to set it on the TextArea. On 10/24/11 6:40 PM, Sells, Fred fred.sells@... wrote: Yes I tried setStyle() as well as styleName= with no success. I could not set the backgroundColor property in actionscript (compiler did not recognize property) but I could set that property in mxml to a binding expression and set the color in the bound variable. Suspect bug but deadlines rapidly approaching and this works. I'll try upgrading to 4.5 once I get this delivery out. From: flexcoders@yahoogroups.com [mailto:flexcoders@yah! oogroups.com] On Behalf Of Alex Harui Sent: Monday, October 24, 2011 7:41 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex 4.1 VBOX background renderer fails Did you try myText.setStyle(backgroundColor, ...)? On 10/24/11 9:59 AM, Sells, Fred fred.sells@... wrote: I'm using a VBox as a renderer for a datagrid as shown below. I've tried every combination I can think of but I can only set the background color of the mx:TextArea in the mxml. I need to change it in the actionscri! pt. I've tried styles and properties with no success. n! bsp;I'm brreluctant to change wrapper or children since I had a very hard time getting it to work with a custom row height. I used HTML text so I could add some bold/font color decoration; although that requirement has dissipated. ?xml version=1.0 encoding=utf-8? mx:VBox xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx borderThickness=0 verticalScrollPolicy=off horizontalScrollPolicy=off paddingBottom=0 paddingLeft=0 paddingRight=0 paddingTop=0 fx:Script ![CDATA[ private var _data:Object; public static var PAYOR_COLORS:Object ={0:pink, 1:lightgreen,! 3:libhtblue, 8:yellow}; override public function set data(value:Object):void{ _data = value; mytext.htmlText = set data called; if (_data==null || _data.resident__id==0) { mytext.visible = false; }else{ mytext.visible = true; var color:String = PAYOR_COLORS[_data.payor]; if (color==null) color=black; //mytext.backgroundColor = color; mytext.opaqueBackground = color; mytext.htmlText = _data.name; trace(colordata.name = +color+, payor=+_data.payor); //mytext.styleName = payor+_data.payor; //this.setStyle(backgroundColor, yellow); //trace(style=payor+_data.payor+;); //this.setStyle(color, green); //background = true; trace(render +_data.name+, +color);} } override public function get data():Objec! t{ re turn _data; } ]] /fx:Script mx:TextArea id=mytext width=100% height=100% useHandCursor=true buttonMode=true mouseFocusEnabled=false mouseChildren=false editable=false verticalScrollPolicy=off horizontalScrollPolicy=off !-- mx:htmlText ![CDATA[Joe Bl0w font color=#FFMCD/font pline2/p]] /mx:htmlText -- /mx:TextArea !-- sample use from web ![CDATA[ Joe Blw font color=#FFHTML text/font in a bHalo TextArea control/b. pUse the uhtmlText property/u of the font color=#008800TextArea control/font to include basic HTML markup in! your text. ]] -- /mx:VBox -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: toggling checkbox's enabled field in datagrid
Have you tried this: mx:CheckBox id=cb selected={ data.fired } enabled={ data.type != 0 } / -TH --- In flexcoders@yahoogroups.com, carriecharp carriecharp@... wrote: I've inherited some code to update and I could use some help. I have an Advanced Data Grid where one column uses a custom checkbox component. It's very simple with the checkbox's selected field controlled by column's datafield, which is a Boolean named 'fired'. I want to have the checkbox enabled only in certain situations, dependent upon a second field , an int called 'type'. Basically, enabled = (type!=0). 'type' is a field in the grid's dataprovider and I want to set the enabled field in the declaration below but I can't figure out how to reference the 'type' field. Any guidance is appreciated! Thanks, Carrie mx:Component id=cbEditor mx:HBox horizontalAlign=center backgroundAlpha=1 width=100% mx:Script ![CDATA[ public var selected:Boolean; ]] /mx:Script mx:CheckBox id=cb selected={data.fired} click=selected=data.fired=cb.selected; width=15/ /mx:HBox /mx:Component
[flexcoders] Re: Best practices for dynamically styling components in FlashBuilder 4.5
styleManager.getStyleDeclaration(style_name).setStyle(property, value); -TH --- In flexcoders@yahoogroups.com, c0mpl3xxx ktyacke@... wrote: Hi all, I'm trying to create a set of components for a video player app that require the ability to be styled via user supplied color options. Basically I have a set of buttons and text objects that will receive custom color properties from the user. This would be easy enough to accomplish using custom style properties on the components and a little CSS; however, I can't figure out how to make this work since the color data is dynamic and served up by the server (i.e. I can't hard-code or create any css style sheets during the build process). I am looking for any ideas / best practices on how to accomplish the following: 1) Styling components using data supplied at run-time 2) Updating specific stylesheet properties at run-time (i.e. I want to change the fontSize value for a custom style called .h1). Ideally I'd be able to link the various components to some stored properties (like css) and then just update those properties and have the components automatically respond. Any suggestions would be greatly appreciated! Thanks!
[flexcoders] Re: Can't see scrollbars on an MX list in a Spark TitleWindow
Have you tried setting an explicit height for the List? -TH --- In flexcoders@yahoogroups.com, Nick Middleweek nick@... wrote: Mmmm, I must be doing something silly, I've also tried this using MX only components, so MX:TitleWindow with an MX:List. Here's my code: http://pastebin.com/ZkzPQBgJ ... and I'm not getting any Scrollbars on the List... height = 100%, TitleWindow.height=250. Can anyone see what I'm missing? Cheers, Nick On 9 September 2011 16:31, Nick Middleweek nick@... wrote: Hi, Are there any obvious reasons why my MX List won't show scrollbars. It's tucked inside a Spark TitleWindow. The list has verticalScrollPolicy = on, width and height = 100% and the TitleWindow is width = 400, height = 250. There is enough data so the List should render scrollbars. Thanks, Nick
[flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
You might try bumping up from UIComponent to GroupBase and set mouseEnabledWhereTransparent = true; -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@... wrote: Something has to draw onto every pixel, otherwise the mouse hit passes through to underneath. You can set the alpha to 0 and it will still work. You can also set background=true and pick a backgroundColor on the TextField and not have to draw the fill. On 9/6/11 2:18 AM, Nick Middleweek nick@... wrote: OK, well I've settled with the white background for now... On 5 September 2011 11:36, Nick Middleweek nick@... wrote: Hi, We're using Flex 4 and have an Item Renderer that extends UIComponent. We're adding a TextField that's added in createChildren(). In the Constructor(), I'm adding the listener: this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); ...And in the listener function, I'm adding a button: indicator = new Button(); indicator.width = 20; indicator.height = 20; indicator.label = ...; this.addChild(indicator); this.invalidateDisplayList(); The problem is that the MouseOver event is ONLY firing when I mouse over the TextField and not the 'background' of the IR. If I draw a rectangle in updateDisplayList: // draw rect this.graphics.beginFill(0xFF, 1); this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); this.graphics.endFill(); ... the MouseOver event DOES fire on the red background. Is there a way of achieving this without drawing a rectangle? I did think of setting the rect to white but this doesn't seem like the correct approach. Thanks for any help... Nick -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
It doesn't seem that skinning is something that Adobe considered would need to be done in a skin class, for an item renderer. But, you can apply a skin class to them if desired. At each level: GroupBase, Group, DataRenderer, and finally ItemRenderer, you get additional functionality; and consequently, a little more overhead. For instance, if you used ItemRenderer instead of UIComponent, you could use the hovered state to control the visibility of the button. However, I think that you're going about it the most efficient way in creating AS item renderers instead of mxml; especially for ADG. -TH --- In flexcoders@yahoogroups.com, Nick Middleweek nick@... wrote: Thanks for the tip... If I bumped up to GroupBase, does that mean I can use Spark skinning as well or is this not related? On 6 September 2011 16:31, turbo_vb TimHoff@... wrote: ** You might try bumping up from UIComponent to GroupBase and set mouseEnabledWhereTransparent = true; -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Something has to draw onto every pixel, otherwise the mouse hit passes through to underneath. You can set the alpha to 0 and it will still work. You can also set background=true and pick a backgroundColor on the TextField and not have to draw the fill. On 9/6/11 2:18 AM, Nick Middleweek nick@ wrote: OK, well I've settled with the white background for now... On 5 September 2011 11:36, Nick Middleweek nick@ wrote: Hi, We're using Flex 4 and have an Item Renderer that extends UIComponent. We're adding a TextField that's added in createChildren(). In the Constructor(), I'm adding the listener: this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); ...And in the listener function, I'm adding a button: indicator = new Button(); indicator.width = 20; indicator.height = 20; indicator.label = ...; this.addChild(indicator); this.invalidateDisplayList(); The problem is that the MouseOver event is ONLY firing when I mouse over the TextField and not the 'background' of the IR. If I draw a rectangle in updateDisplayList: // draw rect this.graphics.beginFill(0xFF, 1); this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); this.graphics.endFill(); ... the MouseOver event DOES fire on the red background. Is there a way of achieving this without drawing a rectangle? I did think of setting the rect to white but this doesn't seem like the correct approach. Thanks for any help... Nick -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Why don't horizontalCenter and verticalCenter work with Spark ColumnConstraints?
Ok, that makes a little more sense now. It can still work, but instead of moving the boxes, during transition, move the groups; and resize the boxes within the groups. As an alternative, you could choose to use a custom layout class. -TH --- In flexcoders@yahoogroups.com, RobertTr rexdtripod@... wrote: Can't do it. Boxes must be constrained via ConstraintColumns. The boxes switch sides, resize, appear and disappear, etc. via different states and there are transitions on those states to ease the boxes in as they move and resize. Picture a reverse button upper right that when clicked reverses the position of the boxes. When the boxes reverse, they smoothly transition to their new reversed positions. Those transitions won't work if the components are in different groups. They have to be horizontally centered on a ColumnConstraint, not a Group container. This isn't a new app. It's an existing app with a well designed UI. I'm just transitioning to Spark so as to take advantage of the new skinning model and facilitate parallel browser and mobile skins. Can't change the app's behavior in the process. In any event, I heard back from Adobe on this. They said, we didn't have enough time to implement horizontal/verticalCenter in the last release (hopefully coming in the next!).. I asked if they meant for all Spark containers or what. They responded, Yes, basically, they are not implemented in ConstraintLayout. ConstraintLayout handles all of the ConstraintColumns/ConstraintRows layout logic. So that leaves me stuck until the next release unless I can find a workaround. turbo_vb wrote: Constraints are designed to be used to constrain other components for things like alignment and size. For your app, just add a group around each of your containers and you're fine. -TH ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx backgroundColor=blue s:SkinnableContainer id=mainContentArea backgroundColor=red bottom=100 top=100 s:layout s:ConstraintLayout s:constraintColumns s:ConstraintColumn id=col1 width={ width / 2 } / s:ConstraintColumn id=col2 width={ width / 2 } / /s:constraintColumns /s:ConstraintLayout /s:layout s:Group height=100% left=col1:0 right=col1:0 s:BorderContainer id=greenContainer width=400 height=300 backgroundColor=green horizontalCenter=0 verticalCenter=0 / /s:Group s:Group height=100% left=col2:0 right=col2:0 s:BorderContainer id=yellowContainer width=200 height=150 backgroundColor=yellow horizontalCenter=0 verticalCenter=0 / /s:Group /s:SkinnableContainer /s:Application --- In flexcoders@yahoogroups.com, RobertTr rexdtripod@ wrote: Here's code that splits the screen into two columns, left and right. Then it puts a box in each column and attempts to center them. The horizontalCenter and verticalCenter properties are ignored: ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx backgroundColor=blue fx:Declarations !-- Place non-visual elements (e.g., services, value objects) here -- /fx:Declarations s:SkinnableContainer id=mainContentArea top=100 bottom=100 backgroundColor=red s:layout s:ConstraintLayout s:constraintColumns s:ConstraintColumn id=col1 width={width/2} / s:ConstraintColumn id=col2 width={width/2} / /s:constraintColumns /s:ConstraintLayout /s:layout s:BorderContainer id=greenContainer
[flexcoders] Re: Why don't horizontalCenter and verticalCenter work with Spark ColumnConstraints?
Constraints are designed to be used to constrain other components for things like alignment and size. For your app, just add a group around each of your containers and you're fine. -TH ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx backgroundColor=blue s:SkinnableContainer id=mainContentArea backgroundColor=red bottom=100 top=100 s:layout s:ConstraintLayout s:constraintColumns s:ConstraintColumn id=col1 width={ width / 2 } / s:ConstraintColumn id=col2 width={ width / 2 } / /s:constraintColumns /s:ConstraintLayout /s:layout s:Group height=100% left=col1:0 right=col1:0 s:BorderContainer id=greenContainer width=400 height=300 backgroundColor=green horizontalCenter=0 verticalCenter=0 / /s:Group s:Group height=100% left=col2:0 right=col2:0 s:BorderContainer id=yellowContainer width=200 height=150 backgroundColor=yellow horizontalCenter=0 verticalCenter=0 / /s:Group /s:SkinnableContainer /s:Application --- In flexcoders@yahoogroups.com, RobertTr rexdtripod@... wrote: Here's code that splits the screen into two columns, left and right. Then it puts a box in each column and attempts to center them. The horizontalCenter and verticalCenter properties are ignored: ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx backgroundColor=blue fx:Declarations !-- Place non-visual elements (e.g., services, value objects) here -- /fx:Declarations s:SkinnableContainer id=mainContentArea top=100 bottom=100 backgroundColor=red s:layout s:ConstraintLayout s:constraintColumns s:ConstraintColumn id=col1 width={width/2} / s:ConstraintColumn id=col2 width={width/2} / /s:constraintColumns /s:ConstraintLayout /s:layout s:BorderContainer id=greenContainer backgroundColor=green width=400 height=300 horizontalCenter=col1:0 verticalCenter=0 /s:BorderContainer s:BorderContainer id=yellowContainer backgroundColor=yellow width=200 height=150 horizontalCenter=col2:0 verticalCenter=0 /s:BorderContainer /s:SkinnableContainer /s:Application -- View this message in context: http://old.nabble.com/Why-don%27t-horizontalCenter-and-verticalCenter-work-with-Spark-ColumnConstraints--tp32358020p32358020.html Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] Re: Best Practice for Subclassed UIComponent and DataProvider
You have the right idea; to encapsulate the dataProvider, validation and change event handler. But, instead of putting them inside the control, wrap all of that into a common facilities model, that gets used anywhere it's needed in the application. I stopped using Cairngorm a long time ago, but hopefully the newest version supports dependency injection; so you can just inject a reference to the facilities model where needed, and hook it up to the combo box. That would be best practice. But, at the end of the day, the goal is to make it work, so... -TH --- In flexcoders@yahoogroups.com, hanzo55 shawn.a.holmes@... wrote: I very much appreciate the help! Any chance I can take to improve the design would be greatly beneficial, from a maintenance standpoint. My feeling originally was if I have two comboboxes that are in entirely different parts of the app, but that will always be populated by the same data provider, always have the same validation and always utilize the same change function (while being different from other comboboxes in the site), it made sense to encapsulate the dataprovider/validation/change events into the box itself so it could be added to a view without having to specify all of the various attributes a combobox needs--since they are not changing. Initially, it seemed a bit pointless to write: components:FacilityComboBox dataProvider={model.facilities} / everywhere I implemented the Facility ComboBox since everywhere the Facility ComboBox is implemented...the dataProvider is *going* to be model.facilities and will never change. If you think that there is a good example somewhere that demonstrates a better design for this type of class hierachy, please point me to it and I'll have a look. As the subject states, I'm very much looking for the best practice here. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Validation can be abstracted just like dataProviders. For a combo box, you only need to validate the selectedItem; from the view, presentation model, or a common utility class. Most other stuff happens in itemRenderers; that have a little more freedom. It may be that you're locked into a structure that was handed to you, but hardcoding a reference to a singleton model, from which you set the data provider of a combo box from within the combo box, breaks the rules. If you're having problems with binding the dataProvider to the model's property, the binding problem is probably upstream from the combo box. Good luck Shawn, just trying to help. -TH --- In flexcoders@yahoogroups.com, hanzo55 shawn.a.holmes@ wrote: There's more to the story in regards to the class design than what's provided here; The subclass is actually part of a larger set of classes that share common functionality in terms of their validation and change events based on the data-providers for a global app. That common functionality is centralized in their parent class. The dataProvider assignment in the constructor is tying those specific ComboBox subclasses to a family of service providers that produce an expected set of columns. Since those ComboBoxes, with their very specific validation and change routines (which are common to each other), apply very tightly to those service providers and no others, it made sense to subclass them and encapsulate dataProvider assignment, so those ComboBoxes could be used in any views that apply to that family of services. ...if that makes sense. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Can't see any good reason to subclass a control in order to hardcode the dataProvider. The idea is to keep the components loosely coupled. Are you having a problem with dataProvider={model.facilities}? -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Binding a visual component to a singleton limits its reuse. So there may not really a best practice. The minimum code way is probably to assign the dataProvider in commitProperties instead of the constructor. The model.facilities might have its final assignment by then. On 8/25/11 9:41 AM, hanzo55 shawn.a.holmes@ wrote: I am working with a project already in place. It uses Cairngorm and is built on Flex 3.0.2.2113 A standard ComboBox is implemented in one of the views like so: mx:ComboBox dataProvider={model.facilities} id=Facility model is a bindable singleton, and one of its properties, facilities is a public ArrayCollection. On initialization, a function runs in the singleton to populate facilities; it does this by pointing model.facilities to another ArrayCollection that has been previously populated
[flexcoders] Re: How to call container's method into component file
That's bad advice Rishi; that leads to tight coupling and parent abuse. It's ok to have a parent call a method on a child ( data binding is preferred though). But, children shouldn't call methods directly on their parents. Instead, have the child component dispatch an event to initiate the save method on the parent. -TH --- In flexcoders@yahoogroups.com, Rishi Tandon rishitandon123@... wrote: Use object oriented best practice. Mxml I'd nothing but a actionscript class. If u r initializing the custom component inside the other component, then u can directly access the method or else use the Application.application.componentiD.methodName if u are Where are u initializing globally. Sent from my iPhone On Aug 28, 2011, at 2:21 AM, shail shail_link@... wrote: Hi Group, I have a customize container component in which i am using one sub-component. The customize container has one overriden method save(), i want to call this method in subcomponent. Can this be possible? my code looks like this - GraphDex.mxml CustPanel script overrides public void save(){ //plz ignore syntex } /script Dex id=dexone/ /CustPanel Here I want to call mentioned save() method in Dex component that contain some graphs, so on click event of Dex graphs i want to call save functionality. As being new bee,Please suggest if my approach is wrong.
[flexcoders] Re: Best Practice for Subclassed UIComponent and DataProvider
Back to your problem. If you're not seeing the combo box's dataProvider populate or update, then it's a binding problem. Good idea to try the BindingUtils, but it's easier to fix the binding events in the model. If you're using a getter / setter in the model, for the facilities collection, make sure that the binding event is dispatched in the setter. If you're not seeing the collection update, when existing items have been changed elsewhere, then listen for the COLLECTION_CHANGE event on the facilities collection, and in the listener function, manually dispatch the collection's binding event (same as the one in the setter). If this doesn't work, look further upstream; in the service, delegate or controller. You'll find the short. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@... wrote: You have the right idea; to encapsulate the dataProvider, validation and change event handler. But, instead of putting them inside the control, wrap all of that into a common facilities model, that gets used anywhere it's needed in the application. I stopped using Cairngorm a long time ago, but hopefully the newest version supports dependency injection; so you can just inject a reference to the facilities model where needed, and hook it up to the combo box. That would be best practice. But, at the end of the day, the goal is to make it work, so... -TH --- In flexcoders@yahoogroups.com, hanzo55 shawn.a.holmes@ wrote: I very much appreciate the help! Any chance I can take to improve the design would be greatly beneficial, from a maintenance standpoint. My feeling originally was if I have two comboboxes that are in entirely different parts of the app, but that will always be populated by the same data provider, always have the same validation and always utilize the same change function (while being different from other comboboxes in the site), it made sense to encapsulate the dataprovider/validation/change events into the box itself so it could be added to a view without having to specify all of the various attributes a combobox needs--since they are not changing. Initially, it seemed a bit pointless to write: components:FacilityComboBox dataProvider={model.facilities} / everywhere I implemented the Facility ComboBox since everywhere the Facility ComboBox is implemented...the dataProvider is *going* to be model.facilities and will never change. If you think that there is a good example somewhere that demonstrates a better design for this type of class hierachy, please point me to it and I'll have a look. As the subject states, I'm very much looking for the best practice here. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Validation can be abstracted just like dataProviders. For a combo box, you only need to validate the selectedItem; from the view, presentation model, or a common utility class. Most other stuff happens in itemRenderers; that have a little more freedom. It may be that you're locked into a structure that was handed to you, but hardcoding a reference to a singleton model, from which you set the data provider of a combo box from within the combo box, breaks the rules. If you're having problems with binding the dataProvider to the model's property, the binding problem is probably upstream from the combo box. Good luck Shawn, just trying to help. -TH --- In flexcoders@yahoogroups.com, hanzo55 shawn.a.holmes@ wrote: There's more to the story in regards to the class design than what's provided here; The subclass is actually part of a larger set of classes that share common functionality in terms of their validation and change events based on the data-providers for a global app. That common functionality is centralized in their parent class. The dataProvider assignment in the constructor is tying those specific ComboBox subclasses to a family of service providers that produce an expected set of columns. Since those ComboBoxes, with their very specific validation and change routines (which are common to each other), apply very tightly to those service providers and no others, it made sense to subclass them and encapsulate dataProvider assignment, so those ComboBoxes could be used in any views that apply to that family of services. ...if that makes sense. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Can't see any good reason to subclass a control in order to hardcode the dataProvider. The idea is to keep the components loosely coupled. Are you having a problem with dataProvider={model.facilities}? -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Binding a visual component to a singleton limits its reuse. So
[flexcoders] Re: Best Practice for Subclassed UIComponent and DataProvider
Can't see any good reason to subclass a control in order to hardcode the dataProvider. The idea is to keep the components loosely coupled. Are you having a problem with dataProvider={model.facilities}? -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@... wrote: Binding a visual component to a singleton limits its reuse. So there may not really a best practice. The minimum code way is probably to assign the dataProvider in commitProperties instead of the constructor. The model.facilities might have its final assignment by then. On 8/25/11 9:41 AM, hanzo55 shawn.a.holmes@... wrote: I am working with a project already in place. It uses Cairngorm and is built on Flex 3.0.2.2113 A standard ComboBox is implemented in one of the views like so: mx:ComboBox dataProvider={model.facilities} id=Facility model is a bindable singleton, and one of its properties, facilities is a public ArrayCollection. On initialization, a function runs in the singleton to populate facilities; it does this by pointing model.facilities to another ArrayCollection that has been previously populated, such as: model.facilities = model.assigned_facilities; This works without issue; when the application starts, the ComboBox is properly populated with the values pointed to by model.facilities. I have decided! to come in and build a subclass of ComboBox in ActionScript, and rather than pass the dataProvider in, I want to include the singleton within the ActionScript, and simply do the same assignment in the constructor. The resulting MXML would look like this: components:FacilityComboBox id=Facility / and the constructor would look like this: public function FacilityComboBox() { super(); ! BindingUtils.bindProperty(this, dataProvider, model, facilities); } My question is: Is this the best practice when subclassing a UIComponent and wanting to handle the dataProvider assignment internally? The reason I ask is, I had originally built the constructor like this: public function FacilityComboBox() { super(); thi! s.dataProperty = model.facilities; } which worked for other subclassed ComboBoxes where the dataProvider *did not change after initialization*. However, because of how model.facilities is assigned (to an existing ArrayCollection), no change was ever detected, and upon launch the application, the ComboBox sat dormant and never received any values to populate. Changing to the BindingUtils method solved this problem, but I now fear I'm missing a much broader concept about dataProvider assignment in pure ActionScript classes. Is my BindingUtils methodology the one to go with? Or should I be considering something drastically different? -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Best Practice for Subclassed UIComponent and DataProvider
Validation can be abstracted just like dataProviders. For a combo box, you only need to validate the selectedItem; from the view, presentation model, or a common utility class. Most other stuff happens in itemRenderers; that have a little more freedom. It may be that you're locked into a structure that was handed to you, but hardcoding a reference to a singleton model, from which you set the data provider of a combo box from within the combo box, breaks the rules. If you're having problems with binding the dataProvider to the model's property, the binding problem is probably upstream from the combo box. Good luck Shawn, just trying to help. -TH --- In flexcoders@yahoogroups.com, hanzo55 shawn.a.holmes@... wrote: There's more to the story in regards to the class design than what's provided here; The subclass is actually part of a larger set of classes that share common functionality in terms of their validation and change events based on the data-providers for a global app. That common functionality is centralized in their parent class. The dataProvider assignment in the constructor is tying those specific ComboBox subclasses to a family of service providers that produce an expected set of columns. Since those ComboBoxes, with their very specific validation and change routines (which are common to each other), apply very tightly to those service providers and no others, it made sense to subclass them and encapsulate dataProvider assignment, so those ComboBoxes could be used in any views that apply to that family of services. ...if that makes sense. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Can't see any good reason to subclass a control in order to hardcode the dataProvider. The idea is to keep the components loosely coupled. Are you having a problem with dataProvider={model.facilities}? -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Binding a visual component to a singleton limits its reuse. So there may not really a best practice. The minimum code way is probably to assign the dataProvider in commitProperties instead of the constructor. The model.facilities might have its final assignment by then. On 8/25/11 9:41 AM, hanzo55 shawn.a.holmes@ wrote: I am working with a project already in place. It uses Cairngorm and is built on Flex 3.0.2.2113 A standard ComboBox is implemented in one of the views like so: mx:ComboBox dataProvider={model.facilities} id=Facility model is a bindable singleton, and one of its properties, facilities is a public ArrayCollection. On initialization, a function runs in the singleton to populate facilities; it does this by pointing model.facilities to another ArrayCollection that has been previously populated, such as: model.facilities = model.assigned_facilities; This works without issue; when the application starts, the ComboBox is properly populated with the values pointed to by model.facilities. I have decided! to come in and build a subclass of ComboBox in ActionScript, and rather than pass the dataProvider in, I want to include the singleton within the ActionScript, and simply do the same assignment in the constructor. The resulting MXML would look like this: components:FacilityComboBox id=Facility / and the constructor would look like this: public function FacilityComboBox() { super(); ! BindingUtils.bindProperty(this, dataProvider, model, facilities); } My question is: Is this the best practice when subclassing a UIComponent and wanting to handle the dataProvider assignment internally? The reason I ask is, I had originally built the constructor like this: public function FacilityComboBox() { super(); thi! s.dataProperty = model.facilities; } which worked for other subclassed ComboBoxes where the dataProvider *did not change after initialization*. However, because of how model.facilities is assigned (to an existing ArrayCollection), no change was ever detected, and upon launch the application, the ComboBox sat dormant and never received any values to populate. Changing to the BindingUtils method solved this problem, but I now fear I'm missing a much broader concept about dataProvider assignment in pure ActionScript classes. Is my BindingUtils methodology the one to go with? Or should I be considering something drastically different? -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: how to make a class can be iterated by for each/in
If you're using Flex 4.5, something like this works: var myClassObject:Object = new MyClass(); var classInfo:XML = describeType( myClassObject ); var propertyType:String; var propertyName:String; for each ( var property:XML in classInfo..accessor ) { propertyName = property.@name; propertyType = property.@type; } -TH --- In flexcoders@yahoogroups.com, Alex Harui aharui@... wrote: You can't directly loop over a class like you could in AS2. That's what describeType and ObjectUtil are for. You can probably loop over the properties returned from ObjectUtil.getClassInfo. On 8/11/11 3:23 AM, j2me_soul j2me_soul@... wrote: Sorry I think I express not very clear. I want to iterate all the properies in a class using for each/in. How can achieve that ? At 2011-08-11 17:52:34,Rishi Tandon rishitandon123@... wrote: for each works for collection. If you have an instance of the collections consist of your class object then u can retrieve each item as class object using for each iterator. Sent from my iPhone On Aug 11, 2011, at 2:25 PM, j2me_soul j2me_soul@... wrote: How to custom a class can by iterate all children by for each for each( var item:* in myCustomeClass ){ } -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Method for a Datagrid Button Itemrenderer
Hi Angelo, You're close. You'll need to declare the event in the DataGrid. A simple subclass should do the trick. This way you can add the event listener in mxml too: package myPackage { import mx.controls.DataGrid; [Event( name=myTest, type=flash.events.Event )] public class MyDataGrid extends DataGrid { } } -TH --- In flexcoders@yahoogroups.com, Angelo Anolin angelo_ano...@... wrote: I have written the following scripts, and yet this does not seem to work. in my MXML file (main) private function myDataGrid_CreationComplete() :void { myDataGrid.addEventListener('myTest', myTesting); } private function myTesting() :void { Alert.show('This event should have been called!'); } in my datagrid, i have declared creationComplete=myDataGrid_CreationComplete() In my itemrenderer, I have placed a code : override protected function clickHandler(event:MouseEvent) :void { dispatchEvent(new Event('myTest', true)); } For some reason, this does not seem to work. From what I have read mostly, this should be able to do the trick. Any input and ideas appreciated. Thanks.. From: Angelo Anolin angelo_ano...@... To: flexcoders@yahoogroups.com Sent: Tue, 17 August, 2010 8:34:07 Subject: Re: [flexcoders] Re: Method for a Datagrid Button Itemrenderer Hi Don, Thanks for the reply. I do am able to do the same using an in-line itemrenderer. But right now, my itemrenderer is an external AS file. So I declare my MXML like: mx:DataGridColumn id=dgActionColumn width=100 visible=true itemRenderer=myButtonItemRenderer / Where myButtonItemRenderer is an external AS file which extends the button. Now, where I declare the datagrid, I am writing a function which I need to wire up to the itemrenderer so that on the click of the button, that method is dispatched. Thanks. From: fusionpage fusionp...@... To: flexcoders@yahoogroups.com Sent: Tue, 17 August, 2010 8:29:11 Subject: [flexcoders] Re: Method for a Datagrid Button Itemrenderer I typically use code like this to call a method in the parent MXML page that contains the dataGrid... mx:AdvancedDataGridColumn width=80 headerText=Launch dataField=contentURL mx:itemRenderer mx:Component mx:Button label=Launch click=parentDocument.goDownload();/ /mx:Component /mx:itemRenderer /mx:AdvancedDataGridColumn Don --- In flexcoders@yahoogroups.com, Angelo Anolin angelo_anolin@ wrote: I know someone has encountered this before. Better to rephrase this one I guess. I have an MXML file, where I have a method. In that MXML file, I have a datagrid, where one of the columns, I created an external itemrenderer. The itemrenderer is a button. When I click that button, I want that button to call the method in the MXML file (so that I could re-use the button on other datagrids). Thanks. From: Angelo Anolin angelo_anolin@ To: flexcoders@yahoogroups.com Sent: Mon, 16 August, 2010 13:54:33 Subject: [flexcoders] Method for a Datagrid Button Itemrenderer Hi Flexcoders, I have a datagrid and an button itemrenderer named btnRenderer.as I have set this button as an itemRenderer in one of my datagrid columns. mx:DataGridColumn id=dgColCancel width=100 itemRenderer=btnRenderer / I need to respond to an click event on button, passing some of the value from the dataProvider attached to the datagrid. Should I place my codes on the mxml file where my datagrid is declared? How would the btnRenderer know that the method is called? Thanks.
[flexcoders] Re: Method for a Datagrid Button Itemrenderer
Not that I know of. You could avoid all of this by just listening for the DataGrid's itemClick event. (mx.events.ListEvent) In the result handler you could check if ( event.itemRenderer is btnRenderer ) { do your thing } -TH --- In flexcoders@yahoogroups.com, Angelo Anolin angelo_ano...@... wrote: Would it be possible to simply add it to the MXML file where I am declaring the datagrid, instead of subclassing it? Thanks. From: turbo_vb timh...@... To: flexcoders@yahoogroups.com Sent: Tue, 17 August, 2010 8:30:29 Subject: [flexcoders] Re: Method for a Datagrid Button Itemrenderer Hi Angelo, You're close. You'll need to declare the event in the DataGrid. A simple subclass should do the trick. This way you can add the event listener in mxml too: package myPackage { import mx.controls.DataGrid; [Event( name=myTest, type=flash.events.Event)] public class MyDataGrid extends DataGrid { } } -TH--- In flexcoders@yahoogroups.com, Angelo Anolin angelo_anolin@ wrote: I have written the following scripts, and yet this does not seem to work. in my MXML file (main) private function myDataGrid_CreationComplete() :void { myDataGrid.addEventListener('myTest', myTesting); } private function myTesting() :void { Alert.show('This event should have been called!'); } in my datagrid, i have declared creationComplete=myDataGrid_CreationComplete() In my itemrenderer, I have placed a code : override protected function clickHandler(event:MouseEvent) :void { dispatchEvent(new Event('myTest', true)); } For some reason, this does not seem to work. From what I have read mostly, this should be able to do the trick. Any input and ideas appreciated. Thanks.. From: Angelo Anolin angelo_anolin@ To: flexcoders@yahoogroups.com Sent: Tue, 17 August, 2010 8:34:07 Subject: Re: [flexcoders] Re: Method for a Datagrid Button Itemrenderer Hi Don, Thanks for the reply. I do am able to do the same using an in-line itemrenderer. But right now, my itemrenderer is an external AS file. So I declare my MXML like: mx:DataGridColumn id=dgActionColumn width=100 visible=true itemRenderer=myButtonItemRenderer / Where myButtonItemRenderer is an external AS file which extends the button. Now, where I declare the datagrid, I am writing a function which I need to wire up to the itemrenderer so that on the click of the button, that method is dispatched. Thanks. From: fusionpage fusionpage@ To: flexcoders@yahoogroups.com Sent: Tue, 17 August, 2010 8:29:11 Subject: [flexcoders] Re: Method for a Datagrid Button Itemrenderer I typically use code like this to call a method in the parent MXML page that contains the dataGrid... mx:AdvancedDataGridColumn width=80 headerText=Launch dataField=contentURL mx:itemRenderer mx:Component mx:Button label=Launch click=parentDocument.goDownload();/ /mx:Component /mx:itemRenderer /mx:AdvancedDataGridColumn Don --- In flexcoders@yahoogroups.com, Angelo Anolin angelo_anolin@ wrote: I know someone has encountered this before. Better to rephrase this one I guess. I have an MXML file, where I have a method. In that MXML file, I have a datagrid, where one of the columns, I created an external itemrenderer. The itemrenderer is a button. When I click that button, I want that button to call the method in the MXML file (so that I could re-use the button on other datagrids). Thanks. From: Angelo Anolin angelo_anolin@ To: flexcoders@yahoogroups.com Sent: Mon, 16 August, 2010 13:54:33 Subject: [flexcoders] Method for a Datagrid Button Itemrenderer Hi Flexcoders, I have a datagrid and an button itemrenderer named btnRenderer.as I have set this button as an itemRenderer in one of my datagrid columns. mx:DataGridColumn id=dgColCancel width=100 itemRenderer=btnRenderer / I need to respond to an click event on button, passing some of the value from the dataProvider attached to the datagrid. Should I place my codes on the mxml file where my datagrid is declared? How would the btnRenderer know that the method is called? Thanks.
[flexcoders] Re: Flex 4 data management - how do I approach this?
Hi Henrik, So you're getting back a collection of products from the service and binding them to the DataGrid. Let's assume that the product objects are Product Value Objects. You have every thing that you need for an order except for the quantity of the product(s) to order. Keep it simple, add a Transient field to the Product VO and use that for the quantity column in the same DataGrid. [Transient] /** * The product quantity to order */ public var productQuantity:int = 0; The itemEditor in the DataGrid can then just update the quantity property directly in the Product VO. The next step is to take the Product(s) that have a quantity and submit them to become an order. Usually the user can select multiple products for an order, so I'll go that route. After the user has entered all of the product quantities to order, the Products in the ArrayCollection are ready to be processed into an order. The user clicks a submit button; or you do this when the individual quantities change. For each (or one) Product in the ArrayCollection that has a quantity 0, create an OrderDetail VO from the necessary Product properties; including productQuantity. You might prefer OrderContent VO since that's the table that you're updating on the server. Add the OrderDetail VOs to an ArrayCollection and send the collection to the service; to process and create an order. Or, you can send a single VO; if that fits your needs better. The php service can create the order and then add the details to the order from the submitted collection of or single OrderDetail DTO. That's a simple round trip. Good luck. -TH --- In flexcoders@yahoogroups.com, henrik.hedberg hen...@... wrote: Thanks for the reply, this is what I did to get it to work so far: I created a value object class to hold exactly the data I wanted for each row in the datagrid. When the php service returned the data I looped throught it and transfered what I needed to instances of my VO and then added those to a new array collection. That array collection I then bound as a dataprovider for my datagrid. I put in an inline item renderer for the amount with a numeric stepper. The next step will then be to take the correct data from that array collection (item id and item amount) and transfer it to a php service that will save it in the order-table of the database. Since the grid and the ac are bound, I do not need to fire an event on focus out, I already have the data in the ac. I wonder how that solution might have worked when the user changes her mind and alters the amount many times on the products(?) --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: First off, adding this one column datagrid and getting it to line up correctly must be a pain. I wouldn't do that. Just add another column to the datagrid for the quantity. You can add as many columns to the datagrid as you want - they do not have to match the dataprovider. I would design my item editor with a textfield with a focus out event listener. When the event fires, grab the ID, amount and price and populate a value object. Add this object to a custom event and dispatch it. At the same level of the datagrid (Or wherever), have an event listener for the custom event. When you get it, add the value object to an orders array collection. If the user commits to buy, send this array collection to the server to populate the orders database. You can return the order number and save it in a shared object if you want. --- In flexcoders@yahoogroups.com, henrik.hedberg henrik@ wrote: Hi guys, quite an explanation here, hope someone has the patience to read it through I'm building an application in Flex 4 that handles an ordering system. I have a small mySql database and I've written a few services in php to handle the database. Basically the logic goes like this: I have tables for customers, products, productGroups, orders, and orderContent I have no problem with the CRUD management of the products, orders and customers, it is the order submission that the customer will fill in that is giving me headaches: What I want is to display the products in dataGrids, ordered by group, which will be populated with Flex datamanagement via the php-services, and that per se is no problem. But I also want an extra column in the datagrid that the user can fill in with the amount he wishes to order of that product. This column would in theory then bind to the db table orderContent via the php services. The problem is that you would need to create a new order in the database first that the data could bind to (orderContent is linked to an order in the db). I do not want to create a new order every time a user enters the page to look at the products, rather I would like to create the order when a button is pressed and then take everything from the datagrids on the page and
[flexcoders] Re: Could not resolve * to a component implementation.
The point is that creating 2 files in the same folder, with the same case-sensitive name, is ambiguous. When you import one of the files into a component, how do you suppose that the compiler would know which one to use? It doesn't matter if its a file or class or interface or whatever. The compiler can't read your mind; yet :) Your approach of abstracting the view script code out of the view is a good idea; especially for unit tests. Just use a different name and you'll be fine. -TH --- In flexcoders@yahoogroups.com, Brian J. Ackermann brian.ackerm...@... wrote: So, its a class, even thought it doesn't declare a class inside the text? -- Brian J. Ackermann brian.ackerm...@... 952.373.1626 -- On Thu, Jul 1, 2010 at 10:21 PM, turbo_vb timh...@... wrote: Glad that you were able to resolve the problem. The AS file IS a class, and if it lives in the same package as the mxml component, the compiler will balk; because it doesn't know which one to import elsewhere. Adobe best practice would have you use Uppercase for the first letter of all classes. Renaming the script class to something like FooScript.as or FooModel.as might be a better way to go. Cheers, -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Brian J. Ackermann brian.ackermann@ wrote: Here's what the problem was. I had originally had a file called Foo.mxml which contained a lot of ActionScript Code. I decided to create a new ActionScript FILE to contain that script code. I named the file Foo.as, to indicate the correlation with the mxml file. Renaming this new as file to foo.as (lowercase f), resolves the issue. I'm not at all sure why this would have caused a conflict with the compiler, since it wasn't a classbut at least I've resolved the issue. On Thu, Jul 1, 2010 at 7:57 AM, valdhor valdhorlists@ wrote: One other thing to check. Make sure you are not using a reserved name for your component. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, turbo_vb TimHoff@ wrote: A couple things that you can check that might help: • Make sure that you have an import statement for the component in the parent class. • If your component is an AS class, make sure that the package, at the top of the class, is correct. • If your component is an AS component make sure that the class name, within the component, is correct. If you are using a constructor check that too. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Brian J. Ackermann brian.ackermann@ wrote: Hi, I'm a wee bit stuck on this, and was hoping you might have some input to help me. I'm getting the Could not resolve * to a component implementation. error message. However, everything I've read about this via Google hasn't helped my case in the slightest. I presume I'm just missing something obvious, but maybe its something more serious. So, to solve this problem, I've tried two things, and both work, as far as they take me. First, I added a new component, of the exact same variety, and then copied the contents of the erroring component into it. I replace the viewstack 'page' with the new component (which as near as I can tell is IDENTICAL, but with a different name), and the compiler error goes away. I can also solve this by simply renaming the original component letting FB4 refactor for me. The error goes away again. But if I then re-rename back to the original name, I get the compiler error again. I've tried to clean the project several times, and that doesn't help. I'd really like to understand what I've done wrong here. What am I missing? Thanks much!
[flexcoders] Re: Button with tooltip but no overskin
Probably no more elegant, but an alternative: package { import mx.controls.Button; import mx.core.mx_internal; use namespace mx_internal; public class DeadButton extends Button { public function DeadButton() { super(); mx_internal::overSkinName = upSkin; } } } -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: I should have noted that this is for Flex 3. I created a subclass of ButtonSkin which overrides name() to return upSkin. If anyone has a more elegant solution please let me know. On Thu, Jul 22, 2010 at 12:35 PM, Richard Rodseth rrods...@... wrote: Is there a simple way to set up a button so that it's appearance doesn't change on rollOver, but the tooltip does appear? I am simulating a menu bar of sorts using a horizontal layout of PopUpButtons and Buttons. The Buttons are just filler that need to follow the style of the others, but have no associated action. But some have meaningful labels and tooltips. In other words, I need to create a dead button with the same style as others, and a tooltip.
[flexcoders] Re: Mate: listener injector vs manager/PM binding
I usually use (b). For the error, you can call a public method in the PM from the faultHandler in the map; as one alternative. --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: Design question for any other Mate users out there. Will cross-post to Mate forum. I use Mate with the Manager + Presentation Model pattern. i.e. presentation model dispatches bubbling events. Mate event map invokes services calls, sets result on manager. Properties are injected from manager to presentation model. I find it very convenient to have a data status property in the presentation model for each service call, with values NOT_CURRENT, LOADING, LOADED and ERROR. Then the view can display appropriate status and progress indicators based on this property. One approach (a) is to have the event map set the status on the manager and have the map inject that status into the presentation model. Another (b) is to set the status in the presentation model just before dispatching the event, and when receiving the result (i.e. in a custom setter). I like the directness of (b), but it doesn't cover the error case unless the manager also has something like a faultevent property that also gets injected into the presentation model. A third approach (c) would use listener injectors. The map would inject a listener into the presentation model and would announce a special failure event. Thoughts?
[flexcoders] Re: Mate: listener injector vs manager/PM binding
I agree, but it can; since the map knows about the PM anyway. This is where Swiz has an advantage with the Mediate metadata. In that case the PM method can just listens for an event; which can be dispatched on fault. -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: The map shouldn't interact with the PM (other than building it with ObjectBuilder and injecting it into the view). I'm leaning towards a). That way it's centralized and manager properties can potentially be injected into multiple presentation models. On Fri, Jul 2, 2010 at 1:56 PM, turbo_vb timh...@... wrote: I usually use (b). For the error, you can call a public method in the PM from the faultHandler in the map; as one alternative. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrodseth@ wrote: Design question for any other Mate users out there. Will cross-post to Mate forum. I use Mate with the Manager + Presentation Model pattern. i.e. presentation model dispatches bubbling events. Mate event map invokes services calls, sets result on manager. Properties are injected from manager to presentation model. I find it very convenient to have a data status property in the presentation model for each service call, with values NOT_CURRENT, LOADING, LOADED and ERROR. Then the view can display appropriate status and progress indicators based on this property. One approach (a) is to have the event map set the status on the manager and have the map inject that status into the presentation model. Another (b) is to set the status in the presentation model just before dispatching the event, and when receiving the result (i.e. in a custom setter). I like the directness of (b), but it doesn't cover the error case unless the manager also has something like a faultevent property that also gets injected into the presentation model. A third approach (c) would use listener injectors. The map would inject a listener into the presentation model and would announce a special failure event. Thoughts?
[flexcoders] Re: Mate: listener injector vs manager/PM binding
Another alternative would be to extend ArrayCollection, or whatever collection type desired, with a status property. -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: The map shouldn't interact with the PM (other than building it with ObjectBuilder and injecting it into the view). I'm leaning towards a). That way it's centralized and manager properties can potentially be injected into multiple presentation models. On Fri, Jul 2, 2010 at 1:56 PM, turbo_vb timh...@... wrote: I usually use (b). For the error, you can call a public method in the PM from the faultHandler in the map; as one alternative. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrodseth@ wrote: Design question for any other Mate users out there. Will cross-post to Mate forum. I use Mate with the Manager + Presentation Model pattern. i.e. presentation model dispatches bubbling events. Mate event map invokes services calls, sets result on manager. Properties are injected from manager to presentation model. I find it very convenient to have a data status property in the presentation model for each service call, with values NOT_CURRENT, LOADING, LOADED and ERROR. Then the view can display appropriate status and progress indicators based on this property. One approach (a) is to have the event map set the status on the manager and have the map inject that status into the presentation model. Another (b) is to set the status in the presentation model just before dispatching the event, and when receiving the result (i.e. in a custom setter). I like the directness of (b), but it doesn't cover the error case unless the manager also has something like a faultevent property that also gets injected into the presentation model. A third approach (c) would use listener injectors. The map would inject a listener into the presentation model and would announce a special failure event. Thoughts?
[flexcoders] Re: Mate: listener injector vs manager/PM binding
Yeah, the cool thing about Swiz, is that this would only add 2 lines of code. :-) -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: Haven't looked at Swiz yet, but as I mentioned, I can certainly announce an event in the faultHandler and inject a listener for it in the PM. On Fri, Jul 2, 2010 at 3:36 PM, turbo_vb timh...@... wrote: I agree, but it can; since the map knows about the PM anyway. This is where Swiz has an advantage with the Mediate metadata. In that case the PM method can just listens for an event; which can be dispatched on fault. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrodseth@ wrote: The map shouldn't interact with the PM (other than building it with ObjectBuilder and injecting it into the view). I'm leaning towards a). That way it's centralized and manager properties can potentially be injected into multiple presentation models. On Fri, Jul 2, 2010 at 1:56 PM, turbo_vb TimHoff@ wrote: I usually use (b). For the error, you can call a public method in the PM from the faultHandler in the map; as one alternative. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Richard Rodseth rrodseth@ wrote: Design question for any other Mate users out there. Will cross-post to Mate forum. I use Mate with the Manager + Presentation Model pattern. i.e. presentation model dispatches bubbling events. Mate event map invokes services calls, sets result on manager. Properties are injected from manager to presentation model. I find it very convenient to have a data status property in the presentation model for each service call, with values NOT_CURRENT, LOADING, LOADED and ERROR. Then the view can display appropriate status and progress indicators based on this property. One approach (a) is to have the event map set the status on the manager and have the map inject that status into the presentation model. Another (b) is to set the status in the presentation model just before dispatching the event, and when receiving the result (i.e. in a custom setter). I like the directness of (b), but it doesn't cover the error case unless the manager also has something like a faultevent property that also gets injected into the presentation model. A third approach (c) would use listener injectors. The map would inject a listener into the presentation model and would announce a special failure event. Thoughts?
[flexcoders] Re: Could not resolve * to a component implementation.
Glad that you were able to resolve the problem. The AS file IS a class, and if it lives in the same package as the mxml component, the compiler will balk; because it doesn't know which one to import elsewhere. Adobe best practice would have you use Uppercase for the first letter of all classes. Renaming the script class to something like FooScript.as or FooModel.as might be a better way to go. Cheers, -TH --- In flexcoders@yahoogroups.com, Brian J. Ackermann brian.ackerm...@... wrote: Here's what the problem was. I had originally had a file called Foo.mxml which contained a lot of ActionScript Code. I decided to create a new ActionScript FILE to contain that script code. I named the file Foo.as, to indicate the correlation with the mxml file. Renaming this new as file to foo.as (lowercase f), resolves the issue. I'm not at all sure why this would have caused a conflict with the compiler, since it wasn't a classbut at least I've resolved the issue. On Thu, Jul 1, 2010 at 7:57 AM, valdhor valdhorli...@... wrote: One other thing to check. Make sure you are not using a reserved name for your component. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, turbo_vb TimHoff@ wrote: A couple things that you can check that might help: • Make sure that you have an import statement for the component in the parent class. • If your component is an AS class, make sure that the package, at the top of the class, is correct. • If your component is an AS component make sure that the class name, within the component, is correct. If you are using a constructor check that too. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Brian J. Ackermann brian.ackermann@ wrote: Hi, I'm a wee bit stuck on this, and was hoping you might have some input to help me. I'm getting the Could not resolve * to a component implementation. error message. However, everything I've read about this via Google hasn't helped my case in the slightest. I presume I'm just missing something obvious, but maybe its something more serious. So, to solve this problem, I've tried two things, and both work, as far as they take me. First, I added a new component, of the exact same variety, and then copied the contents of the erroring component into it. I replace the viewstack 'page' with the new component (which as near as I can tell is IDENTICAL, but with a different name), and the compiler error goes away. I can also solve this by simply renaming the original component letting FB4 refactor for me. The error goes away again. But if I then re-rename back to the original name, I get the compiler error again. I've tried to clean the project several times, and that doesn't help. I'd really like to understand what I've done wrong here. What am I missing? Thanks much!
[flexcoders] Re: Could not resolve * to a component implementation.
A couple things that you can check that might help: • Make sure that you have an import statement for the component in the parent class. • If your component is an AS class, make sure that the package, at the top of the class, is correct. • If your component is an AS component make sure that the class name, within the component, is correct. If you are using a constructor check that too. -TH --- In flexcoders@yahoogroups.com, Brian J. Ackermann brian.ackerm...@... wrote: Hi, I'm a wee bit stuck on this, and was hoping you might have some input to help me. I'm getting the Could not resolve * to a component implementation. error message. However, everything I've read about this via Google hasn't helped my case in the slightest. I presume I'm just missing something obvious, but maybe its something more serious. So, to solve this problem, I've tried two things, and both work, as far as they take me. First, I added a new component, of the exact same variety, and then copied the contents of the erroring component into it. I replace the viewstack 'page' with the new component (which as near as I can tell is IDENTICAL, but with a different name), and the compiler error goes away. I can also solve this by simply renaming the original component letting FB4 refactor for me. The error goes away again. But if I then re-rename back to the original name, I get the compiler error again. I've tried to clean the project several times, and that doesn't help. I'd really like to understand what I've done wrong here. What am I missing? Thanks much!
[flexcoders] Re: Pass two arraycollections to one component
Have you tried just one instance of the component? components:ApplData beginners={beginners} transfers={transfers}/ -TH --- In flexcoders@yahoogroups.com, Liam ldnew...@... wrote: I need to pass two separate arraycollections to one component. I'm sure this is possible but I can't find anything online as to how to do this. I thought I could do this but it only displays the last arraycollection: From main application: components:ApplData beginners={beginners}/ components:ApplData transfers={transfers}/ With such little information, any suggestions? Can I do this? Thanks, Liam
[flexcoders] Re: Yes/No RadioButton
Well. it's pretty clear that the answer can only be yes or no in this case, so use a RadioButtonGroup for the two RadioButtons. -TH --- In flexcoders@yahoogroups.com, jossminker jossmin...@... wrote: Can you clarify? Do you mean you ahve two radio buttons one for no and one for yes? In which case the mode of operation the user would expect is to deselect YES by selecting NO instead. If it is a button which if selected denotes yes and if not selected denotes No then you should be using checkboxes instead. However, if you wish it to be possible for the user to deselect Yes and thus leave neither control selected you can either- change your interface to use a 3rd option NEITHER or you use the YES buttons click event handler to switch teh buttons selected property. This will however, leave the user with IMO a potentially confusing interface. hth joss --- In flexcoders@yahoogroups.com, Christophe christophe_jacquelin@ wrote: Hello, I have two radio buttons: Yes and No. At the beginning they are unchecked. Then I press on Yes to select Yes. How to desactivate Yes, if we click a second successive time on Yes. Thank you, Christophe,
[flexcoders] Re: dispatchEvent import
Actually, you weren't wrong. It seems that if you use [Bindable], the compiler will allow dispatchEvent() in any class; in a black-box manner. -TH --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: Ooops, my bad. I didn't look at the example extensively and didn't note which component he was trying to use. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Hey Steve, The component that Marco is referring to is not a UIComponent, so it doesn't have a dispatchEvent() method. He'll have to change thel class to extend EventDispatcher. -TH --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: The component itself has a dispatchEvent method. The this keyword is implicit in the call. It could have been written as this.dispatchEvent. --- In flexcoders@yahoogroups.com, Marco Catunda marco.catunda@ wrote: Hi, I'm learning swiz framework and stumble upon this code http://www.pastebin.org/307313 at http://www.briankotek.com/blog/files/swiz_10_rc_example/srcview/index.html My question is how could flex compiler understand the 'dispatchEvent' method in line 41 and 65? I haven't seen any explicit import of it. Cheers -- Marco Catunda
[flexcoders] Re: dispatchEvent import
Hi Marco, That does look like a problem. The dispatchEvent() method is available for any UIComponent subclass or any class that extends EventDispatcher. So, if you're going to use [Bindable] properties in the presentation model, you would want to have the PM extend EventDispatcher: import flash.events.EventDispatcher; public class UserPresentationModel extends EventDispatcher { private var _currentState : String; [Bindable( currentStateChanged )] public function get currentState() : String { return _currentState; } public function set currentState( state : String ) : void { _currentState = state; dispatchEvent( new Event( currentStateChanged ) ); } } This will allow you to bind the property to a view. For events that you want to [Mediate], you would use the injected dispatcher: [Dispatcher] public var dispatcher:IEventDispatcher; dispatcher.dispatchEvent( new Event( myEvent ) ); -TH --- In flexcoders@yahoogroups.com, Marco Catunda marco.catu...@... wrote: Hi, I'm learning swiz framework and stumble upon this code http://www.pastebin.org/307313 at http://www.briankotek.com/blog/files/swiz_10_rc_example/srcview/index.ht\ ml My question is how could flex compiler understand the 'dispatchEvent' method in line 41 and 65? I haven't seen any explicit import of it. Cheers -- Marco Catunda
[flexcoders] Re: dispatchEvent import
Hey Steve, The component that Marco is referring to is not a UIComponent, so it doesn't have a dispatchEvent() method. He'll have to change thel class to extend EventDispatcher. -TH --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: The component itself has a dispatchEvent method. The this keyword is implicit in the call. It could have been written as this.dispatchEvent. --- In flexcoders@yahoogroups.com, Marco Catunda marco.catunda@ wrote: Hi, I'm learning swiz framework and stumble upon this code http://www.pastebin.org/307313 at http://www.briankotek.com/blog/files/swiz_10_rc_example/srcview/index.html My question is how could flex compiler understand the 'dispatchEvent' method in line 41 and 65? I haven't seen any explicit import of it. Cheers -- Marco Catunda
[flexcoders] Re: dispatchEvent import
The example does compile and the binding works; even when you remove the injected dispatcher. Kind of stumped on why this works in a class that doesn't extend EventDispatcher. -TH --- In flexcoders@yahoogroups.com, Oleg Sivokon olegsivo...@... wrote: If it ever worked that may be because of the patched compiler / preprocessor, and so all dispatchEvent calls were translated to what is marked as [Dispatcher]. Maybe it does the same as [Bindable] on class, or maybe like HaXe using directive. Otherwise - just a confusing piece of code... Well, you know, so far the only reasonable place to put metadata in AS3 was __go_to_definitionHelp, and that you don't have to write... :S
[flexcoders] Re: Setting UI components in a composite component to private?
Hi Nick, The best option is to create your composite components in Action Script. This gives you direct control over the scope of the children, and they can be referenced within the component by the name of the var. For MXML composite components, if you don't give the children id's, they won't be public. This can be tricky if you're used to referencing the children inside the component by their id's, but you can usually rework logic like that to rely on events, like click and change, instead of references; since events have a reference to the target or currentTarget. -TH --- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote: Hi, When we create a composite component, such as an itemRenderer, based on an HBox and there's a button and TextInput inside, those sub-components are public, is there a way to specify they're private? Thanks, Nick -- Sent by Nick Middleweek ( { email: n...@..., blog: http://blog.middleweek.co.uk } );
[flexcoders] Re: TabNavigator
You try itemClick? -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: Is there an event dispatched by TabNavigator when the *user* switches tabs? change is dispatched when the selected change happens programmatically (eg. because selectedChild is bound).
[flexcoders] Re: TabNavigator
Strike that first response; no itemClick event there. But, the protected var tabBar does dispatch itemClick, so... -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: Is there an event dispatched by TabNavigator when the *user* switches tabs? change is dispatched when the selected change happens programmatically (eg. because selectedChild is bound).
[flexcoders] Re: TabNavigator
Yeah, see the last post. You could extend TabNavigator and bubble up the tabBar itemClick event. Not too difficult, but not out of the box. -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: You might mean click, in which case yes. It is dispatched when clicking with the content area of the navigator, but not on the button bar. And it wouldn't cover keyboard navigation. On Fri, May 21, 2010 at 1:06 PM, turbo_vb timh...@... wrote: You try itemClick? -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrodseth@ wrote: Is there an event dispatched by TabNavigator when the *user* switches tabs? change is dispatched when the selected change happens programmatically (eg. because selectedChild is bound).
[flexcoders] Re: Deleting row datagrid | Itemrenderer shows incorrect data
http://blogs.adobe.com/aharui/item_renderers/ http://blogs.adobe.com/aharui/item_renderers/ -TH --- In flexcoders@yahoogroups.com, ilikeflex ilikef...@... wrote: Hi You are right that renderer is being recycled. If you have notice that i am using inline custom item renderer. Secondly, i do hot have property in the dataprovider which is attached to checkbox. So how can i stop itemrenderer to be recycled. Thanks ilikeflex --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Your CheckBox itemRenderer is getting recycled after the delete. Use a custom itemRenderer for the CheckBox. http://blogs.adobe.com/aharui/item_renderers/ http://blogs.adobe.com/aharui/item_renderers/ -TH --- In flexcoders@yahoogroups.com, ilikeflex ilikeflex@ wrote: Hi I want to remove the row of datagrid. In one of the columns i have checkbox as item renderer.I select checkbox and i delete the row.But the challenge, i am facing is that when i remove the row from datagrid, the next row's checkbox becomes selected which i do not want. How can i avoid this?? Please see the test case below. Any pointers are highly appreciated. Thanks ilikeflex I have a sample test case ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.controls.DataGrid; import mx.collections.XMLListCollection; private var xml:XML=root itemstring one/item itemstring two/item itemstring three/item itemstring four/item itemstring five/item itemstring six/item /root; [Bindable] private var xc:XMLListCollection=new XMLListCollection(xml..item); public function deleteItem(event:MouseEvent):void { xc.removeItemAt(dg.selectedIndex); xc.refresh(); } ]] /mx:Script mx:DataGrid id=dg dataProvider={xc} mx:columns mx:DataGridColumn headerText=String Text dataField=item mx:itemRenderer mx:Component mx:Text text={data}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn headerText=Delete Item mx:itemRenderer mx:Component mx:CheckBox label=Delete click=outerDocument.deleteItem(event)/ /mx:Component /mx:itemRenderer /mx:DataGridColumn /mx:columns /mx:DataGrid /mx:Application
[flexcoders] QTP Automation and Custom Flex CheckBox itemRenderer
Using QTP 10 and SDK 3.5 and having a tough time figuring out how to record and play back the click event of a extended CheckBox itemRenderer in an extended DataGrid component. I've tried different combinations of custom automation delegates and class definitions file properties, for the itemRenderer and the DataGrid, but haven't found a solution yet. Other custom components have been instrumented successfully, but no love for the itemRenderers. Anyone else run into this problem? Thanks ahead, -TH
[flexcoders] Re: Deleting row datagrid | Itemrenderer shows incorrect data
Your CheckBox itemRenderer is getting recycled after the delete. Use a custom itemRenderer for the CheckBox. http://blogs.adobe.com/aharui/item_renderers/ http://blogs.adobe.com/aharui/item_renderers/ -TH --- In flexcoders@yahoogroups.com, ilikeflex ilikef...@... wrote: Hi I want to remove the row of datagrid. In one of the columns i have checkbox as item renderer.I select checkbox and i delete the row.But the challenge, i am facing is that when i remove the row from datagrid, the next row's checkbox becomes selected which i do not want. How can i avoid this?? Please see the test case below. Any pointers are highly appreciated. Thanks ilikeflex I have a sample test case ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.controls.DataGrid; import mx.collections.XMLListCollection; private var xml:XML=root itemstring one/item itemstring two/item itemstring three/item itemstring four/item itemstring five/item itemstring six/item /root; [Bindable] private var xc:XMLListCollection=new XMLListCollection(xml..item); public function deleteItem(event:MouseEvent):void { xc.removeItemAt(dg.selectedIndex); xc.refresh(); } ]] /mx:Script mx:DataGrid id=dg dataProvider={xc} mx:columns mx:DataGridColumn headerText=String Text dataField=item mx:itemRenderer mx:Component mx:Text text={data}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn headerText=Delete Item mx:itemRenderer mx:Component mx:CheckBox label=Delete click=outerDocument.deleteItem(event)/ /mx:Component /mx:itemRenderer /mx:DataGridColumn /mx:columns /mx:DataGrid /mx:Application
[flexcoders] Re: How to get rid space between lines?
Uh, verticalGap=-4. -TH --- In flexcoders@yahoogroups.com, markflex2007 markflex2...@... wrote: Hi, I use Flex builder 3. I have following simple code mx:VBox id=adInfo visible=false mx:Label text=line 1 / mx:Label text=line 2 / mx:Label text=line 3 / mx:Label text=line 4 / /mx:VBox but there are space between lines. I want to make the line close,How to get rid space between lines? Please help me. Thanks Mark
[flexcoders] Re: Thoughts on Flash by Steve Jobs
I thought that this response showed the kind of class that we've come to expect from Adobe. http://blogs.adobe.com/conversations/2010/04/moving_forward.html http://blogs.adobe.com/conversations/2010/04/moving_forward.html -TH --- In flexcoders@yahoogroups.com, Oleg Sivokon olegsivo...@... wrote: I've got this same link from my friend, and it's funny how it serves the facts... well, flash was in fact the first to use h.264 codec for video on the web (could be that some other existed before, but the HTML5 wasn't the first, that's for sure), and it does use hardware rendering to display that on Windows. It is true it uses pure CPU rendering on Macs and both sides blame it on poor cooperation of the other side. I think, maybe one valid point that he makes is that Adobe didn't invest to much into mobile market until very recently... and, to be honest, flash rendering may be more optimized... like using platform available graphics tools - be it DirectX or OpenGL. It is also true that flash is kind of stuck in it's development... well, the language hadn't seen any significant change in years... But I don't think that what Apple cares about is how flash performs... not is it at all familiar with the situation around the product... For example I have Adobe tools to develop for flash on my Windows installation, but on Linux I have only non-Adobe tools, which is more by accident, but, anyway, this kind of contradicts what he says about non openess of the platform. I also think that the main profit from banning other popular development tools like .NET and Java from Macs Apple may hope for good revenues from selling their development tools... Think about that due to iProducts popularity the popularity of Obj-C grew a lot. It was a marginal language in terms of penetration until iPhone... So, they may hope to build a community of developers, who would develop in this language and thus became dependent on Apple's tools and the entire ecosystem... well, just like there's a lot of C# programmers in the world, not because it's the best language ever, but because of the demand. I think that Mac world sees the surrounding world from the entrenchment level, it's like after all those years! they are going to win one marketing war. They won't think about that their victory may turn into much larger loss on a general scale. Like, what good will come out of promoting obsolete technologies like HTML and JavaScript? And that's after it's been proven many times that the disadvantages are inherent to the technology and it is probably seeing it's last years... Well, for me going back to making web apps in HTML and JavaScript would be like dark ages comparing to any technology, not necessarily Flash, that offers compiled language and better integration with the native API... There may be to many marketing factors involved, of which I have little knowledge... and this may sound out of place... but, what would be if Abobe have cooperated with projects like HaXe and GNash? Or, offer to download the SWFTools' AS3 compiler along with Flex / Flash Builder? Or, at least bring their existence to the public attention somehow. What I'm saying is, this will not be a turning point in this pure battle of commercial interests, but, maybe it's a good time to put the plans of world domination aside and invest a bit more in the technical aspect of things?
[flexcoders] Re: How to find the Value of a Property in the Last Object of An Array Collectio
If you keep the id's in sync with the index values of the ArrayCollection you can just use: linksFullAC.addItem({linkid:linksFullAC.length, label:userenteredlabel.text}); -TH --- In flexcoders@yahoogroups.com, James garymoorcroft_...@... wrote: I want to allow my users to add their own values to my array collection 'linksFullAC' using the following code which gets fired when they click a button:- linksFullAC.addItem({linkid:?, label:userenteredlabel.text}) Except I want the link id value to autoincrement so that each time they add an item it is the value of the highest linkid in the array collection +1. For example if the highest linkid in the array collection is 53 and the user clicks this button the new link would be assigned a value of 54 for the linkid. Can anyone please help me out on the code I'd use to do this?
[flexcoders] Re: Useless error from Adobe. Any hints?
You can use reflexUtil to do what Alex describes: http://code.google.com/p/reflexutil/ -TH --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: If AppHolder is height = 0, then the rect might draw from y=0 to y=-2 or something like that. I use FDB for my debugging so I can always examine objects on the stack and see which one it is and what its properties are. I'm not sure how to do that with the debugger in FlexBuilder. On 4/19/10 10:59 AM, Wally Kolcz wko...@... wrote: AppHolder is the id of a s:Group that is set to 100% / 100%. What constaints? I only have it set to be 2 pixels from the bottom and 5 pixels from the left. On 4/19/2010 1:42 PM, Alex Harui wrote: What is appHolder? If it gets layed out too small, the constraints you set might force a negative height. On 4/19/10 10:17 AM, Wally Kolcz wko...@... mailto:wkolcz%40isavepets.com wrote: Here is the bugger. Ok, now I know what the issue is, no idea which parameter is invalid and how to fix it. Guess I need to reread up on how to create a spark button in AS... var back_btn:spark.components.Button = new spark.components.Button() back_btn.label = Back; back_btn.addEventListener(MouseEvent.CLICK, backToNav); appHolder.addElement(back_btn); back_btn.setStyle(bottom, 2); back_btn.setStyle(left, 5) -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e6207 9f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Flex 4 State Names and Binding
Hi All, Unlike Flex 3, it seems that Flex 4 doesn't allow state names to be bound to constants anymore. An example that no longer works would be something like this: mx:State name={ MyNavigationConstants.STATE_OPEN }/ While I appreciate the improvements that have been made to Flex 4 states, this can be a problem for MVC oriented navigation frameworks. Just wondering what the rational was for making this change. Thanks, -TH
[flexcoders] Re: A Viewstack but not with Canvases
Hi Leonardo, ViewStack requires its children to be a Container, or subclass of Container. Box, HBox and VBox all extend Container and should work just fine. Besides, you're talking about adding a sibling to your current app. So, you could wrap the code for your current app into any Container; the children don't matter. -TH --- In flexcoders@yahoogroups.com, Leonardo Camargo camargoleona...@... wrote: Hi, I have a complex flex app I've been building for months, most of the containers are Boxes,VBoxes, HBoxes.. now I need to have two layers: my current app(1st layer), and a videodisplay that will take the whole space(2nd layer). That would be easily done(I assume) if both of my layers were Canvas and I used a Viewstack to switch between them. But apparently the Viewstack won't work properly with Boxes... Assuming you guys got my problem, any ideas? Best regards, Leonardo C.
[flexcoders] Re: Positioning / Scrolling problem with Flex popup
You'll want to create a method that does something like this: var target:Point = localToGlobal( new Point( hbox.x, hbox.y ) ); popup.move( target.x, target.y ); Call the method after you add the popup and when the container is scrolled. In some cases localToContent is more appropriate. -TH --- In flexcoders@yahoogroups.com, s_grollins s.groll...@... wrote: Hi all, I'm trying to work out a specific problem I'm having with positioning in Flex using the PopUpManager. Basically I'm wanting to create a popup which will scroll with the parent container - this is necessary because the parent container is large and if the user's browser window isn't large enough (this will be the case the majority of the time) - they will have to use the scrollbar of the container to scroll down. The problem is that the popup is positioned relative to another component, and it needs to stay by that component. (also sorry if the code below isn't formatted right, but I pasted it right from Eclipse). ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.core.UITextField; import mx.containers.TitleWindow; import mx.managers.PopUpManager; private function clickeroo(event:MouseEvent):void { var popup:TitleWindow = new TitleWindow(); popup.width = 250; popup.height = 300; popup.title = Example; var tf:UITextField = new UITextField(); tf.wordWrap = true; tf.width = popup.width - 30; tf.text = This window stays put and doesn't scroll when the hbox is scrolled (even with using the hbox as parent in the addPopUp method), I need the popup to be local to the HBox.; popup.addChild(tf); PopUpManager.addPopUp(popup, hbox, false); } ]] /mx:Script mx:HBox width=100% height=2000 id=hbox mx:Button label=Click Me click=clickeroo(event)/ /mx:HBox /mx:Application
[flexcoders] Re: Handling dataProvider of ComboBox on another navigatorContent
An easier approach than using these events, is to bind the ComboBox selectedIndex property to a variable like: [Bindable] public var myComboBoxSelectedIndex : int; that lives in the same class as the data array. When you get or initialize the array, set the variable to the desired value, and the binding will automatically display the correct item in the ComboBox. This way, you don't have to worry about timing. If the ComboBox exists, when the variable changes, the selectedItem will change then. If the ComboBox doesn't exists when you set the variable, when the ComboBox is instantiated the binding will kick in then. -TH --- In flexcoders@yahoogroups.com, Ivan ivan.ilija...@... wrote: I have TabNavigator component with two navigatorContent components. At the beginning I'm focused on first tab and on another tab I have combobox. ComboBox uses Array data provider that is populated with initialize event handler on Application component. When I click on first tab, I initialize event which goes on another tab and I want my combobox to show specific item from ComboBox. My problem is: In first attempt my combobox does not display desired option, but this thing happens only if I hadn't displayed second tab. If I click first on the second tab, then go back on first one and click on it to create desired event, everything works just fine. I tried to use creationPolicy on TabNavigator and NavigatorContent, but no use. Does anyone has any idea?
[flexcoders] Re: TextInput textAlign
Just use paddingTop. -TH --- In flexcoders@yahoogroups.com, chandruflex chandruf...@... wrote: I am using Flex 3. Is it possible to align the text in the TextInput control to be vertically centered?
[flexcoders] Re: Scale 9
Scale 9 has nothing to do with the position of the image. You would use the normal properties for that ( top, bottom, left, right ). What scale 9 defines is the portion of the image to stretch when the dimensions of the image are changed to be bigger than the original image size. So, if you look at the sample in your link, the blue rectangle in the very center is what will be stretched. The rest of the image ( the fancy corners ) will remain unchanged. -TH --- In flexcoders@yahoogroups.com, hgnowhg hgno...@... wrote: I'm very confused on using scale 9 to position images in flex. I am using this link: http://www.adobe.com/devnet/flex/quickstart/embedding_assets/#EmbeddingImagesScale9 They have a width of 266 and height of 55...I get where the 266 and 55 come into play in the embed code: scaleGridTop=55, scaleGridBottom=137, scaleGridLeft=57, scaleGridRight=266 But where do the 57 and 137 come from?
[flexcoders] Re: multicolor in single line chart
This might give you some ideas: http://www.timothyhoff.com/projects/LineRendererSample/LineRendererSampl\ e.html http://www.timothyhoff.com/projects/LineRendererSample/LineRendererSamp\ le.html -TH --- In flexcoders@yahoogroups.com, Krunal Panchal panchal_...@... wrote: Hi All, Is it possible to have multicolor in single line chart. Suppose i have line chart. there will be break point after that break point my line color will be different. Thanks in advance. Regards, Krunal Panchal | *panchal_...@...
[flexcoders] Re: ViewStack and CreationComplete...
Hey Laurence, When ViewStack children are instantiated the creationComplete event is dispatched, but not the show event. So, if you navigate to the second ViewStack child, the first time, you'll only get creationComplete. After that, when you navigate to the second child the show event will be dispatched; from the second child's top-level container. Usually, if you need to do something regardless if its the first, or subsequent, times that you navigate to a child, you have to listen for both events. -TH --- In flexcoders@yahoogroups.com, Laurence lmacne...@... wrote: I replaced creationComplete=init(); with show=init();, but it never seems to get called now... So I guess either the show event isn't getting thrown, or I'm not using it properly... Any suggestions? L. --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: As I understand it, yes. CreationComplete will only fire once (When the component is first created). From then on you will need to monitor the show event if you need to make changes based on when the component is displayed. --- In flexcoders@yahoogroups.com, Laurence LMacNeill@ wrote: I have not. show happens every time the child of the ViewStack shown, I assume? And no other times? Sounds like that might work. The first time you switch to that view, the CreationComplete event happens, of course. Does the Show event occur after CreationComplete is done, or before? I assume after, but I don't want to guess incorrectly. Thanks, L. --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Have you tried the show event? --- In flexcoders@yahoogroups.com, Laurence LMacNeill@ wrote: I've been using a ViewStack to switch between views in my app... The first time you jump to a particular view, that view runs throws its CreationComplete event, whereupon I have it running an init() function. The subsequent times you jump to that view, there is no CreationComplete event, obviously... So what I need is an event that happens every time you jump to that view in the ViewStack... So I can intialize the view properly on the 2nd, 3rd, 4th, etc, time you jump to that view... Any ideas? Thanks, Laurence MacNeill Mableton, Georgia, USA
[flexcoders] Re: Partial LineSeries - is it possible?
Hi Jeff, Probably going to have to add mock data for the remaining months in the decade and then use a lineSegmentRenderer and itemRenderer to hide the lines/points that are in the future. -TH --- In flexcoders@yahoogroups.com, Battershall, Jeff jeff.battersh...@... wrote: I have a line chart with a DateTimeAxis that is stipulated to be about 750 pixels wide and it's used to display a decade's worth of data points. However, in the current decade, there are only a couple month's worth of data points. As a result the line series takes up the entire chart's entire available horizontal space. What I'd LIKE to have happen is have the line series only as wide as the data points require - kind of like a YTD graph. See what I'm getting at? Any charting experts available? Eli? Jeff Battershall Application Architect Dow Jones Indexes jeff.battersh...@... (609) 520-5637 (p) (484) 477-9900 (c)
[flexcoders] Re: Twitter Feed Within An Air/Flex Application
Hi James, If your application automatically displays new tweets, those created after the initial load, than yes; that would be considered live. If however its just taking a snapshot, then no. A starting point would be to refresh the tweets. Having the ability to post tweets, and see them instantly show up, would also make it more live. Other ideas would be IM, chat, or other real-time activities that involve the course; like live test scoring, or something. -TH --- In flexcoders@yahoogroups.com, James garymoorcroft_...@... wrote: I've previously made an air application for my university course and my tutor has suggested that I incorporate more live data into it. One of the ways he suggested was to include a twitter feed. I have no experience of using feeds within flex but I think I've managed to get one in. How it works is when users type in their twitter id and click a load button all of their tweets are displayed within a repeater component. They can then click a save button to save their twitter id and whenever they start the application in the future their tweets will load into the repeater component automatically as long as their name has been saved. This may seem like silly question but does what I've described constitute a 'live twitter feed' which is what I've been asked to include or am I missing something?
[flexcoders] Re: Twitter Feed Within An Air/Flex Application
Polling the twitter service every 60 seconds (refresh) would be a way that you could get updates semi-automatically. You're not using RTMP, so you're never going to be really live. HTTPService calls are asynchronous, so there isn't much overhead just listening to a Timer(). For extending the functionality, here's a couple links. http://blogs.adobe.com/flexdoc/2009/03/simple_twitter_client_in_flex.htm http://blogs.adobe.com/flexdoc/2009/03/simple_twitter_client_in_flex.ht\ ml l http://apiwiki.twitter.com/Twitter-API-Documentation http://apiwiki.twitter.com/Twitter-API-Documentation -TH --- In flexcoders@yahoogroups.com, James garymoorcroft_...@... wrote: But is it possible within flex to have a feed that acts live such as this i.e. it is constantly changing? I thought within flex you could only load data upon some sort of event such as the click of a button? The user can refresh their tweets simply by clicking the load tweets button again but may it be better to have a refresh function constantly running and refreshing the feed every couple of seconds to keep it essentially 'live'? I thought something like this would take up memory/loading times though. The ability to post tweets to twitter from within an app does sound like a great idea though. I wouldn't know where to start on this though. Do you know of any examples on the net that show this being done that I could implement into my own? Cheers for your help though. These are good ideas. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Hi James, If your application automatically displays new tweets, those created after the initial load, than yes; that would be considered live. If however its just taking a snapshot, then no. A starting point would be to refresh the tweets. Having the ability to post tweets, and see them instantly show up, would also make it more live. Other ideas would be IM, chat, or other real-time activities that involve the course; like live test scoring, or something. -TH --- In flexcoders@yahoogroups.com, James garymoorcroft_ict@ wrote: I've previously made an air application for my university course and my tutor has suggested that I incorporate more live data into it. One of the ways he suggested was to include a twitter feed. I have no experience of using feeds within flex but I think I've managed to get one in. How it works is when users type in their twitter id and click a load button all of their tweets are displayed within a repeater component. They can then click a save button to save their twitter id and whenever they start the application in the future their tweets will load into the repeater component automatically as long as their name has been saved. This may seem like silly question but does what I've described constitute a 'live twitter feed' which is what I've been asked to include or am I missing something?
Re: [SPAM] [flexcoders] Obtaining rendered text from a DataGrid
If you don't have too many items in the dataProvider, you could create a second DataGrid, with the same DataProvider and itemRenderers, that does not have a height set and is not visible. The second DataGrid would render all of the items in the dataProvider, because the height isn't set. Then go about inspecting the itemRenderers like you proposed earlier; to get the data for your service call. Not the best solution, but this is an unusual use-case. -TH --- In flexcoders@yahoogroups.com, Mike msl...@... wrote: I need to post the displayed data to a server, complete with formatting. The dataProvider does not help much; I'd have to replicate the work that the datagrid does in determining the properties displayed by each column, and duplicate the job of the item renderers in order to extract the displayed property of each column. I see that itemRenderers can be created ad hoc, so it must be possible to shove data into them and obtain the displayed values. ... it is nice to get a response, and so quickly too :)
[flexcoders] Re: Custom GridLines
Your best bet is to NOT show any default horizontal lines and then use annotationElements to draw your 2 custom lines. -TH --- In flexcoders@yahoogroups.com, lauraff_mu lauraff...@... wrote: Hello! I'm trying to make a chart (in Flex 3). I only want to show two horizontal gird lines instead of all the lines the chart displays. Is there any way to do that? I have already try with horizontalChangeCount but it doesn't work ok. (Sorry about my English...) Thanks in advance!
[flexcoders] Re: Custom GridLines
Or to put the lines in back, use backgroundElements. -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: Your best bet is to NOT show any default horizontal lines and then use annotationElements to draw your 2 custom lines. -TH --- In flexcoders@yahoogroups.com, lauraff_mu lauraff_mu@ wrote: Hello! I'm trying to make a chart (in Flex 3). I only want to show two horizontal gird lines instead of all the lines the chart displays. Is there any way to do that? I have already try with horizontalChangeCount but it doesn't work ok. (Sorry about my English...) Thanks in advance!
[flexcoders] Re: Resize and Save an Image
If the image is in a container, you could capture a bitmap of the container component and save that: import flash.display.Bitmap; import flash.display.BitmapData; import mx.core.UIComponent; import mx.graphics.ImageSnapshot; private function getSnapshotImage( component:UIComponent ):Bitmap { var bitmapData:BitmapData = ImageSnapshot.captureBitmapData( component ); var bitmap:Bitmap = new Bitmap( bitmapData ); return bitmap; } -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernande...@... wrote: Hey does anyone know if it's possible to resize and image in flex and save it to a mysql database so that I have say a 512x512 and a 60x60? If so, is there a tutorial out on the web somewhere? This is just to avoid having to resize it myself manually when I receive the 512x512.
[flexcoders] Re: horizontalAlign Puzzling
I think because horizontalAlign is a style, not a property. Try setStyle(); -TH --- In flexcoders@yahoogroups.com, criptopus sd_br...@... wrote: var boxArray:Array=new Array(); var boxIdx:int=boxArray.length; boxArray.push(new Box()); boxArray[boxIdx].percentWidth=100; Why not...? boxArray[boxIdx].horizontalAlign=center; - Stephen
[flexcoders] Re: Displaying additional child nodes in Datatip
My pleasure Monette. -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: Tim, It works!!! Hooray!!! You Rock!!! Thank you so much for all your help. Monette --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Three time's a charm: var series:LineSeries = LineSeries( o.element ); var seriesIndex:int; for ( seriesIndex = 0; seriesIndex myChart.series.length; seriesIndex++ ) { var lineSeries:LineSeries = myChart.series[ seriesIndex ] as LineSeries; if ( lineSeries == series ) { break; } } -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Cleaner: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( seriesIndex = 0; seriesIndex myChart.series.length; seriesIndex++ ) { var lineSeries:LineSeries = myChart.series[ seriesIndex ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: So, maybe something like this: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( var a:int = 0; a myChart.series.length; a++ ) { var lineSeries:LineSeries = myChart.series[ a ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { seriesIndex = a; break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Easy enough, create a dictionary (id or name) when the series's are created; with the index. And/Or you can get the count from myChart.series.length. -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: This will work. However, the series count is not limited to just 3 series, it's count is dynamic depending on the amount of data collected. So the code needs to check how many series exists and then generate the datatip for the different series data points. It is easy for me to accomplish this in VB.NET or vbscript but I am just having problems accomplishing what I need in AS. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Ok, good. Not sure exactly what you're trying to do, but it's basically the same type of thing as the data function. It's all about getting to right data for the series. Here's some code for getting individual values and for calculating totals for the week private function dtFunction( o:HitData ):String { var seriesId:String = LineSeries( o.element ).id; var seriesIndex:int; switch ( seriesId ) { case s0: seriesIndex = 0; break; case s1: seriesIndex = 1; break; case s2: seriesIndex = 2; break; default: break; } var totalBooksForWeek:int = 0; for ( var a:int = 0; a 3; a++ ) { var sessionBooks:int = o.item.session[ a ].books; totalBooksForWeek += sessionBooks; } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; s += bTotal Books for All Sessions:/b + totalBooksForWeek + \n; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote
[flexcoders] Re: Displaying additional child nodes in Datatip
Ok, good. Not sure exactly what you're trying to do, but it's basically the same type of thing as the data function. It's all about getting to right data for the series. Here's some code for getting individual values and for calculating totals for the week private function dtFunction( o:HitData ):String { var seriesId:String = LineSeries( o.element ).id; var seriesIndex:int; switch ( seriesId ) { case s0: seriesIndex = 0; break; case s1: seriesIndex = 1; break; case s2: seriesIndex = 2; break; default: break; } var totalBooksForWeek:int = 0; for ( var a:int = 0; a 3; a++ ) { var sessionBooks:int = o.item.session[ a ].books; totalBooksForWeek += sessionBooks; } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; s += bTotal Books for All Sessions:/b + totalBooksForWeek + \n; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: Almost there! I assigned an id to each series - s1, s2, s3 etc. Below I am trying to loop for the total amount of series. The values show up for bookrate and status but they are the incorrect values for some of the datapoints. If I define a as 0, 1 or 3 without the loop the values are correct for just that particular series. Why isn't the for loop or while loop working? Thanks so much for your help Tim! Monette private function dtFunction( o:HitData ):String var s:String; for (var a:int=0; a 3; a++) { var index:int = (LineSeries(o.element).id == s + a)? 0 : 1; s = b + LineSeries(o.element).displayName + /b \n; s += bBooks:/b + LineSeriesItem(o.chartItem).yValue + \n + bBook rate:/b + o.item.session[index].bookrate + \n ; s += bStatus:/b + o.item.session[index].status + \n ; } return s; } --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Assuming that you have assigned an id to each series (baseline,2009-8), you could use something like this: private function dtFunction( o:HitData ):String { var index:int = ( LineSeries( o.element ).id == baseline ) ? 0 : 1; var s:String = bBook rate:/b + o.item.session[ index ].bookrate; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Tim, Your recommendation sounds so simple and logical but I am not getting it to work. My problem is parsing the XML and returning the correct info for the datapoints. Following, is a sample of my XML file: items week name=1 session sessionnameBaseline/sessionname books0/books bookrate2/bookrate statusred/status /session session sessionname2009-8/sessionname books0/books bookrate6/bookrate statusred/status /session /week week name=2 session sessionnameBaseline/sessionname books0/books bookrate3/bookrate statusred/status /session session sessionname2009-8/sessionname books0/books bookrate1/bookrate statusred/status /session /week /items What are your thoughts? Thanks. Monette --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Yeah, you're very close. Now it's just a matter of xml. I'd start by tracing o. If the children are still in o, then drill down. Otherwise, you'll have to go and find the nodes; like you're trying below. Some things that you can start with: trace( o.toXMLString() ); var myXMLChildren:XMLList = o.children(); o.child(myProperty)[0].valueOf(); -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Below is my DataTipFunction. The commented part on top works fine. However, there is additional information that I need to include from the XML file into the data tip. When I mouse over the datapoint I would like to retrieve from the XML file the additional child nodes that correspond with that datapoint. I feel that I am very close
[flexcoders] Re: Displaying additional child nodes in Datatip
Easy enough, create a dictionary (id or name) when the series's are created; with the index. And/Or you can get the count from myChart.series.length. -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: This will work. However, the series count is not limited to just 3 series, it's count is dynamic depending on the amount of data collected. So the code needs to check how many series exists and then generate the datatip for the different series data points. It is easy for me to accomplish this in VB.NET or vbscript but I am just having problems accomplishing what I need in AS. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Ok, good. Not sure exactly what you're trying to do, but it's basically the same type of thing as the data function. It's all about getting to right data for the series. Here's some code for getting individual values and for calculating totals for the week private function dtFunction( o:HitData ):String { var seriesId:String = LineSeries( o.element ).id; var seriesIndex:int; switch ( seriesId ) { case s0: seriesIndex = 0; break; case s1: seriesIndex = 1; break; case s2: seriesIndex = 2; break; default: break; } var totalBooksForWeek:int = 0; for ( var a:int = 0; a 3; a++ ) { var sessionBooks:int = o.item.session[ a ].books; totalBooksForWeek += sessionBooks; } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; s += bTotal Books for All Sessions:/b + totalBooksForWeek + \n; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Almost there! I assigned an id to each series - s1, s2, s3 etc. Below I am trying to loop for the total amount of series. The values show up for bookrate and status but they are the incorrect values for some of the datapoints. If I define a as 0, 1 or 3 without the loop the values are correct for just that particular series. Why isn't the for loop or while loop working? Thanks so much for your help Tim! Monette private function dtFunction( o:HitData ):String var s:String; for (var a:int=0; a 3; a++) { var index:int = (LineSeries(o.element).id == s + a)? 0 : 1; s = b + LineSeries(o.element).displayName + /b \n; s += bBooks:/b + LineSeriesItem(o.chartItem).yValue + \n + bBook rate:/b + o.item.session[index].bookrate + \n ; s += bStatus:/b + o.item.session[index].status + \n ; } return s; } --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Assuming that you have assigned an id to each series (baseline,2009-8), you could use something like this: private function dtFunction( o:HitData ):String { var index:int = ( LineSeries( o.element ).id == baseline ) ? 0 : 1; var s:String = bBook rate:/b + o.item.session[ index ].bookrate; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Tim, Your recommendation sounds so simple and logical but I am not getting it to work. My problem is parsing the XML and returning the correct info for the datapoints. Following, is a sample of my XML file: items week name=1 session sessionnameBaseline/sessionname books0/books bookrate2/bookrate statusred/status /session session sessionname2009-8/sessionname books0/books bookrate6/bookrate statusred/status /session /week week name=2 session sessionnameBaseline/sessionname books0/books bookrate3/bookrate statusred/status /session session sessionname2009-8/sessionname books0/books bookrate1/bookrate statusred/status /session /week /items What are your thoughts? Thanks. Monette --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote
[flexcoders] Re: Displaying additional child nodes in Datatip
So, maybe something like this: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( var a:int = 0; a myChart.series.length; a++ ) { var lineSeries:LineSeries = myChart.series[ a ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { seriesIndex = a; break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: Easy enough, create a dictionary (id or name) when the series's are created; with the index. And/Or you can get the count from myChart.series.length. -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: This will work. However, the series count is not limited to just 3 series, it's count is dynamic depending on the amount of data collected. So the code needs to check how many series exists and then generate the datatip for the different series data points. It is easy for me to accomplish this in VB.NET or vbscript but I am just having problems accomplishing what I need in AS. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Ok, good. Not sure exactly what you're trying to do, but it's basically the same type of thing as the data function. It's all about getting to right data for the series. Here's some code for getting individual values and for calculating totals for the week private function dtFunction( o:HitData ):String { var seriesId:String = LineSeries( o.element ).id; var seriesIndex:int; switch ( seriesId ) { case s0: seriesIndex = 0; break; case s1: seriesIndex = 1; break; case s2: seriesIndex = 2; break; default: break; } var totalBooksForWeek:int = 0; for ( var a:int = 0; a 3; a++ ) { var sessionBooks:int = o.item.session[ a ].books; totalBooksForWeek += sessionBooks; } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; s += bTotal Books for All Sessions:/b + totalBooksForWeek + \n; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Almost there! I assigned an id to each series - s1, s2, s3 etc. Below I am trying to loop for the total amount of series. The values show up for bookrate and status but they are the incorrect values for some of the datapoints. If I define a as 0, 1 or 3 without the loop the values are correct for just that particular series. Why isn't the for loop or while loop working? Thanks so much for your help Tim! Monette private function dtFunction( o:HitData ):String var s:String; for (var a:int=0; a 3; a++) { var index:int = (LineSeries(o.element).id == s + a)? 0 : 1; s = b + LineSeries(o.element).displayName + /b \n; s += bBooks:/b + LineSeriesItem(o.chartItem).yValue + \n + bBook rate:/b + o.item.session[index].bookrate + \n ; s += bStatus:/b + o.item.session[index].status + \n ; } return s; } --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Assuming that you have assigned an id to each series (baseline,2009-8), you could use something like this: private function dtFunction( o:HitData ):String { var index:int = ( LineSeries( o.element ).id == baseline ) ? 0 : 1; var s:String = bBook rate:/b + o.item.session[ index ].bookrate; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Tim, Your recommendation sounds so simple and logical but I am not getting it to work. My problem is parsing the XML and returning the correct info for the datapoints. Following, is a sample of my XML file: items week name=1 session
[flexcoders] Re: Displaying additional child nodes in Datatip
Cleaner: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( seriesIndex = 0; seriesIndex myChart.series.length; seriesIndex++ ) { var lineSeries:LineSeries = myChart.series[ seriesIndex ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: So, maybe something like this: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( var a:int = 0; a myChart.series.length; a++ ) { var lineSeries:LineSeries = myChart.series[ a ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { seriesIndex = a; break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Easy enough, create a dictionary (id or name) when the series's are created; with the index. And/Or you can get the count from myChart.series.length. -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: This will work. However, the series count is not limited to just 3 series, it's count is dynamic depending on the amount of data collected. So the code needs to check how many series exists and then generate the datatip for the different series data points. It is easy for me to accomplish this in VB.NET or vbscript but I am just having problems accomplishing what I need in AS. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Ok, good. Not sure exactly what you're trying to do, but it's basically the same type of thing as the data function. It's all about getting to right data for the series. Here's some code for getting individual values and for calculating totals for the week private function dtFunction( o:HitData ):String { var seriesId:String = LineSeries( o.element ).id; var seriesIndex:int; switch ( seriesId ) { case s0: seriesIndex = 0; break; case s1: seriesIndex = 1; break; case s2: seriesIndex = 2; break; default: break; } var totalBooksForWeek:int = 0; for ( var a:int = 0; a 3; a++ ) { var sessionBooks:int = o.item.session[ a ].books; totalBooksForWeek += sessionBooks; } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; s += bTotal Books for All Sessions:/b + totalBooksForWeek + \n; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Almost there! I assigned an id to each series - s1, s2, s3 etc. Below I am trying to loop for the total amount of series. The values show up for bookrate and status but they are the incorrect values for some of the datapoints. If I define a as 0, 1 or 3 without the loop the values are correct for just that particular series. Why isn't the for loop or while loop working? Thanks so much for your help Tim! Monette private function dtFunction( o:HitData ):String var s:String; for (var a:int=0; a 3; a++) { var index:int = (LineSeries(o.element).id == s + a)? 0 : 1; s = b + LineSeries(o.element).displayName + /b \n; s += bBooks
[flexcoders] Re: Displaying additional child nodes in Datatip
Three time's a charm: var series:LineSeries = LineSeries( o.element ); var seriesIndex:int; for ( seriesIndex = 0; seriesIndex myChart.series.length; seriesIndex++ ) { var lineSeries:LineSeries = myChart.series[ seriesIndex ] as LineSeries; if ( lineSeries == series ) { break; } } -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: Cleaner: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( seriesIndex = 0; seriesIndex myChart.series.length; seriesIndex++ ) { var lineSeries:LineSeries = myChart.series[ seriesIndex ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: So, maybe something like this: private function dtFunction( o:HitData ):String { var series:LineSeries = LineSeries( o.element ) as LineSeries; var seriesIndex:int; for ( var a:int = 0; a myChart.series.length; a++ ) { var lineSeries:LineSeries = myChart.series[ a ] as LineSeries; if ( lineSeries.displayName == series.displayName ) { seriesIndex = a; break; } } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; return s; } -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Easy enough, create a dictionary (id or name) when the series's are created; with the index. And/Or you can get the count from myChart.series.length. -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: This will work. However, the series count is not limited to just 3 series, it's count is dynamic depending on the amount of data collected. So the code needs to check how many series exists and then generate the datatip for the different series data points. It is easy for me to accomplish this in VB.NET or vbscript but I am just having problems accomplishing what I need in AS. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Ok, good. Not sure exactly what you're trying to do, but it's basically the same type of thing as the data function. It's all about getting to right data for the series. Here's some code for getting individual values and for calculating totals for the week private function dtFunction( o:HitData ):String { var seriesId:String = LineSeries( o.element ).id; var seriesIndex:int; switch ( seriesId ) { case s0: seriesIndex = 0; break; case s1: seriesIndex = 1; break; case s2: seriesIndex = 2; break; default: break; } var totalBooksForWeek:int = 0; for ( var a:int = 0; a 3; a++ ) { var sessionBooks:int = o.item.session[ a ].books; totalBooksForWeek += sessionBooks; } var s:String = b + LineSeries( o.element ).displayName + /b\n; s += bBooks:/b + LineSeriesItem( o.chartItem ).yValue + \n; s += bBook rate:/b + o.item.session[ seriesIndex ].bookrate + \n; s += bStatus:/b + o.item.session[ seriesIndex ].status + \n; s += bTotal Books for All Sessions:/b + totalBooksForWeek + \n; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Almost there! I assigned an id to each series - s1, s2, s3 etc. Below I am trying to loop for the total amount of series. The values show up for bookrate and status but they are the incorrect values for some of the datapoints. If I define a as 0, 1 or 3 without the loop the values are correct for just that particular series. Why isn't the for loop or while
[flexcoders] Re: Displaying additional child nodes in Datatip
Yeah, you're very close. Now it's just a matter of xml. I'd start by tracing o. If the children are still in o, then drill down. Otherwise, you'll have to go and find the nodes; like you're trying below. Some things that you can start with: trace( o.toXMLString() ); var myXMLChildren:XMLList = o.children(); o.child(myProperty)[0].valueOf(); -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: Below is my DataTipFunction. The commented part on top works fine. However, there is additional information that I need to include from the XML file into the data tip. When I mouse over the datapoint I would like to retrieve from the XML file the additional child nodes that correspond with that datapoint. I feel that I am very close and missing one piece. How can I accomplish this dynamically by displaying the correct data for the series? Note, I can have more than 1 series in the XML data file. private function DTPFunction(o:HitData):String { //WORKS for data that is used on the chart x and y values //var s:String; //s = b + LineSeries(o.element).displayName + /b \n; //s += bBooks:/b + LineSeriesItem(o.chartItem).yValue + \n + bBook rate:/b + series. o.item.session.bookrate + \n ; //s += bStatus:/b + o.item.session.status + \n ; //END WORKS var s:String; var a:int=0; var fNode:XML = chart.dataProvider[0]; if ((LineSeries(o.element).displayName) == fNode.child('sessionname')) { s = b + o.item.session.sessionname[a] + /b \n; s += bBooks:/b + o.item.session.books[a] + \n + bBook rate:/b + o.item.session.bookrate[a] + \n ; s += bStatus:/b + o.item.session.status[a] + /size\n ; a++ } return s; } Thanks. Monette --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: If the dataTipFunction doesn't give you enough flexibility, you could try a dataTipRenderer. In either case, you can drill down to the child nodes there. -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: The line chart displays multiple series created with the seriesDataFunction (assigning the x and y points). The XML file includes additional child nodes per item that I would like to include in the datatip. How do I include those items? When I use o.item.rate, it lists all the rates for each series in the datatip. Thanks. Monette
[flexcoders] Re: Displaying additional child nodes in Datatip
Assuming that you have assigned an id to each series (baseline,2009-8), you could use something like this: private function dtFunction( o:HitData ):String { var index:int = ( LineSeries( o.element ).id == baseline ) ? 0 : 1; var s:String = bBook rate:/b + o.item.session[ index ].bookrate; return s; } -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: Tim, Your recommendation sounds so simple and logical but I am not getting it to work. My problem is parsing the XML and returning the correct info for the datapoints. Following, is a sample of my XML file: items week name=1 session sessionnameBaseline/sessionname books0/books bookrate2/bookrate statusred/status /session session sessionname2009-8/sessionname books0/books bookrate6/bookrate statusred/status /session /week week name=2 session sessionnameBaseline/sessionname books0/books bookrate3/bookrate statusred/status /session session sessionname2009-8/sessionname books0/books bookrate1/bookrate statusred/status /session /week /items What are your thoughts? Thanks. Monette --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Yeah, you're very close. Now it's just a matter of xml. I'd start by tracing o. If the children are still in o, then drill down. Otherwise, you'll have to go and find the nodes; like you're trying below. Some things that you can start with: trace( o.toXMLString() ); var myXMLChildren:XMLList = o.children(); o.child(myProperty)[0].valueOf(); -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: Below is my DataTipFunction. The commented part on top works fine. However, there is additional information that I need to include from the XML file into the data tip. When I mouse over the datapoint I would like to retrieve from the XML file the additional child nodes that correspond with that datapoint. I feel that I am very close and missing one piece. How can I accomplish this dynamically by displaying the correct data for the series? Note, I can have more than 1 series in the XML data file. private function DTPFunction(o:HitData):String { //WORKS for data that is used on the chart x and y values //var s:String; //s = b + LineSeries(o.element).displayName + /b \n; //s += bBooks:/b + LineSeriesItem(o.chartItem).yValue + \n + bBook rate:/b + series. o.item.session.bookrate + \n ; //s += bStatus:/b + o.item.session.status + \n ; //END WORKS var s:String; var a:int=0; var fNode:XML = chart.dataProvider[0]; if ((LineSeries(o.element).displayName) == fNode.child('sessionname')) { s = b + o.item.session.sessionname[a] + /b \n; s += bBooks:/b + o.item.session.books[a] + \n + bBook rate:/b + o.item.session.bookrate[a] + \n ; s += bStatus:/b + o.item.session.status[a] + /size\n ; a++ } return s; } Thanks. Monette --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: If the dataTipFunction doesn't give you enough flexibility, you could try a dataTipRenderer. In either case, you can drill down to the child nodes there. -TH --- In flexcoders@yahoogroups.com, Monette monettemm@ wrote: The line chart displays multiple series created with the seriesDataFunction (assigning the x and y points). The XML file includes additional child nodes per item that I would like to include in the datatip. How do I include those items? When I use o.item.rate, it lists all the rates for each series in the datatip. Thanks. Monette
[flexcoders] Re: Help: Line chart multiple series datatip
Think that you're looking for the dataTipFunction. -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: I assigned the y and x axis to each series in a line chart. I need to include additional information for each datapoint in the datatip from the XML file. How can this be accomplished? Thanks.
[flexcoders] Re: Displaying additional child nodes in Datatip
If the dataTipFunction doesn't give you enough flexibility, you could try a dataTipRenderer. In either case, you can drill down to the child nodes there. -TH --- In flexcoders@yahoogroups.com, Monette monett...@... wrote: The line chart displays multiple series created with the seriesDataFunction (assigning the x and y points). The XML file includes additional child nodes per item that I would like to include in the datatip. How do I include those items? When I use o.item.rate, it lists all the rates for each series in the datatip. Thanks. Monette
[flexcoders] Re: Setting variables
On the line above your setter, use the Inspectable metadata: [Inspectable(category=General, enumeration=auto,up,down, defaultValue=auto)] -TH --- In flexcoders@yahoogroups.com, Warren warrenony...@... wrote: I'm creating my own actionscript class which will have a public property accessed via a getter and setter. I want this property to have one of thew values: up. down. auto. How do I set things up so that when I use the class in Flexbuilder, only these choices appear as property selections? I'm in Flex 3.2.0 Thanks! Warren Koch
[flexcoders] Re: Flex LineChart. Show only line.
Just set showLabels=false on the AxisRenderers. -TH --- In flexcoders@yahoogroups.com, Slackware selecter...@... wrote: I'm using a mx:LineChart. And I need to show just the line (no vertical and horizontal labels). Is that possible? How? Many thanks.
[flexcoders] Re: Multiple initializers for property 'dataProvider'
Hi Raymond, You're missing the mx:columns tag that wraps the DataGridColumns. -TH --- In flexcoders@yahoogroups.com, Raymond Brown silenttr...@... wrote: Below is a snapshot of one of my components. However I am always getting an error on the Datagrid (id=cmdTable') and the error is: Multiple initializers for property 'dataProvider'. (note: 'dataProvider' is the default property of 'mx.controls.DataGrid'). Does this mean you can't keep more than one datagrid or datagrid type in a file? Here is my source - ?xml version=1.0 encoding=utf-8? mx:Canvasxmlns:mx=http://www.adobe.com/2006/mxml; xmlns:comp=components.* width=100% height=100% backgroundAlpha=0.0 fontSize=14 initialize=init() mx:Dissolve id=dissolveOut duration=2000 alphaFrom=1.0 alphaTo=0.0/ mx:Dissolve id=dissolveIn duration=2000 alphaFrom=0.0 alphaTo=1.0/ mx:Modelid=model source=xml/commands_6501.xml/ mx:Parallelid=showMe mx:Sequence mx:Glow id=glowImage duration=1000 alphaFrom=1.0 alphaTo=0.3 blurXFrom=0.0 blurXTo=50.0 blurYFrom=0.0 blurYTo=50.0 color=0x22A050/ mx:Glow id=unglowImage duration=1000 alphaFrom=0.3 alphaTo=1.0 blurXFrom=50.0 blurXTo=0.0 blurYFrom=50.0 blurYTo=0.0 color=0x3380DD/ /mx:Sequence /mx:Parallel mx:Parallelid=hideMe mx:Sequence mx:Glow id=ungImage duration=1000 alphaFrom=0.3 alphaTo=1.0 blurXFrom=50.0 blurXTo=0.0 blurYFrom=50.0 blurYTo=0.0 color=0x3380DD/ mx:Glow id=gImage duration=1000 alphaFrom=1.0 alphaTo=0.3 blurXFrom=0.0 blurXTo=50.0 blurYFrom=0.0 blurYTo=50.0 color=0x22A050/ /mx:Sequence /mx:Parallel mx:VBox width=100% height=100% horizontalAlign=center verticalAlign=middle mx:HBox width=100% height=25% horizontalAlign=center verticalAlign=middle backgroundAlpha=0.0 mx:VBox mx:ComboBoxid=siteCB dataProvider=['Select a site', '']/ mx:ComboBox id=deviceCB visible={siteCB.selectedIndex = 1} enabled={siteCB.selectedIndex = 1} dataProvider=['Select a device', '6501'] close=deviceSelected(event) / /mx:VBox mx:Image id=deviceImage visible=false source=images/6501.png width=100% height=100% autoLoad=true scaleContent=true hideEffect={dissolveOut} showEffect={dissolveIn}/ /mx:HBox mx:HBox width=100% height=60% visible={deviceCB.selectedIndex = 1} showEffect={showMe} mx:VBox label=Commands width=60% height=100% mx:VBox width=100% height=100% mx:DataGrid id=cmdTable dataProvider={deviceCommands} showHeaders=false width=100% height=85% selectedIndex=0 backgroundAlpha=0.0 color=#FF mx:DataGridColumn headerText=Command width=80 dataField=title/ mx:DataGridColumn headerText=Description dataField=description/ /mx:DataGrid mx:HBox width=100% height=15% mx:ComboBox id=cmdSelector width=200 dataProvider={cmdArray}/ mx:TextInput id=cmdToEnter borderStyle=solid borderThickness=5 borderColor=#FF color=#FF backgroundAlpha=0.0/ mx:Button label=Submit enabled={cmdToEnter.length 0}/ /mx:HBox /mx:VBox /mx:VBox mx:AdvancedDataGrid id=informationGrid showHeaders=false backgroundAlpha=0.0 width=40% height=100% color=#FF dataProvider={settingStatusData}/ /mx:HBox mx:TextArea id=deviceDataFromOurTable text=Blah Blah Blah width=100% height=15% backgroundAlpha=0.0 visible={deviceCB.selectedIndex = 1} showEffect={showMe}/ /mx:VBox mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var cmdArray:Array = new Array(); [Bindable] private var deviceCommands:ArrayCollection; [Bindable] private var settingStatusData:ArrayCollection = new ArrayCollection(); private function init(): void { cmdArray = ['antenna_delay', 'antenna_voltage', 'mask_angle']; deviceCommands = new ArrayCollection([{command: 'antenna_delay', description: 'Set the value of delay for the antenna cable'}]); } private function deviceSelected(event:Event): void { var device:String = ComboBox(event.target).selectedLabel; deviceImage.visible = true; //not setup the rest of the data getDeviceSettings(); } private function getDeviceSettings(): void { } ]] /mx:Script /mx:Canvas thanks for the insights or help to solving this.
[flexcoders] Re: Updating renderer properties
One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com, Aaron Hardy aaronius...@... wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide model (like in Cairngorm) I can set a color property there and either access it using the singleton accesor from within the renderer (cringe) or pass the model into the renderer using a class factory. Since the model instance shouldn't really ever change, I can then watch the model for changes to the color property. (2) Whenever the color changes, I can grab all the renderers for the given list and set their color property (cringe). Thoughts? Aaron
[flexcoders] Re: Updating renderer properties
If it's a pure style, then yes that is a viable approach. However, if it's something like changing text (characters, not styles), then you might want to use [Transient] properties in a VO and/or use states in the itemRenderer. -TH --- In flexcoders@yahoogroups.com, Aaron Hardy aaronius...@... wrote: Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied to all the renderers and can be ran through the various style mechanisms). To be clear, the changes (that aren't data-dependent) being made to the renderers in my case can even be text and other such things which may not normally be thought of as styles but in reality it seems they actually are styles and could be treated as such. Thanks. Aaron On Thu, Jan 7, 2010 at 1:23 PM, turbo_vb timh...@... wrote: One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide model (like in Cairngorm) I can set a color property there and either access it using the singleton accesor from within the renderer (cringe) or pass the model into the renderer using a class factory. Since the model instance shouldn't really ever change, I can then watch the model for changes to the color property. (2) Whenever the color changes, I can grab all the renderers for the given list and set their color property (cringe). Thoughts? Aaron
[flexcoders] Re: Updating renderer properties
Sure, but you don't necessarily need a model to use a VO; it can just be the strongly typed object that the dataProvider uses for its items. If you then change the transient properties of that VO, the set data method of the itemRenderer will work out of the box; and you can then adjust the renderer. You're right in feeling dirty having an itemRenderer reference a model. But reacting to changes in the data is fine. IMHO. -TH --- In flexcoders@yahoogroups.com, Aaron Hardy aaronius...@... wrote: Yes, I suppose the line of what is or is not a style can be blurry at times. In any case, using transient properties inside a VO is what I was eluding in the first item of things I've thought of, the downside being that a model/VO of some type is needed in order to keep the renderer notified of updates to the property. In other words, I don't see a viable way of creating a foobar property inside the renderer and keeping it updated from an external source. Instead, the renderer would need access to a model that was set at instantiation through the renderer class factory. The renderer would then watch the model for changes to its foobar property. Aaron On Thu, Jan 7, 2010 at 2:58 PM, turbo_vb timh...@... wrote: If it's a pure style, then yes that is a viable approach. However, if it's something like changing text (characters, not styles), then you might want to use [Transient] properties in a VO and/or use states in the itemRenderer. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied to all the renderers and can be ran through the various style mechanisms). To be clear, the changes (that aren't data-dependent) being made to the renderers in my case can even be text and other such things which may not normally be thought of as styles but in reality it seems they actually are styles and could be treated as such. Thanks. Aaron On Thu, Jan 7, 2010 at 1:23 PM, turbo_vb TimHoff@ wrote: One thought, since you're taking about a style, is to assign a styleName to the itemRenderer and update the backgroundColor style of the StyleDeclaration when the user changes the color. You may need to override the styleChanged() method the itemRenderer, to handle the update. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Hey folks. I have a renderer that needs information that is not based on the data object it's associated with. Essentially what I have is in View A of the app is a color selector. In View B, I have a tilelist with a custom renderer. All the renderers in the tile list display their data using the color that was selected in Part A. The way I see it, the color selected in Part A should be kept separate from the data object that gets injected into the item renderers. The color is just to make the data pretty in some way, it's not really data itself nor is it specific to an individual data object--it applies to all renderers in the list. This leads me to somehow keep the renderers updated with a separate color property. What's your preferred way of handling this scenario? Things I've thought of so far: (1) If I have an application-wide model (like in Cairngorm) I can set a color property there and either access it using the singleton accesor from within the renderer (cringe) or pass the model into the renderer using a class factory. Since the model instance shouldn't really ever change, I can then watch the model for changes to the color property. (2) Whenever the color changes, I can grab all the renderers for the given list and set their color property (cringe). Thoughts? Aaron
[flexcoders] Re: Updating renderer properties
We're not so off really, I hear what you're saying. Now we're getting a better idea of the use-case. In this case, all of the itemRenderers need to be controlled the same way; by changing their styles and/or labels. So let's go up a level. Extend the List, or whatever. Both the dataProvider and the collection of itemRenderers are there, so you could do it either way from the parent. For the styles, I'd still try the StyleDeclaration routes. For the labels, you have to ask, are the labels data related, like from a table somewhere?. Are they related to the parent object of the data in the dataProvider? Or, are they constants or persisted values? Each case could have a different solution. One way, is to create a public var in the itemRenderers, or a getter/setter, if you want to do something when the value changes. So, the itemRenderer's label.text is bound to the public var. In the extended list you create a method to update all of the public vars in the itemRenderers. It's a loop, but not so bad. Make your extended List's method public. Or, you can also use getter/setter vars, if you wanted to bind out further. When set, they could trigger the method that updates the itemRenderers. Or, you can always use owner as List, in the itemRenderer to check the value of a public var in the parent List during updateDisplayList(), and set your label's text value there. Like I said, it's usually all about the use-case. In general, I don't see a lot of itemRenderers that all display the same thing; unless the data happens to be identical. Common labels are often pulled up to the parent component. And the manipulation of an itemRenderer, for me, is usually based on data properties; that make sense to be included in every item. Interesting discussion. -TH --- In flexcoders@yahoogroups.com, Aaron Hardy aaronius...@... wrote: I think there might be a misunderstanding. If it's a transient property on the data objects that come through the data provider, I would have to change the property for all the objects in the data provider to be the same value since I want all the renderers to change in the same way. For example, let's say all my renderers say Woot: and then the data's text value. Then at runtime, the user, in a different part of the app, enters Niner into a text input and therefore I want all my renderers to now say Niner: and then the data's text value. In my case, the word Niner really has nothing to do with the data, it's almost more about the style of the renderers--or what the renderers look like around the actual data. If I were to use the transient property of the data provider objects, I'd have to loop through all of them and set the property's value to Niner. I'm not sure if that's what you were suggesting, but that seems dirtier to me than referencing a separate model from the renderers. I'm interested in understanding your analysis of this though even if we may disagree in the end. Aaron On Thu, Jan 7, 2010 at 5:13 PM, turbo_vb timh...@... wrote: Sure, but you don't necessarily need a model to use a VO; it can just be the strongly typed object that the dataProvider uses for its items. If you then change the transient properties of that VO, the set data method of the itemRenderer will work out of the box; and you can then adjust the renderer. You're right in feeling dirty having an itemRenderer reference a model. But reacting to changes in the data is fine. IMHO. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Yes, I suppose the line of what is or is not a style can be blurry at times. In any case, using transient properties inside a VO is what I was eluding in the first item of things I've thought of, the downside being that a model/VO of some type is needed in order to keep the renderer notified of updates to the property. In other words, I don't see a viable way of creating a foobar property inside the renderer and keeping it updated from an external source. Instead, the renderer would need access to a model that was set at instantiation through the renderer class factory. The renderer would then watch the model for changes to its foobar property. Aaron On Thu, Jan 7, 2010 at 2:58 PM, turbo_vb TimHoff@ wrote: If it's a pure style, then yes that is a viable approach. However, if it's something like changing text (characters, not styles), then you might want to use [Transient] properties in a VO and/or use states in the itemRenderer. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Aaron Hardy aaronius9er@ wrote: Good point. So maybe I have to categorize everything as being data (in which case it hangs out with the data object) or style (in which case it would be applied
[flexcoders] Re: how to use stage in mxml
The stage isn't available immediately. That's why you get a null error. With a little trickery: mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=onCreationComplete() resize=getStageDimensions() mx:Script ![CDATA[ private function onCreationComplete():void { callLater( getStageDimensions ); } private function getStageDimensions():void { if ( stage ) { trace( height: + stage.height ); trace( width: + stage.width ); } } ]] /mx:Script -TH --- In flexcoders@yahoogroups.com, markflex2007 markflex2...@... wrote: I try to get current stage size with the code,but I get error TypeError: Error #1009: Cannot access a property or method of a null object reference.. It seems I get error for stage.height. mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationPolicy=all resize=resizeHandler(event) mx:Script ![CDATA[ import mx.events.ResizeEvent; private function resizeHandler(event:ResizeEvent):void{ trace(height: + stage.height); trace(height: + stage.width); } ]] /mx:Script ... ... /mx:Application Please help me.Thanks Mark
[flexcoders] Re: how to use stage in mxml
Btw, adding a new topic every few hours that addresses the same issue, but with a slightly different name, is really bad form. -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: The stage isn't available immediately. That's why you get a null error. With a little trickery: mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=onCreationComplete() resize=getStageDimensions() mx:Script ![CDATA[ private function onCreationComplete():void { callLater( getStageDimensions ); } private function getStageDimensions():void { if ( stage ) { trace( height: + stage.height ); trace( width: + stage.width ); } } ]] /mx:Script -TH --- In flexcoders@yahoogroups.com, markflex2007 markflex2007@ wrote: I try to get current stage size with the code,but I get error TypeError: Error #1009: Cannot access a property or method of a null object reference.. It seems I get error for stage.height. mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationPolicy=all resize=resizeHandler(event) mx:Script ![CDATA[ import mx.events.ResizeEvent; private function resizeHandler(event:ResizeEvent):void{ trace(height: + stage.height); trace(height: + stage.width); } ]] /mx:Script ... ... /mx:Application Please help me.Thanks Mark
[flexcoders] Re: how to use stage in mxml
Yep, even better. -TH --- In flexcoders@yahoogroups.com, ag_rcuren robert.vancuren...@... wrote: Why not just use the addedToStage event instead? This will guarantee that stage is not null. mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; addedToStage=init(); public function init():void { stage.addEventListener(Event.RESIZE, resizeHandler); } private function resizeHandler(event:ResizeEvent):void { trace(height: + stage.height); trace(height: + stage.width); } --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Btw, adding a new topic every few hours that addresses the same issue, but with a slightly different name, is really bad form. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: The stage isn't available immediately. That's why you get a null error. With a little trickery: mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=onCreationComplete() resize=getStageDimensions() mx:Script ![CDATA[ private function onCreationComplete():void { callLater( getStageDimensions ); } private function getStageDimensions():void { if ( stage ) { trace( height: + stage.height ); trace( width: + stage.width ); } } ]] /mx:Script -TH --- In flexcoders@yahoogroups.com, markflex2007 markflex2007@ wrote: I try to get current stage size with the code,but I get error TypeError: Error #1009: Cannot access a property or method of a null object reference.. It seems I get error for stage.height. mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationPolicy=all resize=resizeHandler(event) mx:Script ![CDATA[ import mx.events.ResizeEvent; private function resizeHandler(event:ResizeEvent):void{ trace(height: + stage.height); trace(height: + stage.width); } ]] /mx:Script ... ... /mx:Application Please help me.Thanks Mark
[flexcoders] Re: Creating XML Document from Data
Why change from an ArrayCollection to xml; especially if it contains strongly typed objects? A bit easier to work with for hierarchical components or charts perhaps? -TH --- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote: Better still, create the XML in the backend rather than generate data on the server and have to translate that data again. Paul Tracy Spratt wrote: I do not know of an example, but creating XMl with AS is pretty easy. You have two choices, either building a string representation, the feeding that to XML() function, or build the xml directly using the e4x API. I do it both ways. Start with the static parts of the xml, then in the dynamic parts, filter the ArrayCollection for the applicable items, loop over those, and build a node for each one. Tracy Spratt, Lariat Services, development services available *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Wally Kolcz *Sent:* Sunday, January 03, 2010 7:26 PM *To:* flexcoders@yahoogroups.com *Subject:* [SPAM] [flexcoders] Creating XML Document from Data Can someone give me a hint (Class to look into) or paste a URL to an example of how to create an XML structure, using a returned ArrayCollection of dynamic values, to use as the XML Datasource for a mx:MenuBar. I create a backend system for my client to use to create views ('pages'), but need to take the pageTitles and pageID, base on categories ('galleries' and 'personal'), and create a drop down menu system using mx:MenuBar Something like: menuitem label=Home/ menuitem label=Galleries //Loop all the galleries by the returned data menuitem label=pageTitle / /menuitem menuitem label=About the Artist //Loop all the personal pages by the returned data menuitem label=pageTitle / /menuitem menuitem label=Contact/
[flexcoders] Re: Getting the Y value for a line at a given point
Hi Ryan, You can get the coordinates of the point by using coordinate geometry and trigonometry. The key would be to determine the angle (or slope) of the line segment and the distance to the event point. Or, if you wanted to make the segments square, use form=step: mx:LineSeries form=step/ -TH --- In flexcoders@yahoogroups.com, Ryan rmarples+flexcod...@... wrote: I've got a line chart showing a dollar value over time. Think of it as the balance of a savings account. It goes up and down every month or so. What I'm trying to do is overlay little widgets on top of that line on the chart to represent events that may or may not have affected the line's value. This is actually similar to the Yahoo Finance stock chart with the event overlays. Anyway, it's easy enough to add a CartesianDataCanvas as an annotation element to my line chart and then add children to it. It has a nice little addDataChild method that allows you to specify an x axis value and a y axis value and it figures out what the corresponding x and y coordinates are and places the child there. Great so far. Say my line series data provider looks like this: {date:new Date(2009, 1, 1), balance:100} {date:new Date(2009, 2, 8), balance:140} {date:new Date(2009, 3, 5), balance:95} If I have an event for 1/1/2009, I can look up that the balance was 100 on that day and place the event widget at [1/1/2009, 100]. However, if I have an event on 1/15/2009, from looking at the data provider above, I know that the balance was still 100, but because the line is diagonally vectoring towards the next value of 140, my data point is misplaced if I put it at [1/15/2009, 100]. Is there a way to get the line's y value given an x value? or Can I change my line chart to not draw diagonal lines and instead draw square lines so I won't have this problem? Ryan
[flexcoders] Re: event when page is shown in ViewStack?
The show event will work except for the first time; in which case you'd want to listen for the creationComplete event. -TH --- In flexcoders@yahoogroups.com, mitchgrrt mitch_g...@... wrote: Is there an event I can listen for on a page, which would be sent automatically whenever the page is shown in a ViewStack? I thought show might work but it doesn't seem to. We have an application with a set of nested tabs implemented with ViewStacks, and a couple of the pages need to execute a function whenever they are shown. Thanks.
[flexcoders] Re: Adding a custom UI component as a panel titleIcon.
That's exactly what you should do. To get around the the titleBar add the box to rawChildren. http://dougr.net/?p=160 http://dougr.net/?p=160 -TH --- In flexcoders@yahoogroups.com, invertedspear invertedsp...@... wrote: Alternatively it would be nice if I could extend the Panel class to allow me to add click events to the title area at the top, but I can't find any way of making that public so I can do it outside of my custom class, any ideas on exposing that protected property? Thanks --- In flexcoders@yahoogroups.com, invertedspear invertedspear@ wrote: This should be easy but I'm kind of a newbie. The concept of this seems easy, but I'm having trouble getting it right and can't find anything to help me on this. I have a panel I need to perform a drag and drop operation on, but I only want to perform that if the user mouses down on a particular area of the panel. I can add an Icon to the panel by doing this: ** [Embed(/img/icon.png)] [Bindable] public var dragIcon:Class; newPanel.titleIcon = dragIcon; ** But what I really want to add is a box, which I can then add my listeners to for the drag and mouse down like I do on some canvases created in actionscript like so: ** var tempBox:Box = new Box; tempBox.x=0; tempBox.y=0; tempBox.width = 20; tempBox.height = 44; tempBox.setStyle(horizontalAlign,center); tempBox.setStyle(verticalAlign,middle); tempBox.addEventListener(MouseEvent.ROLL_OVER,over); tempBox.addEventListener(MouseEvent.ROLL_OUT,out); tempBox.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownAnswer); var tempImg:Image = new Image(); tempImg.source = grabbableItem; tempBox.addChild(tempImg); myCanvas.addChild(tempBox); ** So what do I need to do to use that tempBox and turn it into a class to be used as my panels titleIcon?
[flexcoders] Re: change slideer look?
Using the tickValues property will help you a little. -TH --- In flexcoders@yahoogroups.com, markflex2007 markflex2...@... wrote: Hi, I have a slider that is like following: mx:HSlider id=radius width=300 minimum=0.5 maximum=5 tickColor=0x323232 snapInterval=0.5 tickInterval=0.5 dataTipPrecision=1 labels=['0.5mile','5miles'] liveDragging=true / I want to only let it to choose value 0.5,1,2,3,4,5. My question is how to make ticks for 1.5,2.5,3.5,4.5 not to display so we can not select that values. Thanks for help Marks
[flexcoders] Re: Adding a custom UI component as a panel titleIcon.
In updateDispayList() position the box: tempBox.move( unscaledWidth - tempBox.width - 10, ( unscaledHeight / 2 ) - ( tempBox.height / 2 ) ); This would put it on the right side of the header, minus 10 pixels. -TH --- In flexcoders@yahoogroups.com, invertedspear invertedsp...@... wrote: I am adding the box but now it's covering up the normal title text of the panel. Any quick fix for that (I'm just adding space to the front of the text for the time being)? --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: That's exactly what you should do. To get around the the titleBar add the box to rawChildren. http://dougr.net/?p=160 http://dougr.net/?p=160 -TH --- In flexcoders@yahoogroups.com, invertedspear invertedspear@ wrote: Alternatively it would be nice if I could extend the Panel class to allow me to add click events to the title area at the top, but I can't find any way of making that public so I can do it outside of my custom class, any ideas on exposing that protected property? Thanks --- In flexcoders@yahoogroups.com, invertedspear invertedspear@ wrote: This should be easy but I'm kind of a newbie. The concept of this seems easy, but I'm having trouble getting it right and can't find anything to help me on this. I have a panel I need to perform a drag and drop operation on, but I only want to perform that if the user mouses down on a particular area of the panel. I can add an Icon to the panel by doing this: ** [Embed(/img/icon.png)] [Bindable] public var dragIcon:Class; newPanel.titleIcon = dragIcon; ** But what I really want to add is a box, which I can then add my listeners to for the drag and mouse down like I do on some canvases created in actionscript like so: ** var tempBox:Box = new Box; tempBox.x=0; tempBox.y=0; tempBox.width = 20; tempBox.height = 44; tempBox.setStyle(horizontalAlign,center); tempBox.setStyle(verticalAlign,middle); tempBox.addEventListener(MouseEvent.ROLL_OVER,over); tempBox.addEventListener(MouseEvent.ROLL_OUT,out); tempBox.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownAnswer); var tempImg:Image = new Image(); tempImg.source = grabbableItem; tempBox.addChild(tempImg); myCanvas.addChild(tempBox); ** So what do I need to do to use that tempBox and turn it into a class to be used as my panels titleIcon?
[flexcoders] Re: Adding a custom UI component as a panel titleIcon.
Ok, an easy way would be to add paddingLeft to the titleStyleName, or try to move the titleTextField in updateDisplayList(); -TH --- In flexcoders@yahoogroups.com, invertedspear invertedsp...@... wrote: I may not be able to sell that to the project manager. Anyway to keep it on the left without covering the title? Thanks, you've helped a lot so far. --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: In updateDispayList() position the box: tempBox.move( unscaledWidth - tempBox.width - 10, ( unscaledHeight / 2 ) - ( tempBox.height / 2 ) ); This would put it on the right side of the header, minus 10 pixels. -TH --- In flexcoders@yahoogroups.com, invertedspear invertedspear@ wrote: I am adding the box but now it's covering up the normal title text of the panel. Any quick fix for that (I'm just adding space to the front of the text for the time being)? --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: That's exactly what you should do. To get around the the titleBar add the box to rawChildren. http://dougr.net/?p=160 http://dougr.net/?p=160 -TH --- In flexcoders@yahoogroups.com, invertedspear invertedspear@ wrote: Alternatively it would be nice if I could extend the Panel class to allow me to add click events to the title area at the top, but I can't find any way of making that public so I can do it outside of my custom class, any ideas on exposing that protected property? Thanks --- In flexcoders@yahoogroups.com, invertedspear invertedspear@ wrote: This should be easy but I'm kind of a newbie. The concept of this seems easy, but I'm having trouble getting it right and can't find anything to help me on this. I have a panel I need to perform a drag and drop operation on, but I only want to perform that if the user mouses down on a particular area of the panel. I can add an Icon to the panel by doing this: ** [Embed(/img/icon.png)] [Bindable] public var dragIcon:Class; newPanel.titleIcon = dragIcon; ** But what I really want to add is a box, which I can then add my listeners to for the drag and mouse down like I do on some canvases created in actionscript like so: ** var tempBox:Box = new Box; tempBox.x=0; tempBox.y=0; tempBox.width = 20; tempBox.height = 44; tempBox.setStyle(horizontalAlign,center); tempBox.setStyle(verticalAlign,middle); tempBox.addEventListener(MouseEvent.ROLL_OVER,over); tempBox.addEventListener(MouseEvent.ROLL_OUT,out); tempBox.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownAnswer); var tempImg:Image = new Image(); tempImg.source = grabbableItem; tempBox.addChild(tempImg); myCanvas.addChild(tempBox); ** So what do I need to do to use that tempBox and turn it into a class to be used as my panels titleIcon?
[flexcoders] Re: addItem Trouble with TileList
If you need to check dups for other reasons that would work fine. but, if you just need it for this particular use-case, this is simpler: public function addButton():void { if ( dataRight.getItemIndex( rightTiles.selectedItem ) != -1 ) Alert.show( Already exists ); dataRight.addItem( rightTiles.selectedItem ); } -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernande...@... wrote: What about if I wanted to check for duplicates so that it will remind the user that this button already exists on the right? I came up with something like this, but doesn't work: public function addButton():void{ dataRight.addItem(rightTiles.selectedItem); checkDuplicates(); } public function checkDuplicates():void{ for(var i:int=0; i dataRight.length; i++){ if(dataLeft[i].id==dataRight[i].id){ Alert.show(Already exists); } } } -Sal --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: hey thanks TH, i knew it was something with one line of code. You rock! This was driving me nuts. Sal --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Because guys like Gordon are here, I'll also say that Instantiate is the correct word; instead of initialize. :) -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Man, I always forget at least one thing. You also need to initialize the second ArrayCollection(). [Bindable] public var dataRight:ArrayCollection= new ArrayCollection(); Might want to give the itemRenderer a background, so that the double clicks will be triggered on the entire area. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Hey Sal, minor tweaks: public function addButton():void { dataRight.addItem( rightTiles.selectedItem ); } and: mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true resultFormat=object/ -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: I am having trouble understanding the addItem method in AS3 with Flex. I'm trying to simply add the item renderer with all it's data from tilelist to tilelist. I'm using two arraycollections to do the transfer and the data is being populated through an xml file. I know it's just maybe 2 or 3 lines of code that I probably need, but can someone help me, please? Thanks // SAMPLE XML FILE buttonData product id=1 imagebtnSkins/action_btn.png/image price10/price /product product id=2 imagebtnSkins/awards_btn.png/image price15/price /product product id=3 imagebtnSkins/beer_btn.png/image price20/price /product product id=4 imagebtnSkins/blog_btn.png/image price25/price /product /buttonData // MAIN FILE ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=horizontal creationComplete=btnSrv.send() mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] public var dataLeft:ArrayCollection; [Bindable] public var dataRight:ArrayCollection; public function handleQueryResult(event:ResultEvent):void{ dataLeft = btnSrv.lastResult.buttonData.product; } public function addButton():void{ var item:Object = new Object(); dataRight.addItem(item); } ]] /mx:Script mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true/ mx:TileList id=rightTiles width=100% height=50% dataProvider={dataLeft} itemRenderer=ipodThumb columnWidth=94 rowHeight=80 doubleClickEnabled=true doubleClick=addButton()/ mx:TileList id=leftTiles width=100% height=50% dataProvider={dataRight} itemRenderer=ipodThumb columnWidth=94 rowHeight=80/ /mx:Application // ITEM RENDERER ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=108 height=83 mx:Image source={data.image} verticalAlign=middle horizontalAlign=center right=5 bottom=0 left=5 top=0/ /mx:Canvas
[flexcoders] Re: addItem Trouble with TileList
Cool, yea didn't know if you wanted to remind and add or just remind. Cheers, -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernande...@... wrote: Thanks again TH it works great I just adjusted it to an if..else.. conditional statement to avoid it still adding the duplicate to the tiles on the right. Appreciate it! -Sal --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: If you need to check dups for other reasons that would work fine. but, if you just need it for this particular use-case, this is simpler: public function addButton():void { if ( dataRight.getItemIndex( rightTiles.selectedItem ) != -1 ) Alert.show( Already exists ); dataRight.addItem( rightTiles.selectedItem ); } -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: What about if I wanted to check for duplicates so that it will remind the user that this button already exists on the right? I came up with something like this, but doesn't work: public function addButton():void{ dataRight.addItem(rightTiles.selectedItem); checkDuplicates(); } public function checkDuplicates():void{ for(var i:int=0; i dataRight.length; i++){ if(dataLeft[i].id==dataRight[i].id){ Alert.show(Already exists); } } } -Sal --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: hey thanks TH, i knew it was something with one line of code. You rock! This was driving me nuts. Sal --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Because guys like Gordon are here, I'll also say that Instantiate is the correct word; instead of initialize. :) -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Man, I always forget at least one thing. You also need to initialize the second ArrayCollection(). [Bindable] public var dataRight:ArrayCollection= new ArrayCollection(); Might want to give the itemRenderer a background, so that the double clicks will be triggered on the entire area. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Hey Sal, minor tweaks: public function addButton():void { dataRight.addItem( rightTiles.selectedItem ); } and: mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true resultFormat=object/ -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: I am having trouble understanding the addItem method in AS3 with Flex. I'm trying to simply add the item renderer with all it's data from tilelist to tilelist. I'm using two arraycollections to do the transfer and the data is being populated through an xml file. I know it's just maybe 2 or 3 lines of code that I probably need, but can someone help me, please? Thanks // SAMPLE XML FILE buttonData product id=1 imagebtnSkins/action_btn.png/image price10/price /product product id=2 imagebtnSkins/awards_btn.png/image price15/price /product product id=3 imagebtnSkins/beer_btn.png/image price20/price /product product id=4 imagebtnSkins/blog_btn.png/image price25/price /product /buttonData // MAIN FILE ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=horizontal creationComplete=btnSrv.send() mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] public var dataLeft:ArrayCollection; [Bindable] public var dataRight:ArrayCollection; public function handleQueryResult(event:ResultEvent):void{ dataLeft = btnSrv.lastResult.buttonData.product; } public function addButton():void{ var item:Object = new Object(); dataRight.addItem(item); } ]] /mx:Script mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true
[flexcoders] Re: addItem Trouble with TileList
Hey Sal, minor tweaks: public function addButton():void { dataRight.addItem( rightTiles.selectedItem ); } and: mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true resultFormat=object/ -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernande...@... wrote: I am having trouble understanding the addItem method in AS3 with Flex. I'm trying to simply add the item renderer with all it's data from tilelist to tilelist. I'm using two arraycollections to do the transfer and the data is being populated through an xml file. I know it's just maybe 2 or 3 lines of code that I probably need, but can someone help me, please? Thanks // SAMPLE XML FILE buttonData product id=1 imagebtnSkins/action_btn.png/image price10/price /product product id=2 imagebtnSkins/awards_btn.png/image price15/price /product product id=3 imagebtnSkins/beer_btn.png/image price20/price /product product id=4 imagebtnSkins/blog_btn.png/image price25/price /product /buttonData // MAIN FILE ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=horizontal creationComplete=btnSrv.send() mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] public var dataLeft:ArrayCollection; [Bindable] public var dataRight:ArrayCollection; public function handleQueryResult(event:ResultEvent):void{ dataLeft = btnSrv.lastResult.buttonData.product; } public function addButton():void{ var item:Object = new Object(); dataRight.addItem(item); } ]] /mx:Script mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true/ mx:TileList id=rightTiles width=100% height=50% dataProvider={dataLeft} itemRenderer=ipodThumb columnWidth=94 rowHeight=80 doubleClickEnabled=true doubleClick=addButton()/ mx:TileList id=leftTiles width=100% height=50% dataProvider={dataRight} itemRenderer=ipodThumb columnWidth=94 rowHeight=80/ /mx:Application // ITEM RENDERER ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=108 height=83 mx:Image source={data.image} verticalAlign=middle horizontalAlign=center right=5 bottom=0 left=5 top=0/ /mx:Canvas
[flexcoders] Re: addItem Trouble with TileList
Man, I always forget at least one thing. You also need to initialize the second ArrayCollection(). [Bindable] public var dataRight:ArrayCollection= new ArrayCollection(); Might want to give the itemRenderer a background, so that the double clicks will be triggered on the entire area. -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: Hey Sal, minor tweaks: public function addButton():void { dataRight.addItem( rightTiles.selectedItem ); } and: mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true resultFormat=object/ -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: I am having trouble understanding the addItem method in AS3 with Flex. I'm trying to simply add the item renderer with all it's data from tilelist to tilelist. I'm using two arraycollections to do the transfer and the data is being populated through an xml file. I know it's just maybe 2 or 3 lines of code that I probably need, but can someone help me, please? Thanks // SAMPLE XML FILE buttonData product id=1 imagebtnSkins/action_btn.png/image price10/price /product product id=2 imagebtnSkins/awards_btn.png/image price15/price /product product id=3 imagebtnSkins/beer_btn.png/image price20/price /product product id=4 imagebtnSkins/blog_btn.png/image price25/price /product /buttonData // MAIN FILE ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=horizontal creationComplete=btnSrv.send() mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] public var dataLeft:ArrayCollection; [Bindable] public var dataRight:ArrayCollection; public function handleQueryResult(event:ResultEvent):void{ dataLeft = btnSrv.lastResult.buttonData.product; } public function addButton():void{ var item:Object = new Object(); dataRight.addItem(item); } ]] /mx:Script mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true/ mx:TileList id=rightTiles width=100% height=50% dataProvider={dataLeft} itemRenderer=ipodThumb columnWidth=94 rowHeight=80 doubleClickEnabled=true doubleClick=addButton()/ mx:TileList id=leftTiles width=100% height=50% dataProvider={dataRight} itemRenderer=ipodThumb columnWidth=94 rowHeight=80/ /mx:Application // ITEM RENDERER ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=108 height=83 mx:Image source={data.image} verticalAlign=middle horizontalAlign=center right=5 bottom=0 left=5 top=0/ /mx:Canvas
[flexcoders] Re: addItem Trouble with TileList
Because guys like Gordon are here, I'll also say that Instantiate is the correct word; instead of initialize. :) -TH --- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote: Man, I always forget at least one thing. You also need to initialize the second ArrayCollection(). [Bindable] public var dataRight:ArrayCollection= new ArrayCollection(); Might want to give the itemRenderer a background, so that the double clicks will be triggered on the entire area. -TH --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote: Hey Sal, minor tweaks: public function addButton():void { dataRight.addItem( rightTiles.selectedItem ); } and: mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true resultFormat=object/ -TH --- In flexcoders@yahoogroups.com, s_hernandez01 s_hernandez01@ wrote: I am having trouble understanding the addItem method in AS3 with Flex. I'm trying to simply add the item renderer with all it's data from tilelist to tilelist. I'm using two arraycollections to do the transfer and the data is being populated through an xml file. I know it's just maybe 2 or 3 lines of code that I probably need, but can someone help me, please? Thanks // SAMPLE XML FILE buttonData product id=1 imagebtnSkins/action_btn.png/image price10/price /product product id=2 imagebtnSkins/awards_btn.png/image price15/price /product product id=3 imagebtnSkins/beer_btn.png/image price20/price /product product id=4 imagebtnSkins/blog_btn.png/image price25/price /product /buttonData // MAIN FILE ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=horizontal creationComplete=btnSrv.send() mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] public var dataLeft:ArrayCollection; [Bindable] public var dataRight:ArrayCollection; public function handleQueryResult(event:ResultEvent):void{ dataLeft = btnSrv.lastResult.buttonData.product; } public function addButton():void{ var item:Object = new Object(); dataRight.addItem(item); } ]] /mx:Script mx:HTTPService id=btnSrv url=buttonData.xml useProxy=false result=handleQueryResult(event) showBusyCursor=true/ mx:TileList id=rightTiles width=100% height=50% dataProvider={dataLeft} itemRenderer=ipodThumb columnWidth=94 rowHeight=80 doubleClickEnabled=true doubleClick=addButton()/ mx:TileList id=leftTiles width=100% height=50% dataProvider={dataRight} itemRenderer=ipodThumb columnWidth=94 rowHeight=80/ /mx:Application // ITEM RENDERER ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=108 height=83 mx:Image source={data.image} verticalAlign=middle horizontalAlign=center right=5 bottom=0 left=5 top=0/ /mx:Canvas