Re: [flexcoders] Re: Observing collections
should all be based on property change events, the heart of binding On Thu, Aug 14, 2008 at 8:55 AM, Richard Rodseth [EMAIL PROTECTED] wrote: Oh, I just stepped through Observe, and I guess the standard binding mechanism calls the source setter again, which calls the handler. On Thu, Aug 14, 2008 at 6:49 AM, Richard Rodseth [EMAIL PROTECTED]wrote: Thanks guys. Can someone explain how ac:Observe (which this is based on) works? i.e. what triggers the handler call when somethng in the middle of the source binding expression changes (eg. b in {a.b.c.myCollection}? I don't see any event handlers, and there's a mysterious execute() method in the parent class (Observer). And would your version below also fire when b changes? Otherwise, Josh's example works too, but the collection event is the only trigger. On Thu, Aug 14, 2008 at 12:12 AM, Dennis van Nooij [EMAIL PROTECTED]wrote: try this: package com.adobe.ac { import mx.events.CollectionEvent; import mx.collections.ArrayCollection; import flash.events.Event; import mx.core.Application; import mx.core.UIComponent; /** * * monitors Collections and react on reassining of the variable * and changes in the collection which are bindable * */ public class ObserveCollection extends Observer { private var _handler : Function; private var _source : Object; override public function get handler() : Function { return _handler; } public function set handler( value : Function ) : void { _handler = value; if( value != null ) { isHandlerInitialized = true; if( isHandlerInitialized isSourceInitialized ) { callHandler(); } } } override public function get source() : Object { return _source; } public function set source( value : Object ) : void { if (_source != null){ _source.removeEventListener(CollectionEvent.COLLECTION_CHANGE,collectionChangeHandler); } _source = value; _source.addEventListener(CollectionEvent.COLLECTION_CHANGE,collectionChangeHandler); isSourceInitialized = true; if( isHandlerInitialized isSourceInitialized ) { callHandler(); } } protected override function callHandler() : void { try { handler.call( null, source ); } catch( e : Error ) { delay( e ); } } protected override function delay( e : Error ) : void { UIComponent( Application.application ).callLater( throwException, [ e ] ); } private function throwException( e : Error ) : void { throw e; } private function collectionChangeHandler (event:Event) : void { callHandler(); } } } cheers, Dennis --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Never used Observe, but if it implements IMXMLObject or you subclass and do so, then you can use it in MXML From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Richard Rodseth Sent: Wednesday, August 13, 2008 4:16 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Observing collections For some reason I have an aversion to adding event listeners in ActionScript, favouring binding expressions and the Observe tag from Adobe Consulting. Not sure how rational this is, but there you have it. Binding is just so damn elegant. However, collections are a problem. It seems that so often you want to update something if either the collection itself or its contents changes, and you don't really care about the details of the change. I suppose if you're a DataGrid watching its dataprovider you do care and can minimize updates, but in many of the use cases I've encountered, that's not the case - my observer is going to do something with the whole collection (or maybe I've just been lazy about exploiting possible optimizations). Is there anything like the Observe tag that can be instantiated in MXML and can trigger a function call on a COLLECTION_CHANGE event?
[flexcoders] Must call super.commitProperties at END of overrided commitProperties when extending TitleWindow?
I don't think I've seen anything like this before and maybe I'm just going crazy. I've got a class that extends TitleWindow, it has a few setters and some of these can affect what the displayed title should be. These all use invalidation flags and don't get fully committed until commitProperties. If I call super.commitProperties() at the beginning of my commitProperties function, and then change the title somewhere else in that function, the title NEVER gets commited. I've stepped through the code and I really can't see why. There are only two places in Panel.as that modify _titleChanged. I see it getting flipped to true in the setter, then when commitProperties gets around to executing, the flag is magically false? Anyways, if I call super.commitProperties after I do all my work and possibly modify the title, everything is fine, except it looks really whacky because I've had it ingrained for years that you always call super class functions at the beginning... A subclass of TitleWindow as simple as this exhibits the behavior: ?xml version=1.0 encoding=utf-8? mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=400 height=300 mx:Script ![CDATA[ override protected function commitProperties():void { super.commitProperties(); title = ljsdflksjdflkj; } ]] /mx:Script /mx:TitleWindow
Re: [flexcoders] Must call super.commitProperties at END of overrided commitProperties when extending TitleWindow?
it should have still updated on the next invalidation pass because in Panel.as my call to set title sets _titleChanged = true, which should cause that logic block to execute in the next commitProperties. Maybe I was off in debugging and never hit another invalidation pass. This does bring up a point about the invalidation mechanism however. Because I really shouldn't know which properties are handled with invalidation flags in a class I'm extending, I should always put the call to super.commitProperties at the end of my commitProperties functions just in case something in that function changes a property that calls invalidateProperties. I definitely don't want to rely on another frame calling invalidateProperties as it may never happen and I can't control when it happens. What if a function call in commitProperties ends up dispatching an event and some handler code executes that modifes title or some other code handled by an invalidation flag. Only way to guarantee all those changes are picked up is to call super after my code executes, which still looks bizarre to me. On Wed, Aug 6, 2008 at 6:44 PM, Josh McDonald [EMAIL PROTECTED] wrote: The title property is simply a property that gets passed to the title UIComponent in commitproperties. Timeline: 1. You call super.commitProperties() 2. super.commitProperties() sees that this._title hasn't changed since the last commitProperties(). so doesn't set _myTitleComponent.title (or _titleLabel.text, whatever, but you get the idea) 3. You change this.title to Boo! 4. super.set title() sets this._title = Boo! 5. super.set title() calls invalidateProperties() 6. Flex realises you're already inside this.commitProperties for the instance in question, and ignores the invalidateProperties(). - If it didn't, you'd get an endless loop. Result: The title on screen doesn't get updated in this validate properties phase. Next time your commitProperties gets run, when you call this.title = Boo! it checks, realises that this._title *already* equals Boo!, so it never marks the _title property as changed, so super.commitProperties() never bothers to update _myTitleComponent.title Result: It *never* makes it to the screen. -Josh On Thu, Aug 7, 2008 at 9:25 AM, Daniel Gold [EMAIL PROTECTED] wrote: I don't think I've seen anything like this before and maybe I'm just going crazy. I've got a class that extends TitleWindow, it has a few setters and some of these can affect what the displayed title should be. These all use invalidation flags and don't get fully committed until commitProperties. If I call super.commitProperties() at the beginning of my commitProperties function, and then change the title somewhere else in that function, the title NEVER gets commited. I've stepped through the code and I really can't see why. There are only two places in Panel.as that modify _titleChanged. I see it getting flipped to true in the setter, then when commitProperties gets around to executing, the flag is magically false? Anyways, if I call super.commitProperties after I do all my work and possibly modify the title, everything is fine, except it looks really whacky because I've had it ingrained for years that you always call super class functions at the beginning... A subclass of TitleWindow as simple as this exhibits the behavior: ?xml version=1.0 encoding=utf-8? mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=400 height=300 mx:Script ![CDATA[ override protected function commitProperties():void { super.commitProperties(); title = ljsdflksjdflkj; } ]] /mx:Script /mx:TitleWindow -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Must call super.commitProperties at END of overrided commitProperties when extending TitleWindow?
I definitely put a HUGE comment when moving that call to super to the end of commitProperties, with a note that I should look into refactoring things to not set any properties in commit. It may have been the only comment I wrote this year. My logic was that I WAS propagating changes in commitProperties, and one of those changes had the effect of modifying a property of the super class, which just didn't cross my mind as being problematic at the time. The title of this window was a combination of different properties, and rather than calling updateTitle() in each setter, I decided it made the most sense to do that in commitProperties so I could catch if any of the properties changed and have only a single location calling that function. I slowly try to migrate older, or more rapidly developed components to the invalidation mechanism, but run into problems when it's at the franken-stage where it's half MXML with bindings, and half invalidation flags and commitProperties. Problem being that the setter will fire bindings, but the change won't be fully propagated everywhere it needs to and I get some null or some unexpected value that is only half right and gets updated in the next frame after commitProperties makes a change and causes other bindings to fire. Maybe someday I'll write perfect by the book code from the get go. On Wed, Aug 6, 2008 at 9:35 PM, Alex Harui [EMAIL PROTECTED] wrote: Well, I said you were strict and not wrong. I've heard others say that super always should be the first thing in an override, but to me, that means that an override can only add or re-do and not intercept, which is, IMHO, a valid thing to do for an override. If you're that worried about whether you forgot or even intended to call super, a comment might be in order. Gordon likes comments whenever we deviate from a pattern like add a listener in capture phase. Sometimes I actually put them in. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Josh McDonald *Sent:* Wednesday, August 06, 2008 6:31 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Must call super.commitProperties at END of overrided commitProperties when extending TitleWindow? I guess :) I just *really* don't like a situation where the position of super.whatever() affects whether or not it works. Frankly If I were designing a language super.foo() would be the default, and there'd be a keyword to block it. If super.commitProperties() can be expected to be anywhere inside a method, you can no longer at a quick glance tell whether or not it's called at all. The point I think is that commitProperties() is ideally (correct me if I'm wrong) for propagating any changed properties on this into their actual destinations, and deciding whether or not you need to schedule an updateDisplayList() or measure(). Doing anything else, such as changing said properties should be done where it makes more sense. The idea is that all the property changes generated by any events dispatched in the last frame are already completed by the time you get to commitProperties(). And changing properties inside commitProperties() invalidates this. It seems to me that whoever decided to ignore invalidateProperties() within commitProperties() thought something similar. That's probably an arrogant assumption to make, but I'm a jerk like that some times :) Somebody else in 6 months could see super.foo() at the end of your method, and because it's not in line with the rest of the project, move it back up the top - who knows how long it'll be before somebody notices that under certain circumstances the titles on your CustomPanel aren't what they should be any more? -Josh On Thu, Aug 7, 2008 at 11:15 AM, Alex Harui [EMAIL PROTECTED] wrote: Man, you are strict! There is no reason you can't do work in your override before calling super.whatever() -- * * -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Is it possible to put a custom component inside itself?
Sure, as long as you hit your base case and the constructor actually returns for the last one you create you'll be fine. Just to test and prove the logic to yourself, create a static class variable and decrement it each time you create a new one, check it in the constructor if its 0 declare a new instance and that will be your base case. You should have a hierarchical component where each instance has one child, that has a childwith a depth equal to whatever your static var was initialized to. On Mon, Aug 4, 2008 at 2:51 PM, Amy [EMAIL PROTECTED] wrote: Hi, all; I want to create a component that is recursive, but I'm not sure whether it's possible to create an instance of a component inside the definition of that component. Does anyone have any examples of doing recursion in a Flex component? I started out trying to modify RandomWalk, but it looks like I'd have to change a lot of logic in a lot of places to get it to work (plus it isn't truly recursive), and my time frame is too short for trying to root through and find everything I'd need to change. Thanks; Amy
Re: [flexcoders] Re: How to temporarily stop a dataProvider from updating UI
AddItem(name:String):void { var now:Number = (new Date()).getTime(); if (m_autoUpdateEnabled (now - m_lastAdd 300)) { gridData.disableAutoUpdate(); m_autoUpdateEnabled = false; setTimeout(flushAddQueue, 500); } m_lastAdd = now; [Then call the add function, which puts items into the 0th group] } private function flushAddQueue():void { if (!m_autoUpdateEnabled ((new Date()).getTime() - m_lastAdd 300)) { gridData.enableAutoUpdate(); m_autoUpdateEnabled = true; } else setTimeout(flushAddQueue, 500); } Thanks for all your help so far! --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com , Daniel Gold danielggold@ wrote: I've seen a lot of posts with performance related to using Bindable Collections like that. One of the dangerous of having such a useful easy API for updating controls... Just to expand on what Alex is suggesting, suppose your service call returns to a function called updateData, and your control is bound to a _data ArrayCollection public function updateData(newData:IList):void { var newData:Array =[]; for each(var data:Object in IList) { _newData.push(data); } _data.source = newData; _data.refresh(); } That's an extremely basic code example, and actually unnecessary to loop like that in most cases, but basic principle is get your data structured in an Array or similar structure, add new items, remove old unnecessary items, whatever you need to do, concat or replace the source Array of your ArrayCollection, and then call refresh which will dispatch a COLLECTION_CHANGE event which will trigger any controls using it as a dataProvider to update. On Thu, Jul 31, 2008 at 6:47 PM, Alex Harui aharui@ wrote: There is enable/disableAutoUpdate, but adding rows one at a time is inefficient. Just concat the two arrays and replace the dataprovider -- *From:* flexcoders@yahoogroups.comflexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com ] *On Behalf Of *whatabrain *Sent:* Thursday, July 31, 2008 3:23 PM *To:* flexcoders@yahoogroups.comflexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com *Subject:* [flexcoders] How to temporarily stop a dataProvider from updating UI I've found that adding a lot of rows (1000+) to an AdvancedDataGrid can be quite slow, if the rows happen to be visible (in an open node of the tree). I don't know why this is the case, especially since it's not the case in a regular DataGrid, but I'd like to work around it. So how can I tell the AdvancedDataGrid to temporarily ignore updates to the dataProvider? Once the large number of rows have been added, I'll turn the automatic updating back on, for the slow trickle of updates that come after that.
Re: [flexcoders] How to block user interaction?
Whenever I need to do this I usually put up a loading screen that covers the entire screen or the section of the screen pertaining to the loading data. This can be done a number of ways such as a full screen Popup, a modal popup thats just a Loading... label, etc. On Thu, Jul 31, 2008 at 5:40 PM, wwwpl [EMAIL PROTECTED] wrote: I want to block user interaction while I am waiting for an http service to return with data. Is there a nice easy way to do this?
Re: [flexcoders] Re: Load Complete on tilelist
Not to mention that the itemRenderers created probably won't be created and available in the same frame as the result from the service. Since the Image controls are in an ItemRenderer, you should probably listen for Complete as Alex said, and then dispatch a new Event that bubbles so you can listen on the TileList for that event. I was going to suggest counting your data items in the dataProvider and then counting down each time your custom event handler is called, but if the TileList can scroll you only want to listen for as many itemRenderers as the control created. Unless there's a much easier way... Whats the effect you're trying to achieve by ensuring all the images have been loaded? I've seen a lot of TileLists with Image renderers that fade in after being loaded. On Thu, Jul 31, 2008 at 2:35 PM, Alex Harui [EMAIL PROTECTED] wrote: I assumed the images were also being externally loaded in response to the result from the server -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *zyzzx00_99 *Sent:* Thursday, July 31, 2008 11:17 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Re: Load Complete on tilelist Really? Why can't you just use the result event and set result=functionName on HTTPService? --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: You'l lhave to write that method yourself. Listen for complete events from the image controls From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of David Gironella Sent: Thursday, July 31, 2008 5:36 AM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Load Complete on tilelist I have a tilelist with a dataprovider from an httpservice. I each item render I load an image. Exists some method to know when all images are complete loaded? I can use some events on tilelist to know this. Thanks. Giro.
Re: [flexcoders] How to block user interaction?
My preferred schmancy approach is to put up a full screen loading component that is so visually intensive that it requires it's own loading screen that is just slightly less schmancy. Isn't recursion fun? On Thu, Jul 31, 2008 at 6:41 PM, Rick Winscot [EMAIL PROTECTED]wrote: The method Daniel suggests is essentially the same that is used within components when enabling/disabling. When disable is called – the component throws up a 'blocker' that prevents interaction with the control. So... You could use the default component behavior of calling enabled=false (at a high level in the app) or do something all fancy schmancy like Daniel. I've used both... I just like poking fun at fellow Flexcoders and using the word 'schmancy.' Rick Winscot On 7/31/08 7:28 PM, Daniel Gold [EMAIL PROTECTED] wrote: Whenever I need to do this I usually put up a loading screen that covers the entire screen or the section of the screen pertaining to the loading data. This can be done a number of ways such as a full screen Popup, a modal popup thats just a Loading... label, etc. On Thu, Jul 31, 2008 at 5:40 PM, wwwpl [EMAIL PROTECTED] wrote: I want to block user interaction while I am waiting for an http service to return with data. Is there a nice easy way to do this?
Re: [flexcoders] How to temporarily stop a dataProvider from updating UI
I've seen a lot of posts with performance related to using Bindable Collections like that. One of the dangerous of having such a useful easy API for updating controls... Just to expand on what Alex is suggesting, suppose your service call returns to a function called updateData, and your control is bound to a _data ArrayCollection public function updateData(newData:IList):void { var newData:Array =[]; for each(var data:Object in IList) { _newData.push(data); } _data.source = newData; _data.refresh(); } That's an extremely basic code example, and actually unnecessary to loop like that in most cases, but basic principle is get your data structured in an Array or similar structure, add new items, remove old unnecessary items, whatever you need to do, concat or replace the source Array of your ArrayCollection, and then call refresh which will dispatch a COLLECTION_CHANGE event which will trigger any controls using it as a dataProvider to update. On Thu, Jul 31, 2008 at 6:47 PM, Alex Harui [EMAIL PROTECTED] wrote: There is enable/disableAutoUpdate, but adding rows one at a time is inefficient. Just concat the two arrays and replace the dataprovider -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *whatabrain *Sent:* Thursday, July 31, 2008 3:23 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] How to temporarily stop a dataProvider from updating UI I've found that adding a lot of rows (1000+) to an AdvancedDataGrid can be quite slow, if the rows happen to be visible (in an open node of the tree). I don't know why this is the case, especially since it's not the case in a regular DataGrid, but I'd like to work around it. So how can I tell the AdvancedDataGrid to temporarily ignore updates to the dataProvider? Once the large number of rows have been added, I'll turn the automatic updating back on, for the slow trickle of updates that come after that.
Re: [flexcoders] How to temporarily stop a dataProvider from updating UI
really? I thought controls like DataGrid listened for CollectionChange and thought swapping source only did an internal refresh without firing a COLLECTION_CHANGE. I do use Sorts and filterFunctions pretty often so maybe I'm way off base... And I tried to note that the loop was unneccessary, but most of the time there is some kind of processing or merging going on with the new source instead of just taking the array handed back. On Thu, Jul 31, 2008 at 7:06 PM, Alex Harui [EMAIL PROTECTED] wrote: Yeah, that's basically it. If you have an IList you can just call toArray() and concat it to any existing array of data. You shouldn't have to call refresh unless there is a sort or filter applied. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Daniel Gold *Sent:* Thursday, July 31, 2008 5:02 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] How to temporarily stop a dataProvider from updating UI I've seen a lot of posts with performance related to using Bindable Collections like that. One of the dangerous of having such a useful easy API for updating controls... Just to expand on what Alex is suggesting, suppose your service call returns to a function called updateData, and your control is bound to a _data ArrayCollection public function updateData(newData:IList):void { var newData:Array =[]; for each(var data:Object in IList) { _newData.push(data); } _data.source = newData; _data.refresh(); } That's an extremely basic code example, and actually unnecessary to loop like that in most cases, but basic principle is get your data structured in an Array or similar structure, add new items, remove old unnecessary items, whatever you need to do, concat or replace the source Array of your ArrayCollection, and then call refresh which will dispatch a COLLECTION_CHANGE event which will trigger any controls using it as a dataProvider to update. On Thu, Jul 31, 2008 at 6:47 PM, Alex Harui [EMAIL PROTECTED] wrote: There is enable/disableAutoUpdate, but adding rows one at a time is inefficient. Just concat the two arrays and replace the dataprovider -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *whatabrain *Sent:* Thursday, July 31, 2008 3:23 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] How to temporarily stop a dataProvider from updating UI I've found that adding a lot of rows (1000+) to an AdvancedDataGrid can be quite slow, if the rows happen to be visible (in an open node of the tree). I don't know why this is the case, especially since it's not the case in a regular DataGrid, but I'd like to work around it. So how can I tell the AdvancedDataGrid to temporarily ignore updates to the dataProvider? Once the large number of rows have been added, I'll turn the automatic updating back on, for the slow trickle of updates that come after that.
Re: [flexcoders] How to temporarily stop a dataProvider from updating UI
Hmmm, thanks for the reality check. I refreshed myself on the ListCollectionVIew source, remembered the dispatch boolean being passed in as false in reset but must have overlooked the dispatchResetEvent bit. In reading I did notice this bit: if (sort) { sort.sort(localIndex); dispatch = true; } And after a quick test looks like I don't even need to be calling refresh when there's a sort applied as the internalRefresh function is handling it. Any quick tips on when refresh() actually needs to be called? Definitely don't want to be forcing controls to run their update code twice... On Thu, Jul 31, 2008 at 7:14 PM, Alex Harui [EMAIL PROTECTED] wrote: Should dispatch COLLECTION_CHANGE with RESET. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Daniel Gold *Sent:* Thursday, July 31, 2008 5:10 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] How to temporarily stop a dataProvider from updating UI really? I thought controls like DataGrid listened for CollectionChange and thought swapping source only did an internal refresh without firing a COLLECTION_CHANGE. I do use Sorts and filterFunctions pretty often so maybe I'm way off base... And I tried to note that the loop was unneccessary, but most of the time there is some kind of processing or merging going on with the new source instead of just taking the array handed back. On Thu, Jul 31, 2008 at 7:06 PM, Alex Harui [EMAIL PROTECTED] wrote: Yeah, that's basically it. If you have an IList you can just call toArray() and concat it to any existing array of data. You shouldn't have to call refresh unless there is a sort or filter applied. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Daniel Gold *Sent:* Thursday, July 31, 2008 5:02 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] How to temporarily stop a dataProvider from updating UI I've seen a lot of posts with performance related to using Bindable Collections like that. One of the dangerous of having such a useful easy API for updating controls... Just to expand on what Alex is suggesting, suppose your service call returns to a function called updateData, and your control is bound to a _data ArrayCollection public function updateData(newData:IList):void { var newData:Array =[]; for each(var data:Object in IList) { _newData.push(data); } _data.source = newData; _data.refresh(); } That's an extremely basic code example, and actually unnecessary to loop like that in most cases, but basic principle is get your data structured in an Array or similar structure, add new items, remove old unnecessary items, whatever you need to do, concat or replace the source Array of your ArrayCollection, and then call refresh which will dispatch a COLLECTION_CHANGE event which will trigger any controls using it as a dataProvider to update. On Thu, Jul 31, 2008 at 6:47 PM, Alex Harui [EMAIL PROTECTED] wrote: There is enable/disableAutoUpdate, but adding rows one at a time is inefficient. Just concat the two arrays and replace the dataprovider -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *whatabrain *Sent:* Thursday, July 31, 2008 3:23 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] How to temporarily stop a dataProvider from updating UI I've found that adding a lot of rows (1000+) to an AdvancedDataGrid can be quite slow, if the rows happen to be visible (in an open node of the tree). I don't know why this is the case, especially since it's not the case in a regular DataGrid, but I'd like to work around it. So how can I tell the AdvancedDataGrid to temporarily ignore updates to the dataProvider? Once the large number of rows have been added, I'll turn the automatic updating back on, for the slow trickle of updates that come after that.
Re: [flexcoders] How to block user interaction?
Yes I did...with hopefully more than a hint of dry humor about a recursively less intensive loading screen... On Thu, Jul 31, 2008 at 7:31 PM, Doug McCune [EMAIL PROTECTED] wrote: did you just say your loading screen has a loading screen? my head just exploded On Thu, Jul 31, 2008 at 4:54 PM, Daniel Gold [EMAIL PROTECTED]wrote: My preferred schmancy approach is to put up a full screen loading component that is so visually intensive that it requires it's own loading screen that is just slightly less schmancy. Isn't recursion fun? On Thu, Jul 31, 2008 at 6:41 PM, Rick Winscot [EMAIL PROTECTED]wrote: The method Daniel suggests is essentially the same that is used within components when enabling/disabling. When disable is called – the component throws up a 'blocker' that prevents interaction with the control. So... You could use the default component behavior of calling enabled=false (at a high level in the app) or do something all fancy schmancy like Daniel. I've used both... I just like poking fun at fellow Flexcoders and using the word 'schmancy.' Rick Winscot On 7/31/08 7:28 PM, Daniel Gold [EMAIL PROTECTED] wrote: Whenever I need to do this I usually put up a loading screen that covers the entire screen or the section of the screen pertaining to the loading data. This can be done a number of ways such as a full screen Popup, a modal popup thats just a Loading... label, etc. On Thu, Jul 31, 2008 at 5:40 PM, wwwpl [EMAIL PROTECTED] wrote: I want to block user interaction while I am waiting for an http service to return with data. Is there a nice easy way to do this?
Re: [flexcoders] Determine client performance (not with any accuracy)?
Hmmm, a framework for that could be pretty interesting. Have the ability to specify certain sections of code/certain components as optional based on a current performance metric. As far as metering, could be as simple as listening to ENTER_FRAME and taking timestamps to determine how long each frame is taking to render/process. Then setting state on an application performance model that views could bind to and tone themselves down appropriately... On Thu, Jul 31, 2008 at 8:58 PM, Josh McDonald [EMAIL PROTECTED] wrote: Hey guys, I'm probably going to be embarking on a project soon that can be very graphically (and hence processor) intensive, and I'd like to know if there's anything out there to help me determine performance in order to tweak things to have less detail if it's going slowly, and more if it's not. Or even to switch from the PPV3D to a simpler 2d scaling based approach on slower systems. Any ideas? -Josh -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Sorting an XMLList on an attribute
As I understand it, the collections APIs like XMLListCollection and ArrayCollection don't reorder their source lists at all, they just modify the way the lists are iterated over to return data in the requested order. So wrapping an Array in an ArrayCollection, adding a sort, and then trying to hand the sorted source Array off to someone else won't work, you have to wrap it, add sort, and then call .toArray() on the collection to return a new Array containing the same elements in sorted order. On Wed, Jul 30, 2008 at 3:22 PM, Alex Harui [EMAIL PROTECTED] wrote: XMLList doesn't support Sort -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *gaurav1146 *Sent:* Tuesday, July 29, 2008 11:58 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Sorting an XMLList on an attribute Hi, I am trying to sort an XMLList based on one of the attributes in the XML node. On trying this I get the following error: TypeError: Error #1089: Assignment to lists with more than one item is not supported. Instead of XMLList if I use XMLListCollection it works fine. The thing is that I have used XMLList at lot of other places in my code as well so I cannot easily switch to XMListCollection. I would be prefer a way if I could sort the XMLList somwehow. Following is the sample code that I tried for the sorting difference between XMLList amd XMLListCollection: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.collections.XMLListCollection; import mx.collections.SortField; import mx.collections.Sort; private var books:XML = books book publisher=Addison-Wesley name=Design Patterns / book publisher=Addison-Wesley name=The Pragmatic Programmer / book publisher=Addison-Wesley name=Test Driven Development / book publisher=Addison-Wesley name=Refactoring to Patterns / book publisher=O'Reilly Media name=The Cathedral the Bazaar / book publisher=O'Reilly Media name=Unit Test Frameworks / /books; // This does not work. /* [Bindable] private var booksList:XMLList = books.children(); */ [Bindable] private var booksList:XMLListCollection = new XMLListCollection(books.children()); private function sortBooks():void { var s:Sort = new Sort(); s.fields = [new SortField(@name)]; booksList.sort = s; booksList.refresh(); tree.dataProvider = booksList; } ]] /mx:Script mx:VBox mx:Tree id=tree dataProvider={booksList} labelField=@name/ mx:Button click=sortBooks() label=Sort books/ /mx:VBox /mx:Application
Re: [flexcoders] Execute click programmatically
are you using the MouseEvent in the event handler? If not, default that parameter and just call the function directly private function clickHandler(event:MouseEvent=null):void { } private function otherFunction():void { clickHandler(); } On Tue, Jul 29, 2008 at 8:30 PM, markgoldin_2000 [EMAIL PROTECTED]wrote: If I have a click listener on DG's cell can I execute cell's click programmatically, something like: cellObject.click() or somehow else to excute listener? Thanks
Re: [flexcoders] Measurement and scrolling
I'm surprised we don't hear more public complaints about how Flex deals with scrollbars and not resizing children when a scrollbar is added, ESPECIALLY if the children are relatively laid out. The last large project I worked on we got so tired of adding fudge factor padding for the vertical scrollbar so there would be no need for a horizontal scrollbar that we monkey-patched Container.as to take the scrollbars into account when sizing children. Didn't see a huge performance hit in doing this and I'm pretty sure everyone cheered the first time a container was resized, started scrolling vertically, and resized its children to compensate without adding a horizontal scrollbar. On Wed, Jul 23, 2008 at 8:55 AM, Josh McDonald [EMAIL PROTECTED] wrote: It's something I keep needing, so very soon I'm going to cook up an example of a one-child-only container that will behave the way I think they should regarding vertical scrollbars. Will post a link :) -Josh On Wed, Jul 23, 2008 at 11:12 PM, Richard Rodseth [EMAIL PROTECTED] wrote: Yes, but that doesn't look so good and wastes real estate. I think I can live with the overlay, given the padding I have. On Wed, Jul 23, 2008 at 12:15 AM, Alex Harui [EMAIL PROTECTED] wrote: If you set verticalScrollPolicy=on then the scrollbars will be factored in From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh McDonald Sent: Tuesday, July 22, 2008 10:13 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Measurement and scrolling The only way to not have scrollbars over the content (or to only have vertical, but not all the time) is to do scrollbar management yourself rather than relying on Flex's inbuilt methods of handling it. This is a decision made by the Flex team to avoid having to double measure() stuff when adding scrollbars to a container. -Josh On Wed, Jul 23, 2008 at 3:02 PM, Richard Rodseth [EMAIL PROTECTED] wrote: Below is code for a scrolling container of one child - a highly simplified version of the tiling container I've been wrestling with off and on for way too long now. The component below sizes the first/only child to fit within it, with some padding, but respects the minimums of the child, adding scroll bars if necessary. I discovered this evening that setting measuredMinWidth/Height in the measure() method was what was messing things up. With that removed, this component (and the more complex tiler) behaves properly, except that the scollbars are drawn over the right/bottom padding. What is the appropriate way to compensate for that? Adding a fudge factor to the measured values, or removing it from the value passed to setActualSize in UDL had no effect at all. Thanks, I'm *really* close now... - Richard public class MyContainer extends Container { private static const PADDING:Number = 10; public function MyContainer() { super(); } override protected function measure():void { var child:UIComponent = this.getChildren()[0] as UIComponent; var childWidth:Number = child.getExplicitOrMeasuredWidth(); var childHeight:Number = child.getExplicitOrMeasuredHeight(); measuredWidth = childWidth + 2 * PADDING ; measuredHeight = childHeight + 2 * PADDING ; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); var child:UIComponent = this.getChildren()[0] as UIComponent; var newWidth:Number = Math.max(unscaledWidth - (2 * PADDING) , child.minWidth); var newHeight:Number = Math.max(unscaledHeight - (2 * PADDING) , child.minHeight); child.setActualSize(newWidth, newHeight); child.move(PADDING, PADDING); } } } ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute minHeight=0 minWidth=0 verticalScrollPolicy=off horizontalScrollPolicy=off xmlns:comp=comp.* comp:MyContainer width=95% height=95% borderStyle=solid horizontalScrollPolicy=auto verticalScrollPolicy=auto mx:Button label=400x400 minWidth=400 minHeight=400/ /comp:MyContainer /mx:Application -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Re: [flexcoders] attaching one instance of a displayobject to multiple containers
A display object can only have a single parent, so you will have to have two instances. On Mon, Jul 21, 2008 at 3:31 PM, blc187 [EMAIL PROTECTED] wrote: Is there a way to attach a displayobject to more than one container? I have a canvas that I instantiated and drew onto, but I want to attach it onto two separate containers without having 2 separate instances of it. When I do this: var obj:MyCanvas = new MyCanvas(); container1.addChild(obj); container2.addChild(obj); it only shows up as attached to the second container. How can I attach it to two without having to instantiate two versions of it?
Re: [flexcoders] arrayCollection event COLLECTION_CHANGE issues?
You're initializing the acUser collection when the singleton is created and adding a listener, which is fine. However, when you're getting the results back, you're changing the acUser collection reference to a different ArrayCollection GlobalVars.instance.acUser = event.result as ArrayCollection; So your singleton still has a listener registered on the original ArrayCollection, but your singleton model now contains a reference to the new ArrayCollection returned from the service. To keep your references pointing to the same ArrayCollection and still get the COLLECTION_CHANGE, you could play games like this: GlobalVars.instance.acUser.source = ArrayCollection(event.result).source; GlobalVars.instance.acUser.refresh(); In that you're swapping out the underlying Array the collection is wrapped around, and then calling refresh will dispatch teh COLLECTION_CHANGE, firing any bindings and calling your listener code. On Thu, Jul 17, 2008 at 8:43 AM, Scott [EMAIL PROTECTED] wrote: First thanks for all your help guys. I'm making nice strides learning this language quickly. I'm working with events now. I created an arrayCollection to capture a query from coldfusion. I have the data being dumped into this variable just fine (I can do a combobox on it and see all of it). Now what I want to do is set some variables based on these items. I created an event to watch the arrayCollection which would run a function to reset the variables automatically. Here's what I did: This is all within a singleton class… Created the [Bindable]acUser array collection [Bindable] public var acUser:ArrayCollection = new ArrayCollection(); Created an init() function to set up the event handler: *private* *function* init():*void* { acUser.addEventListener(CollectionEvent.COLLECTION_CHANGE, acUser_collectionChange); } Created a function to set the variables if the event hit: *private* *function* acUser_collectionChange(event:CollectionEvent): *void* { strEMail = ObjectUtil.toString(acUser.getItemAt(0).strEMail); (not sure if this call is correct –yet-) *trace*(strEMail); } Modified the header for the page to run the init() function mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=init() xmlns=* xmlns:controllers=com.cfgenerated.controllers.* xmlns:login=com.cfgenerated.views.login.* layout=absolute currentState=NotLoggedIn This should be all I need to do, right? When I push the data into the singleton: GlobalVars.instance.acUser = event.result as ArrayCollection; The event does not fire. Any ideas? TIA!
Re: [flexcoders] Transparent Application Background
Are you wanting the application to be transparent as in showing what's 'under' it on a page? If so have fun. I've seen Flash ads do this on websites and it looks like they actually discern the bitmap data for that section of the page and use that as the background. If you see one of these ads you'll notice you can't click on anything in the 'transparent' area. I haven't put any effort into it but seems like a pain. On Wed, Jul 16, 2008 at 8:48 AM, ammu nath [EMAIL PROTECTED] wrote: Hi All, Can any body help me how can i achive Transparent Application background in a flex application overriding the befault color? Thanks Amar -- Save all your chat conversations. Find them online.http://in.rd.yahoo.com/tagline_webmessenger_3/*http://in.messenger.yahoo.com/webmessengerpromo.php
Re: [flexcoders] DataGrid Header Styles
That seems like over kill for such a simple thign Welcome to Flex! I can never get the textRollOverColor to work on the header. Here's a stab at a simple renderer that just grabs the textRollOverColor style from the DataGrid ?xml version=1.0 encoding=utf-8? mx:Label text={_listData.label} xmlns:mx=http://www.adobe.com/2006/mxml; width=100% height=100% implements=mx.controls.listClasses.IDropInListItemRenderer mouseOver=onMouseOver() mouseOut=onMouseOut() mx:Script ![CDATA[ import mx.controls.DataGrid; import mx.controls.listClasses.BaseListData; import mx.controls.List; [Bindable] private var _listData:BaseListData; override public function get listData():BaseListData { return _listData; } override public function set listData(value:BaseListData):void { _listData = value; } private function onMouseOver():void { setStyle(color,DataGrid(_listData.owner).getStyle(textRollOverColor)); } private function onMouseOut():void { setStyle(color,DataGrid(_listData.owner).getStyle(color)); } ]] /mx:Script /mx:Label On Tue, Jul 15, 2008 at 1:27 PM, Dan Vega [EMAIL PROTECTED] wrote: Just to change text styles? That seems like over kill for such simple thing Dan On Tue, Jul 15, 2008 at 2:04 PM, Alex Harui [EMAIL PROTECTED] wrote: You may need to create custom header renderers. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Dan Vega *Sent:* Tuesday, July 15, 2008 8:40 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] DataGrid Header Styles I have some custom styles for my datagrid that apply to all datagrids. My problem is that the rows of the grid get a rollover color close to black and the text is white. The problem is with the header. When I roll over the header the background color is black but so is the text so I can not tell what the text says. Also the arrows are black so you never see those. Is there a way to customize all of this or just tell the header to act normal (don't apply styles)? DataGrid { textRollOverColor:#ff; rollOverColor:#242424; selectionColor:#242424; textSelectedColor:#ff; headerStyleName: dataGridHeader; } .dataGridHeader { textRollOverColor:#FF; } Thank You Dan Vega [EMAIL PROTECTED] http://www.danvega.org
Re: [flexcoders] Flex, Cairngorm callback function
I've worked on two fairly large Flex projects at two different jobs and we had a Cairngorm callback pattern similar to UMs as well (before the UM extensions were released) In my mind I justify it as still being fairly decoupled. The view is creating the event and stuffing in parameters anyways, so why shouldn't a callback be one of those? Sometimes the view that dispatched the event needs to know whether it faulted or succeeded to change state appropriately, and I just don't see a reason to shove that in a model somewhere. In one the projects we had a tabbed-based application where tabs could be spawned by users. I would have to have a dictionary of view states in the model or something similar, and it just seemed like it was jumping through an unnecessary hoop. It would still have been data specific to that tab instance, so it didn't seem 'wrong' to just specify a callback anytime those tabs dispatched a Cairngorm Event The command/model/delegates still have no intimate knowledge of the view, the base command class just checks to see if a callback function was specified and calls it after it finishes its other work. On Mon, Jul 14, 2008 at 9:48 PM, Josh McDonald [EMAIL PROTECTED] wrote: I've been doing something similar to the UM callbacks in projects at work, and it does tie your code a little closer to the framework than some people like, and the base event class annoys a few people. It's not a problem for us, because we're using an in-house framework (parts of which will be OSS in the near future), but it rubs some people the wrong way. I'd like to know if there's any other nicer (coupling-wise) method people are using in order to be notified of completion / failure of whatever action a view kicks off? -Josh -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Quickie: Round some container's corners
Sounds like he may want to choose which corners are rounded, an area where the framework is definitely lacking. I always look to Degrafa for advanced CSS skinning like that. Pick up the library here: http://code.google.com/p/degrafa/downloads/list Then you can create a css style like this: .roundedCornerStyle { borderSkin: ClassReference(com.degrafa.skins.CSSSkin); border-top-right-radius:4px; border-bottom-left-radius: 4px; } Then just apply that style to a component to get the rounded corners mx:Panel styleName=roundedCornerStyle / On Mon, Jul 14, 2008 at 6:17 PM, Alex Harui [EMAIL PROTECTED] wrote: cornerRadius? -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Leonardo Moreno *Sent:* Monday, July 14, 2008 2:28 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Quickie: Round some container's corners Hi I need to round just some corners of my containers, is there an easy way to achieve this? thanks in advance -- Leonardo Moreno Guzmán Ingeniero de sistemas y telemática | Asesor soluciones informáticas *cell-phone:* 311-3390386 *e-mail:* [EMAIL PROTECTED] leonardo.moreno%40gmail.com *site:* http://leo.logtar.com/profesional/
Re: [flexcoders] When not to use weak references?
I've hit a few places in the past and will attempt to drudge them up, but no warranties here. How about a case where you create a timer as a local variable in a function and add a weak listener. Since there are no strong references to the Timer I beilieve it is eligible for garbage colleciton, and I'm pretty sure I've seen that problem more than once. public function setTimer():void { var timer:Timer = new Timer(15000); timer.addEventListener(TimerEvent.TIMER,timerFired,false,0,true); } public function timerFired(event:TimerEvent):void { //May never get called because Timer could be garbage collected before firing } I think the safest way to do the above if you don't want to declare timer as a member variable of the class is to use a strong reference and clean it up public function setTimer():void { var timer:Timer = new Timer(15000); timer.addEventListener(TimerEvent.TIMER,timerFired); } public function timerFired(event:TimerEvent):void { event.target.removeEventListener(TimerEvent.TIMER,timerFired); //Yay! Should also make it here! } Typed that in GMail and unverified, as stated above, but may get the conversation started at least On Mon, Jul 14, 2008 at 11:28 PM, Josh McDonald [EMAIL PROTECTED] wrote: That's a really good question, and one I'd very much like to know the answer to as well :) On Tue, Jul 15, 2008 at 2:08 PM, Boon Chew [EMAIL PROTECTED] wrote: Hi all, I have read posts that preached the goodness of weak references for event listening, but have not read anything that suggests when you should use strong reference over the weak one, and the down side to using weak references. Any ideas when being weak is not bad thing? :) - boon __ -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] When not to use weak references?
I would agree that's not a best practice for writing timer code, just the quickest example I could think of. When people read about how bad strong references are and how they cause memory leaks, they tend to make EVERYTHING weak which can lead to some nasty problems. Since you can't control the timing or depend on garbage collection, 95% of the time the listener could get called, the other 5% the target object could be GCd before the listener ever runs. On Mon, Jul 14, 2008 at 11:49 PM, Josh McDonald [EMAIL PROTECTED] wrote: Why use weak references on singletons or things that are going to live the life of the application? Not saying it's wrong, just interested in the logic. The timer code above is a great example of when you need a strong reference, but a nasty example of how to use a timer! I *really* don't like the idea of the Timer instance only being available within the event handlers :) A listener will always get called if the object it's listening to is still around though right? Weak reference or no? -Josh On Tue, Jul 15, 2008 at 2:43 PM, Tim Rowe [EMAIL PROTECTED] wrote: Use strong references when you're adding an event listener to the same instance dispatching an event. If it's an anonymous function, you need to use a strong reference. Also, use strong references when you want speed – weak references are slower. Always use weak references when dealing with singletons (Cairngorm's event dispatcher is a singleton, hence, always use with Cairngorm), or objects that live the life of the application. This includes timers waiting on call backs also. Not always true but if you have an object you intend to never have destroyed, but it may also be perfectly safe to use strong references. Keep in mind though that using a weak reference on, say, an event listener where a strong one was required may result in things like that listener not getting called. I'm only new to Flex, but this is as I understand it, and no doubt I've missed a few things here and there. --Tim Rowe -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Boon Chew *Sent:* Tuesday, 15 July 2008 2:08 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] When not to use weak references? Hi all, I have read posts that preached the goodness of weak references for event listening, but have not read anything that suggests when you should use strong reference over the weak one, and the down side to using weak references. Any ideas when being weak is not bad thing? :) - boon -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Calling AS3 functions
All AS code needs to be inside the curly braces and you need to concatenate your static string to the string returned from your function mx:Text text={returnEmail() + ' is logged on'} / On Fri, Jul 11, 2008 at 7:06 PM, Scott [EMAIL PROTECTED] wrote: I'm working on a logon class in Flex 3. I've got a login.mxml which controls the overall views (logon/register/logout) all in the same box depending on what state the user is in. In the loginForm.mxml (included in the logon.mxml), I've got a function called protected returnName():String Function I want to call from the loginForm AS3 script: *protected* *function* returnName():String (I've also tried public in case it was not available in that area of code) { *return* *this*.username.text; } Snippet from my mxml code: Xmlns:login=com.ft.views.login.*; ... mx:State name=loggedIn mx:AddChild position=lastChild mx:Panel width=75% height=50% layout=vertical verticalScrollPolicy=off horizontalScrollPolicy=off mx:VBox width=100% height=100% verticalScrollPolicy=off horizontalScrollPolicy=off mx:Text text={returnEmail()} is logged on; / ß--- line in question login:LogoutForm logoutSuccessful=this.currentState='onLogin()'; / /mx:VBox /mx:Panel /mx:AddChild /mx:State I can't seem to figure out how to reference the method as I get the error: 1180: Call to a possibly undefined method returnName. I've tried: mx:Text text={loginForm.returnEmail()} is logged on; / mx:Text text={login.returnEmail()} is logged on; / Among many others… This is probably pretty simple. I really appreciate your help.
Re: [flexcoders] Stump the Flex Nerd: Getting reference to the set method of a property
What are you attempting to do with the reference to the setter? Maybe there's some other workaround since I haven't seen a way to get a reference to it, but also haven't really found a need to. On Wed, Jul 9, 2008 at 2:43 PM, Charlie Hubbard [EMAIL PROTECTED] wrote: Ok, I think I've got a pretty difficult question here. I want to the setter method given a string containing the name of a property. With normal methods I can always do something like obj.myFunction to get a reference to that function, then I can invoke that function with a func.call(). However, if you do obj.someProperty that calls the get method. I already tried obj[ propertyName ] which returned null so that's out. It's almost like you need another language feature. obj-property= and obj-property for ( reference to setter and getter of this property). Charlie
Re: [flexcoders] Re: mxml to swf on a J2EE server
I've started using velo's mojos to build with Maven. Working great so far and he seems to be working on it quite a bit. http://code.google.com/p/flex-mojos/ On Wed, Jul 9, 2008 at 3:49 PM, pankajtandon2003 [EMAIL PROTECTED] wrote: Thanks Douglas and Tracy! That was good information. Any idea if the Apache/IIS plugin is also as slow as LCDS is supposed to be (as per Doug's posting). I clearly ignored the ant task to do this step. I do agree it may be the better way to go instead of forking out the $$ for LCDS. Any suggestions for a good maven-plugin *that works* for doing this.. that compiles .mxmls to .swfs. I'm trying to avoid the antrun plugin if possible. Thanks guys! I'm warming to this flex thing :) Pankaj --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: I also seem to recall an Apache thing, hold on, ... yes, http://labs.adobe.com/wiki/index.php/Flex_Module_for_Apache_and_IIS http://labs.adobe.com/wiki/index.php/Flex_Module_for_Apache_and_IIS See if that is what you are looking for. Tracy From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Douglas Knudsen Sent: Wednesday, July 09, 2008 4:22 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Re: mxml to swf on a J2EE server On Wed, Jul 9, 2008 at 4:14 PM, pankajtandon2003 [EMAIL PROTECTED] mailto:pankajtandon%40gmail.com pankajtandon%2540gmail.com wrote: Thanks for the response Dimitrios. I guess I need to be more specific. I'm drawing a parallel between mxml file and a jsp file and I am trying to get the mxml file to compile *like* a jsp file. In a J2EE environment (say Tomcat), I write a jsp using custom jsp tags, ensure that the jar files that contain the TagLibs and the corresponding classes are in the class path of the server and when my server encounters a URL ending in .jsp, it knows to compile the .jsp into a servlet that then sends HTML in the response to the server. I am looking for a similar way to achieve this behavior when I write a .mxml file. Using Flex Builder as an eclipse plugin is great for unit testing where I can see the results of the swf in a browser launched from my IDE. However, how can I achieve this when I am using Tomcat. I thought LCDS was the way to achieve this. You have stated that that is not the case. In other words how can I get from a .mxml to a .swf (that my browser can display) in one step. OR.. is it necessary to do a two-step process, where I compile into a .swf and then bundle the swf with my J2EE artifact for deployment. If this is the case, then how can I supply a filename to my swf dynamically. The accepted way is to do this, yes. Use Ant to build your jars, swfs, etc ball them up and deploy away. Alternatively, you can use LCDS to 'compile on the fly' like a jsp, php, or cfm does. Flex 1.5 and earlier worked this way. It is *horribly* slow on first request though. Its called web-tier-compiler IIRC. Heck of a lot of cash to outlay just for this when you can compile in your standard build process. DK I hope I am clear..er now :) Thanks for your responses and patience! Pankaj --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com , Dimitrios Gianninas dimitrios.gianninas@ wrote: Hi, 1) You don't LCDS to compile stuff, you can pre-compile your Flex application by simply using the Flex SDK. It comes with the compiler. You can read about it here: http://livedocs.adobe.com/flex/3/html/compilers_01.html http://livedocs.adobe.com/flex/3/html/compilers_01.html 2) I dont completly understand this question is that in your Flex app you are trying to communicate with an HTTPService and you want to pass it the URL? Dimitrios Gianninas RIA Developer and Team Lead Optimal Payments Inc. From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto: flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com ] On Behalf Of pankajtandon2003 Sent: Wednesday, July 09, 2008 2:01 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto: flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com Subject: [flexcoders] mxml to swf on a J2EE server Hello, I'm trying to integrate a Flex app with a J2EE app. After reading up a little I determined that LifeCycle Data ES is what I would need to effect this. LifeCycle Data ES is what allows me to get data from the server
Re: [flexcoders] Why are icons typed as Classes and not just class factories?
Have a look at Ben Stucki's work, it may solve your icon problems. http://blog.benstucki.net/?p=42 As far as getting a class reference from an instance, you could use getQualifiedClassName on the instance to get the name, and then pass that to getDefinitionByName to get the class On Wed, Jul 9, 2008 at 5:15 PM, Troy Gilbert [EMAIL PROTECTED] wrote: Factories came late to the party and we couldn't retrofit everything. One of the things we wish we could do-over. Understood. Anyone done the dirty work of allowing dynamic classes to be created? Seems like it'd be entirely doable by generating the bytecode for a class, giving it a unique name, and de-serializing it with a ByteArray (kinda like the tricks folks employed for dynamic sounds in v9 player). Also, as a complete aside, if there a way to get the Class of an instance? I'm thinking something like this: var c:Class = ClassUtils.getClass(someVar); Troy.
Re: [flexcoders] Re: Can no longer quit my AIR app
Thanks for pointing me to that thread. I never suspected the updater but I did upgrade to AIR 1.1 and implemented the updater in the app in the same day. As stated above I'm currently having to use the same workaround of listening to the EXITING event and closing the open windows myself, I'll be looking for the updater patch. Thanks again. On Sat, Jul 5, 2008 at 9:46 AM, Paul Evans [EMAIL PROTECTED] wrote: On 2 Jul 2008, at 15:32, Daniel Gold wrote: I'm looking for potential culprits so I can file a well documented bug report. Are you using ApplicationUpdaterUI ? There's a thread here might be worth a read... http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=670threadid=1373568#5004519 Do let us know if the fix suggester there be Raul HUDEA helps rgds -- Paul Evans http://www.creative-cognition.co.uk/ http://blog.creacog.co.uk/
Re: [flexcoders] Re: Can no longer quit my AIR app
I'm looking for potential culprits so I can file a well documented bug report. This is only happening with AIR 1.1 it seems, and my AIR app is the only one I'm seeing it on. The keystrokes and menus are firing the correct events, but currently open windows are not being closed as the docs say. They claim in OS X when quit is selected from the application menu or the dock menu, the EXITING event will be dispatched and all windows will be closed as long as noone prevents the default behavior. Well that event is being dispatched, I'm tracing it to make sure I caught it, not doing anything else with it, and my windows just sit there still open on the screen. What I'm doing as as workaround in the meantime is catching the event and then manually calling close() on all the open windows, I have autoExit enabled so this restores the desired behavior of exiting the application. On Wed, Jul 2, 2008 at 9:18 AM, Simon Bailey [EMAIL PROTECTED] wrote: I hate to state a potential obvious one here but have you got Num Lock on, this I remember prevents using short cut keys? Cheers, Simon On 2 Jul 2008, at 15:04, valdhor wrote: Maybe you can add an event listener to the stage and look at keystrokes. If someone presses Apple-Q, dispatch a click event to the close box of the main window. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote: AIR updated itself this morning, and now it seems I can no longer quit an app I'm developing using Apple-Q on my Mac or by choosing Quit from the Dock/Menu bar. It is quite possible something in my code broke this but I haven't found any likely culprits yet. Has anyone seen an issue like this in AIR? Choosing quit will close one of my growl-like notification windows if they're up, but my main window and toolbar just sit there, I have to force quit the app.
[flexcoders] Still having issues with quitting AIR app from ApplicationMenu and DockMenu
I gave up on this temporarily and decided to revisit this morning. Around the time the AIR 1.1 update came out, I started having issues quitting the AIR app I'm developing using Apple-Q, the ApplicaitonMenu, and the DockMenu. It seems to be related to the fact that I have other windows opened by my application, the only way I can currently quit the entire application is by closing my Main window, which my windowedApplication listens to and then closes. I've even tried adding a listener to the Quit item in the ApplicationMenu, but my handler is never catching the event when I choose that item. Other AIR apps I have installed are still working correctly, so I'm looking for the culprit here. My application extends WindowedApplication, it is chromeless, transparent, and invisible. It spawns a MainWindow on startup, but other windows for notifications, etc, are also spawned from the application. I listen for the CLOSING event on the MainWindow and then close the application, which works fine. Mac users are just used to Apple-Q to quit and this is doing nothing currently.
Re: [flexcoders] Re: Setting up custom component listener
I had never used it either, and did a quick search before taking the easy way out on my original response with creationComplete on the component. From everything I've read applicationComplete is pretty much the last event dispatched during the bag bang. I found this link (not sure how authoritative/correct it is) http://www.wietseveenstra.nl/blog/2007/02/understanding-the-flex-application-startup-event-order/ So seems like there may be a bug in there somewhere, but at least there is an easy work around. On Tue, Jul 1, 2008 at 12:11 AM, Josh McDonald [EMAIL PROTECTED] wrote: I've never used ApplicationComplete, so I was just taking Jonathon's word for it :) -Josh On Tue, Jul 1, 2008 at 2:30 PM, Alex Harui [EMAIL PROTECTED] wrote: Frankly, I'm a bit puzzled. appComplete is supposed to fire after creationComplete on the app. I'll have to poke at this someday -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Setting up custom component listener
add the listener on creationComplete of your component to ensure the component is not null. creationComplete of the Application should be OK too, but probably best practice to just add it on the component. On Mon, Jun 30, 2008 at 8:14 PM, Merrill, Jason [EMAIL PROTECTED] wrote: Such a stupid question. I am trying to assign a listener to a custom component. It broadcasts a simple event. Here is a dumbed-down version of the code I am using: mx:Application applicationComplete=init() xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:c=com.project.components.* mx:Script ![CDATA[ private function init():void { myComponent.addEventListner(myEvent, onMyEvent); } private function onMyEvent():void { trace(onMyEvent heard.) } ]] /mx:Script c:MyComponent id=myComponent/ /mx:Application !--Here is a simplified version of the component: -- !--com/project/components/MyComponent.mxml: -- mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import flash.events.EventDispatcher; import flash.events.Event; private function broadcastClicked():void { dispatchEvent(new Event(myEvent)) } ]] /mx:Script mx:Checkbox click=broadcastClicked()/ /mx:Canvas However, I get a runtime error for the init() event that myComponent is null. I would have thought that calling it on applicationComplete would ensure that the instance of my component was there. Why not and how instead do I add the listener for it? Thankya Jason Merrill ***Bank of America * Global Technology Operations Global Risk LLD eTools Multimedia *Join the Bank of America Flash Platform Developer Community* *Are you a Bank of America associate interested in innovative learning ideas and technologies? Check out our internal * *GTO Innovative Learning Blog** * * subscribe*.
Re: [flexcoders] what is PropertyChangeEventt.PROPERTY_CHANGE used for?
It is used as the default Binding event and you can create one using the static method createUpdateEvent on the PropertyChangeEvent class var changeEvent:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(changedObject,changedProperty,oldVal,newVal); dispatchEvent(changeEvent); That should fire the binding for the property you've updated. http://livedocs.adobe.com/flex/3/langref/index.html?mx/events/PropertyChangeEvent.htmlmx/events/class-list.html On Sun, Jun 29, 2008 at 8:56 PM, Josh McDonald [EMAIL PROTECTED] wrote: Off the top of my head, when you instantiate a PropertyChangeEvent instead of an Event, the constructor is expecting more useful information about what field changed and when that information is missing / invalid the requisite bindings don't fire. But when the binding handlers get a generic event of name PropertyChangeEvent.PROPERTY_CHANGE, they just assume the entire object has been updated and update all bindings to that object. All just a guess tho ;-) -Josh On Mon, Jun 30, 2008 at 11:48 AM, Aaron Miller [EMAIL PROTECTED] wrote: Hello, when I do this: dispatchEvent( new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE) ); My bindings do not execute. When I do this: dispatchEvent( new Event('propertyChange') ); They do (using default binding with no meta data specified). What is what is the PropertyChangeEvent.PROPERTY_CHANGE event used for if not for binding? Thanks for any input! ~Aaron -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] synchronous events in flex
since you're making a service call the return will be asynchronous, but you can still accomplish what you want to do. Your service call, this case send() on the HTTPService, will return an AsyncToken which you can regiser an IResponder to, specifying a result and fault method that will be called when the service returns. You can also listen for fault and result events directly on the HTTPService you create. The processing you want to do can be performed in the handler for the result event. On Sat, Jun 28, 2008 at 8:54 AM, [EMAIL PROTECTED] wrote: Hi Can anyone tell me how to write synchronous events in flex application? I am calling an Httpservice on focus out event of text field this service checks name duplication. I want my application to wait for service to finish and then do some processing Thanks in advance
Re: [flexcoders] Custom Event Not Dispatched
If you're not listening for the event directly on the component that will be dispatching it, you need to toggle the 'bubbles' property so that the event will will trigger handlers up the display list from where it was dispatched. So in your case change your dispatch line to: dispatchEvent( new MyEvent(), true ); On Sat, Jun 28, 2008 at 10:11 AM, [EMAIL PROTECTED] wrote: HI can any one tell me what is wrong with this code. I wrote a custom event and dispatched this event from my entity class and am listening for this event on main application but the listener is not listening for event. Please help me. here is my Event class public class MyEvent extends Event { public static var MY_EVENT:String = MY_EVENT ; public function MyEvent() { super ( MY_EVENT ); } } This class dispatches an event of type MyEvent from setter method public class MyObject extends EventDispatcher { [Bindable(event=MyEvent)] private var _name:String; public function set name( _pname:String ):void { _name = _pname ; trace( Dispatching Event ); dispatchEvent( new MyEvent() ); } } and here is code for my main application . ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical creationComplete={init()} mx:Script ![CDATA[ import com.MyEvent; import com.MyObject; private var obj:MyObject ; public function init():void { obj = new MyObject(); this.addEventListener(MyEvent.MY_EVENT , propertyChangeListener ) ; } public function propertyChangeListener( evt:MyEvent ):void { // This Function never gets called trace( 'Listining for MyEvent..' ); } public function btnClickHandler():void { obj.name = 'Changing Value' ; trace( obj.name ); } ]] /mx:Script mx:Button click={btnClickHandler()}/ /mx:Application
Re: [flexcoders] Re: Best Practice Data Binding
The only difference in what you're doing in the two examples is declaring a custom event in the second example. As Doug said, you can place the Binding metadata tag over the getter or the setter, it makes no difference. If you don't declare a custom event, an extra set of functions will be wrapped around your getter/setter pair that uses the PropertyChangeEvent for Binding. If you declare a custom event as you did in example 2, the compiler will not generate the wrapper functions and you're required to dispatch the declared event yourself. This is extremely useful as you can dispatch this event anywhere in your class to trigger Bindings on a getter to fire. I would reclassify your examples as 1) default Binding 2) Binding with custom event On Fri, Jun 27, 2008 at 5:32 PM, securenetfreedom [EMAIL PROTECTED] wrote: I found this page to be helpful but not authoritative (This is where I found the use of binding the setter); http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.html // Binding #1 [Bindable] public function set shortNames(val:Boolean):void { ... } public function get shortNames():Boolean { ... } I did glean a trick for read-only binding for static data by using: public static const constString:String=A static const.; However, I still need to clear up one thing. Is it true that you can place [Bindable] meta data on either a setter of getter and have it bound to a View component? --- In flexcoders@yahoogroups.com, Doug McCune [EMAIL PROTECTED] wrote: If you define a getter and a setter you can add the [Bindable] metadata to either the getter or setter, it does the same thing either way. The only time you have to use a custom event to trigger the binding is when you have read-only properties (a getter but no setter). Doug On Fri, Jun 27, 2008 at 12:08 PM, securenetfreedom [EMAIL PROTECTED] wrote: Any thoughts? In an DataModel class what is the best way to bind data. 1) Make the Setter Bindable, or 2) Make the Getter Bindable and dispatch an event on the Setter? What are the advantages and disadvantages of each? // Binding #1 [Bindable] public function set foo(val:String):void{ _foo = val; } public function get foo():String{ return _foo; } // Binding #2 [Bindable(event=fooChanged)] public function get foo():String{ return _foo; } public function set foo(val:String):void{ _foo = val; dispatchEvent(new Event(MyDataModel.FOO_CHANGED)); }
Re: [flexcoders] Custom Event Not Dispatched
right, I'm only half awake on Saturday monring The bubbles property is the second parameter on the Event constructor, so your MyEvent changes should have done the trick. Sorry about the slip up there, a lot of times if I'm writing something quick and dirty I would do it like displatchEvent(new Event(MY_EVENT,true)); your custom Event class is definitely the best practice as you get the const for the event name to ensure listener's register for the correct event. On Sat, Jun 28, 2008 at 10:37 AM, [EMAIL PROTECTED] wrote: Ok dear i chanaged MyEvent Class with this public class MyEvent extends Event { public static var MY_EVENT:String = MY_EVENT ; public function MyEvent() { super ( MY_EVENT , true ); } } but what about dispatchEvent( new MyEvent(), true ); dispatchEvent does not accept second argument , it only accepts one argument of Type Event - Original Message - From: Daniel Gold [EMAIL PROTECTED] danielggold%40gmail.com To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Sent: Sat, 28 Jun 2008 10:16:29 -0500 Subject: Re: [flexcoders] Custom Event Not Dispatched If you're not listening for the event directly on the component that will be dispatching it, you need to toggle the 'bubbles' property so that the event will will trigger handlers up the display list from where it was dispatched. So in your case change your dispatch line to: dispatchEvent( new MyEvent(), true ); On Sat, Jun 28, 2008 at 10:11 AM, [EMAIL PROTECTED]parjan%40softpak.com wrote: HI can any one tell me what is wrong with this code. I wrote a custom event and dispatched this event from my entity class and am listening for this event on main application but the listener is not listening for event. Please help me. here is my Event class public class MyEvent extends Event { public static var MY_EVENT:String = MY_EVENT ; public function MyEvent() { super ( MY_EVENT ); } } This class dispatches an event of type MyEvent from setter method public class MyObject extends EventDispatcher { [Bindable(event=MyEvent)] private var _name:String; public function set name( _pname:String ):void { _name = _pname ; trace( Dispatching Event ); dispatchEvent( new MyEvent() ); } } and here is code for my main application . ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical creationComplete={init()} mx:Script ![CDATA[ import com.MyEvent; import com.MyObject; private var obj:MyObject ; public function init():void { obj = new MyObject(); this.addEventListener(MyEvent.MY_EVENT , propertyChangeListener ) ; } public function propertyChangeListener( evt:MyEvent ):void { // This Function never gets called trace( 'Listining for MyEvent..' ); } public function btnClickHandler():void { obj.name = 'Changing Value' ; trace( obj.name ); } ]] /mx:Script mx:Button click={btnClickHandler()}/ /mx:Application
Re: [flexcoders] Re: selecting a pre-determined row in a datagrid
list's have a selectedItem property that does the comparison for you to find the index and select it, so according to your description you could set grid.selectedItem = selectedItem(the var you're keeping) On Thu, Jun 26, 2008 at 7:04 AM, bray_6 [EMAIL PROTECTED] wrote: You can use arraycollection getItemIndex() to get the object's index then use it for the datagrid's selectedIndex. HTH, Bray --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, fb6668 [EMAIL PROTECTED] wrote: Hi. I have a datagrid component which has a dataProvider of an arraycollection of objects. I also have a variable selectedItem, which holds an object that has been selected elsewhere in the application. What I need is, when I create my datagrid, to set the background colour of the row corresponding to this selectedItem object. So I guess I need to loop through the dg's rows, comparing the dataItem of the row to selectedItem. However, I don't know how to loop the rows in a DataGrid?? It's so easy in C#.NET, and not here, so I think I may be approaching this from the wrong angle. Any ideas? Thanks!
[flexcoders] Re: Can no longer quit my AIR app
is anyone else seeing this? If I click the close button on my main window the application will exit, but choosing Quit from menu bar or dock icon seems to do absolutely nothing? On Mon, Jun 23, 2008 at 3:49 PM, Daniel Gold [EMAIL PROTECTED] wrote: AIR updated itself this morning, and now it seems I can no longer quit an app I'm developing using Apple-Q on my Mac or by choosing Quit from the Dock/Menu bar. It is quite possible something in my code broke this but I haven't found any likely culprits yet. Has anyone seen an issue like this in AIR? Choosing quit will close one of my growl-like notification windows if they're up, but my main window and toolbar just sit there, I have to force quit the app.
[flexcoders] Can no longer quit my AIR app
AIR updated itself this morning, and now it seems I can no longer quit an app I'm developing using Apple-Q on my Mac or by choosing Quit from the Dock/Menu bar. It is quite possible something in my code broke this but I haven't found any likely culprits yet. Has anyone seen an issue like this in AIR? Choosing quit will close one of my growl-like notification windows if they're up, but my main window and toolbar just sit there, I have to force quit the app.
Re: [flexcoders] Re: Is an event dispatched when an AIR app is closing?
The rest of the Windows I spawn in the Application are chromeless by the methods you linked to. The reason I am using Application is because my app doesn't have a main window, it sits in the background without a view initially and spawns windows as notifications come in, etc. I don't consider this a hack, I'm simply using a lighter weight root tag because I don't need the extended functionality of WindowedApplication at that level of the app. On Sun, Jun 22, 2008 at 10:15 AM, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote: Nevermind. Didn't find it right away because my AIR app is based off mx:Application and is chromeless, but I can listen for the closing event on the main Window I spawn and cache the data there. On Sun, Jun 22, 2008 at 12:31 AM, Daniel Gold [EMAIL PROTECTED] wrote: I'm working on an online/offline AIR app and was wondering if there was any way to detect that an AIR app is closing so I can cache my data models? If the user closes the app while online and then opens it later offline, I'd like them to have access to the last data set. I could achieve this by constantly mirroring the remote data but was hoping to avoid that since the majority of the time the users will be online and it won't be necessary. Even though it is tempting to use Application instead of WindowedApplication because of the lack of documentation on how to make WindowedApplication chromeless (http://flexdiary.blogspot.com/2007/07/application-vs- windowedapplication.html), if you read the first comment to this post http://technoracle.blogspot.com/2007/07/air-apple-shaped- application.html, you will see that it is actually possible to use WindowedApplication with this in AIR as was intended. I thing you're probably better off using AIR as Adobe designed it if a workaround is avaialable instead of using a hack like the wrong tag. HTH; Amy
[flexcoders] Is an event dispatched when an AIR app is closing?
I'm working on an online/offline AIR app and was wondering if there was any way to detect that an AIR app is closing so I can cache my data models? If the user closes the app while online and then opens it later offline, I'd like them to have access to the last data set. I could achieve this by constantly mirroring the remote data but was hoping to avoid that since the majority of the time the users will be online and it won't be necessary.
[flexcoders] Re: Is an event dispatched when an AIR app is closing?
Nevermind. Didn't find it right away because my AIR app is based off mx:Application and is chromeless, but I can listen for the closing event on the main Window I spawn and cache the data there. On Sun, Jun 22, 2008 at 12:31 AM, Daniel Gold [EMAIL PROTECTED] wrote: I'm working on an online/offline AIR app and was wondering if there was any way to detect that an AIR app is closing so I can cache my data models? If the user closes the app while online and then opens it later offline, I'd like them to have access to the last data set. I could achieve this by constantly mirroring the remote data but was hoping to avoid that since the majority of the time the users will be online and it won't be necessary.
[flexcoders] Listening for mainScreen changes in AIR
Are there any events raised when the mainScreen is changed in an AIR application? I've noticed this happens if you're using Spaces in OS X and therefore assume it happens when using similar virtual workspace applications under Windows and Linux. For raising notification windows, etc, I would like to know when the main screen change has occured. The documentation states that no properties of the Screen class should be cached, but that also means events should be raised so we know when changes occur. Between two consecutive frames the mainScreen could change and I'd like to make sure my AIR app behaves as expected.
Re: [flexcoders] Attaching custom data to events (while avoiding race condition)
does determineFlag() do some asynch service call? If so you need to wait and raise an event or update a var in a model and listen for changes that way. Otherwise your determineFlag() method will run to completion before the loader.loadSomeStuff() line is executed, Flash is single threaded for user code execution so you shouldn't have a race condition there On Mon, Jun 9, 2008 at 3:55 PM, robbarreca [EMAIL PROTECTED] wrote: Say I have two functions load() and handleComplete(event:Event). Right now to get custom data to handleComplete I do something like this private var someFlag:uint = 0; function load() { loader.addEventListener(handleComplete); someFlag = determineFlag(); loader.loadSomeStuff(); } function handleComplete(event:Event) { trace(someFlag); } But if I call this super fast, someFlag is gonna be wrong. I've seen a method where you can add an anonymous function somehow, but I'm pretty sure that even faced the same race condition problem. What is the *proper* way to go about this?
Re: [flexcoders] Re: Attaching custom data to events (while avoiding race condition)
It makes sense when dealing with concurrent programming, but Flash is single threaded and you won't have a case where multiple threads are task switching and simultaneously executing functions. Every function call and event handler in flex is basically in-lined and will execute to completion. On Mon, Jun 9, 2008 at 5:11 PM, robbarreca [EMAIL PROTECTED] wrote: Sorry, I must have not explained well. The race condition I'm talking about exists here: thread 1: calls load() and say someFlag gets set to 1; thread 2: calls load() and someFlag is set to 2; thread 1: the first load is complete and handleComplete() is called, but someFlag is set to 2 when the value I want is 1. I want to attach a copy of the value of someFlag to the event so in handleComplete() I could call event.target.someFlagCopy and always get the value that was set in *that* thread's load() call. Does that make any sense? -R --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote: does determineFlag() do some asynch service call? If so you need to wait and raise an event or update a var in a model and listen for changes that way. Otherwise your determineFlag() method will run to completion before the loader.loadSomeStuff() line is executed, Flash is single threaded for user code execution so you shouldn't have a race condition there On Mon, Jun 9, 2008 at 3:55 PM, robbarreca [EMAIL PROTECTED] wrote: Say I have two functions load() and handleComplete(event:Event). Right now to get custom data to handleComplete I do something like this private var someFlag:uint = 0; function load() { loader.addEventListener(handleComplete); someFlag = determineFlag(); loader.loadSomeStuff(); } function handleComplete(event:Event) { trace(someFlag); } But if I call this super fast, someFlag is gonna be wrong. I've seen a method where you can add an anonymous function somehow, but I'm pretty sure that even faced the same race condition problem. What is the *proper* way to go about this?
Re: [flexcoders] SWF Size Concerns
did you have any TitleWindows previously? My guess is the code size increase is due to extra components from the framework library being compiled into your project. Add another TitleWindow component that is similar and see what the code size increase. From some other applications I've worked with in Flex, I've seen that the SWF size seems to plateau around 1.2kb or so and crawls from there even if I add some complex custom components, at some point it's just compiled code once you've used most of the available components. On Mon, Jun 9, 2008 at 5:24 PM, jmfillman [EMAIL PROTECTED] wrote: I have a good sized application (around 433 KB). I just added a TitleWindow component with 37 lines of code and no imbedded assets, and was surprised when the SWF size jumped about 102 KB, to 535 KB (using Release Build). Am I better off creating an view inline state instead of using a component? It seems so out of proportion. The main application is a few thousand lines, with plenty of imbedded images, and this little TitleWindow increases my file size by nearly 25%.
Re: [flexcoders] Re: Attaching custom data to events (while avoiding race condition)
I think the piece that you were missing is that load is actually pulling data in from a service, and you can't rely on the order in which the service responses return. Josh's answer above is definitely a best practice, if you have multiple service calls that need to have responses handled in a certain order, wait and chain them by not calling the second service until the first service returns. And to answer your original question about putting data in an event, simply extend the event class and then you can define any properties you want, and access those properties in your event handler, here's a quick example: package events { import flash.events.Event; public class LoadEvent extends Event { public static const DATA_LOAD:String = dataLoadEvent; public var message:String; public function LoadEvent(message:String, bubbles:Boolean=false, cancelable:Boolean=false) { this.message = message; super(DATA_LOAD, bubbles, cancelable); } } } //add the event listener before calling your load method: loader.addEventListener(LoadEvent.DATA_LOAD,loadResultHandler); //raise the event in the response in your loader class dispatchEvent(new LoadEvent(Data Loaded Successfully, true, true)); //pull the data out in your handler private function loadResultHandler(loadEvent:LoadEvent):void { var message:String = loadEvent.message; trace(message); } Hope something in there helps On Mon, Jun 9, 2008 at 10:02 PM, Josh McDonald [EMAIL PROTECTED] wrote: If you need responses to come back in order, don't make the second request until you've got the first result. Or wait for all responses, and put them in an array based on some order-information in the AsyncTokens. -Josh On Tue, Jun 10, 2008 at 11:48 AM, robbarreca [EMAIL PROTECTED] wrote: I'd love to know if my explanation made any sense when someone gets a free moment. If it sounds like I'm smoking crack, please let me know and I'll check myself into rehab. Thanks! -R --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, robbarreca [EMAIL PROTECTED] wrote: So when I say thread maybe I'm using the wrong terminology. I'm not actually talking about two different users/browsers. I'm talking about the same browser running two calls of load(). Let me expand: function onInitialize() { loader.addEventListener(handleComplete); load(1); // Say this takes 20 seconds to complete load load(2); // But this one only takes 5 seconds to complete } private var storedFlag:uint = 0; function load(flag:uint) { storedFlag = flag; loader.loadSomeStuff(); } function handleComplete(event:Event) { // What is storedFlag here? } The execution goes like this: load(1); load(2); handleComplete(event1); // Triggered from the load(1) which is the race since this storedFlag == 2, but this is handling the completion of the first load. I really want to get that flag data from the event object so there is no race condition. handleComplete(event2); This is a simplified example, but I really do have a use case for this. Did I do a better job of explaining this time? -R --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel Gold danielggold@ wrote: It makes sense when dealing with concurrent programming, but Flash is single threaded and you won't have a case where multiple threads are task switching and simultaneously executing functions. Every function call and event handler in flex is basically in-lined and will execute to completion. On Mon, Jun 9, 2008 at 5:11 PM, robbarreca rob@ wrote: Sorry, I must have not explained well. The race condition I'm talking about exists here: thread 1: calls load() and say someFlag gets set to 1; thread 2: calls load() and someFlag is set to 2; thread 1: the first load is complete and handleComplete() is called, but someFlag is set to 2 when the value I want is 1. I want to attach a copy of the value of someFlag to the event so in handleComplete() I could call event.target.someFlagCopy and always get the value that was set in *that* thread's load() call. Does that make any sense? -R --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Daniel Gold danielggold@ wrote: does determineFlag() do some asynch service call? If so you need to wait and raise an event or update a var in a model and listen for changes that way. Otherwise your determineFlag() method will run to completion before the loader.loadSomeStuff() line is executed, Flash is single threaded for user code execution so you shouldn't have a race condition there On Mon, Jun 9, 2008 at 3:55 PM, robbarreca rob@ wrote: Say I have two functions load() and handleComplete
Re: [flexcoders] Reflect column sorting in AdvancedDataGrid
I think if you create a Sort with the SortField that the server is sorting by and apply that to the dataProvider, the DataGrid will check if that field is a field in a DataGridColumn and display the sort arrow on that column. On Fri, Jun 6, 2008 at 7:57 AM, Dennis van Nooij [EMAIL PROTECTED] wrote: I'm using an AdvancedDatagrid where my sorting is done on the server (total result set is bigger than the list shown at client). So when I click a header, sort info is added to the request and result comes back sorted correctly. My question is: How can I provide feedback on how the results are sorted? Arrows on the columns are gone, probably because dataprovider was refreshed. Is there a way to manually enable those arrows again ?
Re: [flexcoders] Re: Itemrenderer combo's dataprovider from ModelLocator???
I believe in using MVC in whatever way feels right for the application. A lot of times it's just easier to grab an instance of the model from wherever you need it. That being said, whenever possible I try to follow the pattern of top level display objects referencing the model and then handing data out to its children. In your case I might put a variable referencing the model list in the objects contained in the dataProvider for the list and therefore have access to them in the data property of the itemRenderer as Tim mentioned above. On Fri, Jun 6, 2008 at 5:04 AM, Tim Hoff [EMAIL PROTECTED] wrote: Hey Jerry, No, referencing the model from anywhere in your application is the power of MVC. Most times you can get what you need from data or listData in an itemRenderer. But, there's nothing keeping you from using the model any way that you need. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, slash_n_rose [EMAIL PROTECTED] wrote: Hi I'm using a Combobox control in my itemrenderer and its dataprovider is a Cairngorm ModelLocator variable. So my itemrenderer has a reference to ModelLocator. Is it a bad method by referencing model in Item Renderer,? If yes is there any other methods? Thanks in advance. Regards Jerry
Re: [flexcoders] Measurement and scrolling
You may want to look at the code in PodLayoutManager.as from the Flex Dashboard example as it seems to be very similar to what you're doing http://examples.adobe.com/flex3/devnet/dashboard/main.html On Fri, Jun 6, 2008 at 12:04 AM, Josh McDonald [EMAIL PROTECTED] wrote: Measure can always be bigger than the actual width/height, that's what it's for. On Fri, Jun 6, 2008 at 11:32 AM, Richard Rodseth [EMAIL PROTECTED] wrote: No, I mean like zooming a window. I think the problem lies in how I tell the TiledCanvas that one of its children is the zoomed one (setting visible of all the others to false in updateDisplayList). Stay tuned. However, setting that aside, it also seems as though I might be commiting a hack if I allow the measured size of the TiledCanvas to remain larger than its bounds, even though it allows the scrolling to work (at least in the all-tiles-shown case). On Thu, Jun 5, 2008 at 5:46 PM, Josh McDonald [EMAIL PROTECTED]dznuts%40gmail.com wrote: I'm not sure exactly what you're doing, or what you're trying to achieve yet. By expanding a tile do you mean you're setting the minimum to be bigger, or you're manually overriding the decisions the base Container implementation makes in updateDisplayList()? On Fri, Jun 6, 2008 at 10:41 AM, Richard Rodseth [EMAIL PROTECTED]rrodseth%40gmail.com wrote: The docs say: If the horizontalScrollPolicy is ScrollPolicy.AUTO, the horizontal scroll bar appears when all of the following are true: * One of the container's children extends beyond the left edge or right edge of the container. * The clipContent property is true. * The width and height of the container are large enough to reasonably accommodate a scroll bar. And sure enough, if I set a static minimum on tiledView, I get the desired effect. If I expand a tile and change the minimum to something else, any idea which invalidate method(s) I should call? On Thu, Jun 5, 2008 at 4:57 PM, Josh McDonald [EMAIL PROTECTED]dznuts%40gmail.com wrote: If you want to be able to measure your subcomponents, always use setActualSize. I learned that the hard way recently :) I've recently been doing a whole bunch of measure and updatedisplaylist voodoo for a custom container, so I'll be slightly helpful! -Josh On Fri, Jun 6, 2008 at 9:36 AM, Richard Rodseth [EMAIL PROTECTED]rrodseth%40gmail.com wrote: Clearly I haven't mastered layout and measurement. I've implemented a custom component which tiles its children in equal-sized tiles, but also has a state (not a flex state) where one tile fills the component. I subclassed Canvas and set the sizes and positions of children in updateDisplayList. I didn't override measure(), but it works very nicely, resizing children smoothly as it is resized. Now, however, I would like to set a minimum width and height for the tiled view, after which scroll bars appear. The minimum will be different if the component is in the one-tile-expanded case. Can I do this without further mods to my component? Should my updateDisplayList be calling setActualSize rather than setting x,y,width, height? Should I have a measure() implementation? How would it differ from the inherited one? In a scenario like the following, would I set the minWidth and minHeight on the parent or child? Or, to ask another way, do the the scrollpolicy and minimum properties always belong on the same component? mx:Canvas id=scrollableArea width=100% height=100% verticalScrollPolicy=auto horizontalScrollPolicy=auto view:TiledCanvas id=tiledView width=100% height=100% /view:TiledCanvas /mx:Canvas Thanks. -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] josh%40gfunk007.com -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] josh%40gfunk007.com -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Re: How to remeasure itemRenderer
Sometimes when I've had issues setting breakpoints, especially in an SWC, it's a caching issue with Firefox. I've installed the developer toolbar extension and disabled caching which has helped tremendously with that problem. On Thu, Jun 5, 2008 at 12:40 PM, Alex Harui [EMAIL PROTECTED] wrote: Probaly uninstall/reinstall. Run some other tests first. As you step into code, you should never suddenly jump into the middle of a function, breakpoints should be settable, etc. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Amy *Sent:* Thursday, June 05, 2008 7:19 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Re: How to remeasure itemRenderer --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: It has nothing to do with rendererChanged, that would be if you changed the classFactory for the renderer. List also has makeRowsAndColumns. If you can't set a breakpoint, that makes me think your source is not in sync with the swcs. How do I fix that? Thanks; Amy
Re: [flexcoders] Listening for a value change
It sounds like you need to set up a ChangeWatcher, take a look at the docs, but basically you can listen for updates to a property on an object and call a function when the update occurs On Mon, Jun 2, 2008 at 9:01 AM, Felipe Fernandes [EMAIL PROTECTED] wrote: Jeff, Look at setter and getter functions it´s just what you need. Felipe On Mon, Jun 2, 2008 at 10:40 AM, Jeff Douglas [EMAIL PROTECTED] donotspamme%40jeffdouglas.com wrote: This seems like this should be easy but I'm hititng my head against the wall trying to figure it out. I have the following String: [Bindable] var myString:String; The value of myString changes throughout the application. Based upon the value of myString I want to perform different tasks. How can I write a listener that determines 1) that the value has changed and 2) what the new value is? Thanks Jeff
Re: [flexcoders] Re: How do I dispatch an everything PropertyChangeEvent on this?
I've done it that way before, although sometimes its better to create an updateAll() method, because now all of your bindings will fire when a single property changes since your entire class is Bindable on the same event. Just depends on exactly what the use case is, if your class is set up with the default Binding events you could use describeType in your updateAll method to dispatch a PropertyChangeEvent for each property in your class. On Fri, May 16, 2008 at 1:36 AM, Josh McDonald [EMAIL PROTECTED] wrote: Once again, two seconds after I post, the answer pops into my head... And as usual, the (simple) solution for anybody trawling the list in future: [Bindable(event=populated)] public class FooBar extends EventDispatcher { ... //Pay attention to me! dispatchEvent(new Event(populated)); -J On Fri, May 16, 2008 at 4:30 PM, Josh McDonald [EMAIL PROTECTED] wrote: Hi guys, Disclaimer: this is probably a stupid question, but I've been trying to figure this out for way too long! I've got some code that does all sorts of things to this.foo, this.bar, and this.baz etc etc. At the moment I'm dispatching several standard PropertyChangeEvents as I change fields. What I'd like to do is once I've finished all my voodoo, dispatch a single event that says everything needs to be updated, but I need to do it to this rather than on a reference in a parent object, as it's a non-visual component that has no idea where it sits in the object graph. I *know* there's a simple solution to this... -J -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Re: How do I dispatch an everything PropertyChangeEvent on this?
I don't usually make an entire class Bindable on a single event like you posted earlier, so I'm not 100% on this, but I'm pretty sure it won't auto-generate that event for you in your setters, so you would have to dispatch it manually, with the side effect that all of your other bindings would fire as well. I usually go the route of using the default Bindable event and then using describeType in my updateAll to generate the propertyChangeEvent so that I can still fire individual bindings without the overhead. I also cache the result of the describeType so that it will only happen once on each qualified class name as that method can be pretty heavy. On Sun, May 18, 2008 at 7:42 PM, Josh McDonald [EMAIL PROTECTED] wrote: Does this mean I will no longer receive any automatic updates (as in generated by the framework, rather than by my event dispatch code) at all when an individual member is updated, or that simply all members will be marked as changed when any one of them is? Cheers, -J On Mon, May 19, 2008 at 6:02 AM, Daniel Gold [EMAIL PROTECTED] wrote: I've done it that way before, although sometimes its better to create an updateAll() method, because now all of your bindings will fire when a single property changes since your entire class is Bindable on the same event. Just depends on exactly what the use case is, if your class is set up with the default Binding events you could use describeType in your updateAll method to dispatch a PropertyChangeEvent for each property in your class. On Fri, May 16, 2008 at 1:36 AM, Josh McDonald [EMAIL PROTECTED] wrote: Once again, two seconds after I post, the answer pops into my head... And as usual, the (simple) solution for anybody trawling the list in future: [Bindable(event=populated)] public class FooBar extends EventDispatcher { ... //Pay attention to me! dispatchEvent(new Event(populated)); -J On Fri, May 16, 2008 at 4:30 PM, Josh McDonald [EMAIL PROTECTED] wrote: Hi guys, Disclaimer: this is probably a stupid question, but I've been trying to figure this out for way too long! I've got some code that does all sorts of things to this.foo, this.bar, and this.baz etc etc. At the moment I'm dispatching several standard PropertyChangeEvents as I change fields. What I'd like to do is once I've finished all my voodoo, dispatch a single event that says everything needs to be updated, but I need to do it to this rather than on a reference in a parent object, as it's a non-visual component that has no idea where it sits in the object graph. I *know* there's a simple solution to this... -J -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Drag and Drop (modify default dragProxy)
I think if you wanted to modify the default drag proxy you could subclass DataGrid and override the get dragImage function, which looks like this (in Flex 2.01) override protected function get dragImage():IUIComponent { var image:DataGridDragProxy = new DataGridDragProxy(); image.owner = this; return image; } You could subclass the DataGridDragProxy and then add your labels or whatever else you wanted, and return a new instance of that class in get dragImage On Mon, May 12, 2008 at 9:04 AM, nwebb [EMAIL PROTECTED] wrote: Hi Douglas, thanks for the reply - yeah that's pretty much what I have at the moment (I capture the data on MouseDown and create/display a Label on MouseMove), but I thought it could be a little cleaner and so I was hoping I could access the current dragProxy, use the existing data within it, all within the MouseMove method. This is what I currently have: //Capture the row data when the user clicks on an item... private function dropZoneMouseDown(event:MouseEvent):void { var selectedData:XML = DataGrid(event.currentTarget).selectedItem as XML; _lastSelectedName = [EMAIL PROTECTED]; _lastSelectedAge = [EMAIL PROTECTED]; } private function dropZoneMouseMove(event:MouseEvent):void { var dragInitiator:IUIComponent = event.target as IUIComponent; var dragSource:DragSource = new DragSource(); var dragProxy:Label = _dragLabel; dragProxy.text = _lastSelectedName ++ _lastSelectedAge; DragManager.doDrag(dragInitiator, dragSource, event, dragProxy); } Cheers, Neil On Mon, May 12, 2008 at 2:41 PM, Douglas Knudsen [EMAIL PROTECTED] wrote: perhaps you can create a Label with the text from these twocolumns and then use this method http://livedocs.adobe.com/flex/3/html/dragdrop_7.html#226768 DK On Mon, May 12, 2008 at 8:40 AM, nwebb [EMAIL PROTECTED] wrote: Hi, I'm drag/dropping items within a DataGrid. I would like to modify the default dragProxy label that is shown when you drag an item. (i.e. my DataGrid may have 4 columns, but I only want to show text from the last two columns). Does anyone know how to access it? -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it?
Re: [flexcoders] What happens to objects when you change state?
Cepends on what your states are defined to do, but sounds like you're adding and removing children on the state change, which is pretty common. The view objects will still be in memory, just not on the display list and with no parent. On Thu, May 8, 2008 at 10:31 AM, David Ham [EMAIL PROTECTED] wrote: I have an app with two mx:States, component A appears in state A, and component B in the same position in state B. When I'm in state A, where is component B, and vice versa? I my tests they appear to both still be in memory and visible; does Flex just shuffle their z-indexes? What does Flex do with them when you switch states? Thanks, OK DAH
Re: [flexcoders] itemUpdated() functionality for XML properties?
I believe I've seen XMLChangeWatchers used in generated source to listen for attribute changes, etc, on XML data. I think the DataBinding chapter of the Flex developers guide claims you can only bind to XML attributes and changes in MXML, but at some point it gets compiled to AS. On Mon, May 5, 2008 at 12:28 PM, Tracy Spratt [EMAIL PROTECTED] wrote: I have a bindable data model implemented as a singleton, several properties of which are implemented as XML. My app uses binding and ChangeWatchers to respond to changes in this XML data. If I assign an entire xml to one of these properties, the property change is dispatched and my bindings fire and my watchers are called. But if I update an item in the xml, like set and attribute value or text node, it APPEARS that the events are not dispatched. This is unsurprising, as it is analagous to updating an item property in a Collection, for whichitemUpdated() method exists. First, is the behavior I am seeing is expected? I know that XML dispatches ordinary events that fire bindings, but those events are notgetting out of my model instance. Second, if the behavior is expected,is there some similar itemUpdated() functionality for XML? Tracy
Re: [flexcoders] E4X vs Array Collection
It doesn't get any faster than a typed class as far as data access, but there are some things to think about. To get the data into the typed class you have to parse the XML at some point, so it will probably come down to how often each property is accessed. If you're only going to hit each property once or twice, probably not worth a typed class as far as speed goes. I always use typed classes for code readability, code hinting, maintenance, etc, but some people don't like having to write a VO for each object they'll get back from the server. Alex Harui did a simple test of data access times using different methods a while back: http://blogs.adobe.com/aharui/2007/10/actionscript_readwrite_perform_1.html On Thu, May 1, 2008 at 4:36 PM, Nate Pearson [EMAIL PROTECTED] wrote: What's faster, E4X or array collections with typed classes? I can have my data nested three levels in XML or I can have it pretty flat in an array collection. I'll be using this data with graphs, but will also be do analysis of the selected area on the graph. Thanks, Nate
Re: [flexcoders] Re: DataGrid and exporting values
Is the server round trip a huge problem? I have a loopback CSV servlet that I hit quite often in our application. Most of our datagrids are subclassed and have an Export CSV button at the bottom. Simple function to convert all the rows to CSV and send it the server as a parameter to a FileDownload, server responds with the data and the right MIME type and they've got their CSV, no copy and paste or reliance on external code. On Thu, May 1, 2008 at 2:22 PM, Dominic Pazula [EMAIL PROTECTED] wrote: That is a good idea. Actually pushing the data across didn't seem to be the problem. That loop is what was taking forever. I could literally watch the individual cells get added. A couple hundred rows took 10 seconds. Of course I could always be missing something... Thanks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: There was a thread sometime ago about performance problems with large data sets and ExtenalInterface. Why not skip that part. You could generate the HTML in Flex and put it on the clipboard directly using System.setClipboard(sHTML); Tracy
Re: [flexcoders] ListCollectionView.contains()
contains is an object comparison, so it is by reference except when dealing with primitives I believe. The collection wouldn't know how you wanted to compare your objects so you'll have to iterate and check the relevant properties or extend a collection class, add a containsByValue, and have your objects implement a Comparable interface of some kind. On Thu, May 1, 2008 at 2:29 PM, Maciek Sakrejda [EMAIL PROTECTED] wrote: Does ListCollectionView.contains() use reference equality to check if the collection contains a given object? Is there a simple way of using value equality (besides the obvious iteration)? -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com
Re: [flexcoders] Sort a List Comp?
The List is simply the view for your data. You need to sort the dataProvider of the list so when the List is iterating over your data rendering it, it will be accessing the data in the order specified. I would pull the data from lastResult, store it in an ArrayCollection or XMLListCollection(since it seems like you might be using XML), and then you can set the Sort on the collection as specified in the docs: http://livedocs.adobe.com/flex/3/langref/mx/collections/Sort.html Sort also allows you to set a custom compareFunction if you need more than a simple ascending/descending sort on the dataFields. On Thu, May 1, 2008 at 10:53 AM, Justin Stanczak [EMAIL PROTECTED] wrote: I have the following: * mx:HTTPService id=getMajorsVisitdates url=ServiceServlet mx:List id=majorsList width=342 dataProvider={getMajorsVisitdates.lastResult.root.major} change=selectMajor() height=200 labelField=name x=10 y=36/mx:List* How do I sort the majorsList? Seems like it should be easy, but I'm not totally understanding how to do it with a List. Thanks. -- All that is necessary for the triumph of evil is that good men do nothing. - Edmund Burke
Re: [flexcoders] Re: Extending Alert
This peaked my interested and I quickly flipped through the Alert class to see what was going on. Nothing really caught my attention so it seems like this is enforced by the MXML compiler. I verified this by adding an Alert in AS without using the static show funciton. In a simple test application I added a button that called this: var alert:Alert = new Alert(); addChild(alert); An empty Alert window was added to the application. Seems kind of bizarre the way this component works. Are there any other cases of flex components extending UIComponent that aren't allowed to be instantiated through MXML? One thing you could do is follow their pattern of having a class with a static show() function. If you don't mind building the entire component in ActionScript that function could create a TitleWindow/Panel, apply the styles, add the children you want, and add the container to the application or specified parent. As long as the class doing this isn't a UIComponent itself, noone will be able to add it to a container in MXML. On Thu, May 1, 2008 at 10:08 AM, climbfar [EMAIL PROTECTED] wrote: I believe this is a restriction brought on by the Adobe developers. You cannot do this in MXML: mx:Panel id=panel mx:Alert /mx:Alert /mx:Panel If you try to compile, you will get this message: Could not resolve mx:Alert to a component implementation. To instantiate an Alert in MXML the proper coding would be: mx:Panel id=panel mx:Button click=mx.controls.Alert.show('hello')/ /mx:Panel Basically I would like to create a similar component that would be used for configuring some task modally and presumably extending it off the Alert or TitleWindow component. G'day Mike --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Maciek Sakrejda [EMAIL PROTECTED] wrote: Why do you need to prevent usage through MXML? MXML is compiled down to ActionScript, so it's essentially just syntactic sugar. That is, by preventing using your components through MXML, you are just removing a convenient interface, and not restricting functionality. -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com -Original Message- From: climbfar [EMAIL PROTECTED] Reply-To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Extending Alert Date: Thu, 01 May 2008 14:18:55 - How do I extend the Alert class such that the new class cannot be created using MXML tags? Taking it a step further is it possible to create an ActionScript class extended from Panel that cannot be constructed using MXML tags? G'day Mike
Re: [flexcoders] Re: [Bindable] - Can I specify many vars Bindable in one block?
Just be sure to use it wisely. If you have a class with 25 variables and only 4 variables that really need to be Bindable, you're going to be generating a lot of wasted code. Binding is great when you need it, but I see a lot of classes where the [Bindable] tag is thrown at the top out of laziness (probably some of my code included) On Fri, Apr 25, 2008 at 11:56 PM, hoytlee2000 [EMAIL PROTECTED] wrote: Thanks! this'll save me some time. be well, Hoyt --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, ben.clinkinbeard [EMAIL PROTECTED] wrote: You can do it above your class statement and make all vars bindable. HTH, Ben --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, hoytlee2000 hoytlee2000@ wrote: Hello, This is probably a silly question. I know to specify a var as bindable, I use this technique: [Bindable] private var foo:String; [Bindable] private var foo2:String; etc., etc., ... Is there a way to do this en' mass? or do I have to add [Bindable] above every var declared? Thanks, Hoyt
Re: [flexcoders] Bindable metadata too smart for its own good!
you're telling the flash player when to fire bindings on the listeners for your property. Sure, if you don't want to use their binding mechanism you could hook it all up yourself, but you'd have to make all your classes explicitly listen for the custom events you're firing. If you specify a custom Binding event for a property, you're just controlling when Flex will update everyone who's bound to that property, so the binding {} squiggly braces work in MXML and BindingUtils. So specify the event you want Bindings to fire on, then dispatch that event anywhere in your class to trigger anyone bound to that property and you're good to go. Also handy to provider a getter for calculated values and trigger the binding anytime something affecting the calculation has changed. On Fri, Apr 25, 2008 at 12:35 PM, Troy Gilbert [EMAIL PROTECTED] wrote: Ah, so if specify the event name, then bindable truly is just metadata, no code-generation, right? That sounds like the info I was looking for... Which leads me to think, what exactly is bindable doing for me at that point? If I'm firing the event (and thus creating it), is the metadata just helping the compiler issue a warning about bindings not firing for given properties? Is there anything else I'm getting? Do I get code-complete on the bindable event or anything like that (like I'd get if I added an Event metadata)? Troy.
Re: [flexcoders] Could the Flex Gurus shed some light on this behavior?
I believe since the content is a DisplayObject, it's just falling under normal Flex parenting rules, a child can only have a single parent, so using the same content actually re-parents the content object to the new SWFLoader. If your navigation window is just a small preview of the total app, like it sounds like, you could actually create a new Bitmap from the content of your main SWFLoader and use that as a new UIComponent in your navigation window. Not sure if you'd run into effeciency problems with how often you'd have to re-copy the data, but sounds like it could work in your situation. On Wed, Apr 23, 2008 at 12:06 PM, Mike Anderson [EMAIL PROTECTED] wrote: Hello All, For the longest time, I've been wondering why 2 Loader Controls, are unable to share the same content. Then again this may be by design, and my lack of knowledge relating to Flex could be why I don't understand this. For example, I have a SWFLoader Control which comprises the majority of my Application's desktop. It displays a loaded Map, in which users can drag icons onto the desktop, pan, zoom, as well as many other functions. I have a small navigator window that stays on top in a static position, in which the same content displayed in the SWFLoader, also gets displayed in the Navigator Control. The Navigator Control just gives the user an indication of the Map portion being displayed in the main window. In order to avoid having to load the SWF File TWICE, I thought I could set the content property of the Navigator Control, to the SWFLoader.contentLoaderInfo.content property - but when I do this, the loaded SWF disappears from the main screen, and appears in the small Navigator Window. Is this literally how things work in Flex? 2 data aware components can share the same ArrayCollection for their dataProvider Property, but 2 graphical display components, cannot share the same content? I would be grateful to hear the experts explanation on how this type of thing works within Flex. Thanks in advance for all your incredible help, Mike
Re: [flexcoders] Having difficulties cloning content within Loader Control
I believe you can draw any DisplayObject onto a BitmapData instance and get an Image that way. So something like var bmpData:BitmapData = new BitmapData(); bmpData.draw(loaderObject.content); var bmp:Bitmap = new Bitmap(bmpData); var image:Image = new Image(); image.source = bmp; that's all uncompiled untested code, but the idea should work. On Wed, Apr 23, 2008 at 9:34 PM, Mike Anderson [EMAIL PROTECTED] wrote: Hello All, I am attempting to clone a Vector Image contained within a Loader Control, and am having some problems. The only way I've seen this done before, is by using the Bitmap(loaderObject.content).bitmapData.clone() method, but maybe I am getting errors because it's a SWF File being loaded into the Loader, versus an actual Bitmap... If I wanted to clone the contents of a Loader, and place it into a simple mx:Image/ Control, what would be the best way to go about that? Thanks in advance for all your help, Mike
Re: [flexcoders] how to access current xml node name
should just be able to do xmlObj.name(); On Tue, Apr 22, 2008 at 8:58 AM, Derrick Anderson [EMAIL PROTECTED] wrote: i have a function which accepts XML as an argument, how can i retrieve the root node name for that XML? so if the xml was node2 attrib1=asdf... i need to get the 'node2' value. thanks, d.
[flexcoders] Determining visible and total rows in a List
If I want to add paging information to a list, ie there are 10 items in view and 40 total so you are on page 1/4, what is the best way to get that data. Obviously length of the dataProvider will give me total items, but how can I see how many are currently visible? Looks like there is a protected property visibleData in List, so if I subclass I could use that. Is that the best way to do it?
Re: [flexcoders] Live tiling
I've extended the Flex Dashboard from Adobe Devnet for a few applications. Pretty easy to take out the ability to close/minimize and you'd be left with a tiling container that supports maximization and drag/drop re-ordering. http://www.adobe.com/devnet/flex/samples/dashboard/dashboard.html You could also look at using something like FlowBox from the FlexLib project and add support for maximizing a single child to that. On Tue, Apr 22, 2008 at 11:36 AM, Richard Rodseth [EMAIL PROTECTED] wrote: I'm looking for a tiled layout that performs well during resizing of the browser window. The flexmdi approach below is very slow. Is there a way I can improve the event handling, or is flexmdi the wrong choice? I've thought of writing a container that does this sort of tiling, and supports maximize of one child (but no minimize/close/cascade), but I'm not sure I have the time to tackle that project. Alternatively, is there a good way to defer the re-tile until the resize is complete? Thanks. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:flexmdi=flexlib.mdi.containers.* layout=vertical creationComplete=init() horizontalScrollPolicy=off verticalScrollPolicy=off mx:Script ![CDATA[ import mx.events.ResizeEvent; private function init():void { mdic.windowManager.tile(false, 10); mdic.addEventListener(ResizeEvent.RESIZE,resize); } private function resize(event:Event):void { mdic.windowManager.tile(false, 10); } ]] /mx:Script flexmdi:MDICanvas id=mdic width=100% height=100% horizontalScrollPolicy=off verticalScrollPolicy=off flexmdi:MDIWindow title=One/ flexmdi:MDIWindow title=Two / flexmdi:MDIWindow title=Three / flexmdi:MDIWindow title=Four / flexmdi:MDIWindow title=Five / /flexmdi:MDICanvas /mx:Application
Re: [flexcoders] Collections with common source
I've used that approach many times. Store the data in a central model, views each have a local ArrayCollection with a filterFunction and the source set to the data in the model. On Wed, Apr 16, 2008 at 12:37 PM, Richard Rodseth [EMAIL PROTECTED] wrote: Hi I'm working on a dashboard where several charts share common data. I was thinking that each chart series could have a data provider which is a collection with a filter function, and I could set the source array of these collections to the same array. Sound reasonable? Thanks
Re: [flexcoders] Re: addEventListener and additional arguments?
Encapsulation is a good thing. The events themselves should hold all the data you need about the action as Ben said above. If you create new custom events you should make sure they have storage for all the properties any listener would need to know about what triggered the event, etc. If there's really something you need that isn't in the event you can make it a class variable and have access to it from the handler, stuff like state variables is a good example since you may be in a state where you don't need to take any action. On Wed, Apr 16, 2008 at 3:46 PM, ben.clinkinbeard [EMAIL PROTECTED] wrote: You probably don't need to send extra parameters anyways. You can inspect the event.target your handler receives to determine which button was clicked. (I am guessing that may be your intent in sending extra args as I remember doing stuff like that back in the AS1 days.) Suffice to say that any forking/special handling can/should be done in the handler rather than the initiator. HTH, Ben --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: You can call it anything you want. I call it strongly-typed languages and a good event model, and they prevent me from having mysterious hard-to-find errors because I mistyped a variable name, and allow me to hook up more than one handler to the event. From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Jason The Saj Sent: Wednesday, April 16, 2008 11:54 AM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Re: addEventListener and additional arguments? Okay then How do I do the simple act of click event call function and pass a parameter value? This was easy in AS1/AS2/JS I could essentially just say... btnFoo.release = function (parameters){...} Now, it looks like i need to add an event listener. Then create a custom event. All so I can pass a number to a function call. Um...can we say asinine? *** Please, some one show me a nice easy way.
Re: [flexcoders] Re: A script has executed for longer than the default timeout period of 15 seconds
When I get large datasets back from the server that could trigger multiple times, I add them to a WorkQueue which is a simple singleton class. It has an Array of tasks and a timer that fires every 200ms, it pops the next task off the Array and executes it. The Task object itself takes a Function and an Arguments Array. Works exactly like CallLater except it allows non UIComponents to defer work till the next frame. Pretty useful when you need to break things up and the work can be paired down to a function call with arguments. I believe Alex Harui also had a Pseudo-Threading example on his blog: http://blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html On Wed, Apr 16, 2008 at 5:14 PM, Gordon Smith [EMAIL PROTECTED] wrote: Canvas is a subclass of UIComponent. If you break up your lengthy computation into shorter chunks, you can also schedule them with Timer. Gordon Smith Adobe Flex SDK Team -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *markgoldin_2000 *Sent:* Wednesday, April 16, 2008 3:08 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Re: A script has executed for longer than the default timeout period of 15 seconds But I only can use callLater() if I have components based on UIComponent. I did not have any luck using it and my components are based basically on canvas. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Gaurav. Jain [EMAIL PROTECTED] wrote: If you are compiling with mxmlc, even though the error message says 15 seconds, the time out actually happens after 60 seconds. Currently there is no way to increase it. You should break down your code using callLater in order to give some CPU cycles to the player for screen updates. Thanks, Gaurav -Original Message- From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of markgoldin_2000 Sent: Wednesday, April 16, 2008 5:49 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] A script has executed for longer than the default timeout period of 15 seconds I am getting this error. At this point of my development I am not ready to start optimazing code. Are there any options available to encrease that time? Thanks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Re: Cairngorm ModelLocator array filter...
I probably do a little more work in views than other people. Our commands have a great deal of logic but most of that is for client/server communication. We have a fairly large application where most of the model data is shared. In my case it really doesn't make sense to have an event and a command for filtering the data since that filter will be unique to each view and what the user has chosen from a few filtering combox and a search box. It's also not making a trip to the server, so the change event on those view components trigger a refresh on the views local ArrayCollection which re-runs the data set through the filterFunction. And also keep in mind that copying an AC is a little lighter weight than it sounds since the AC is just a wrapper around the same underlying array. None of the data itself is being copied. I make heavy use of MVC and agree with all that's being said here, but I also try to do what seems to make the most sense in each application. On Mon, Apr 14, 2008 at 11:27 PM, ACE [EMAIL PROTECTED] wrote: You beat me by a few seconds... I agree that you should keep your logic in commands; which are the controller of your MVC architecture.
Re: [flexcoders] MVC - Philosophical question
I'm with Glenn on this. We use Cairngorm in our project, and since service lookup/communication is a delegate job it fits in well there. Our delegates grab a hold of a ServiceManager specific to the service it needs to send data to, and that ServiceManager has a send function that takes a few parameters, command name, objects to send, etc. That function builds up the URL from a base URL and the arguments and then sends the data. Most of these ServiceManagers are just wrappers around HTTPServiceManager so if we change our URL format it's all in a central location. The ServiceManager specifies one of our Responder objects related to the service its sending on, which parses out the response format, converts the response to appropriate VOs, and passes those back to the command, who updates the appropriate model. The models in our case just deal with pure VOs and know nothing about views or services or anything like that. Just a big data vault. On Tue, Apr 15, 2008 at 9:01 AM, Glenn Williams [EMAIL PROTECTED] wrote: I'm not so sure really. I do have some logic in the model. when I build URLS, I build them in the delegate before making the service call. as building URLs is service specific (i.e. the service could change, and do we really want the model to know about that?). on the other hand I suppose it depends really. it's all a matter a taste at the end of the day I tend to keep all Business logic away from the model and use commands and delegates. it's the delegates that do data transformation and I'd count building a URL with its parameters as data transformation. kind of like parsing data into a request so really you should think of it as part of the service call but as I said – it's just best to do what works for you. I'm sure everyone that answers will have a different view on this Glenn www.flex-ria.com www.tinylion.co.uk www.our-little-secret.com *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Jeffry Houser *Sent:* Tuesday, April 15, 2008 2:26 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] MVC - Philosophical question I'd put it in the model. The Controller is just supposed to facilitate communication between the View and the Model. Building a URL (or retrieving it from a database) is some form of business logic and that should go in the model. Cesare Rocchi wrote: Hi, I am developing an application which loads data from the internet. Many actions, many different urls, often built on the fly. Since I am enjoying mvc, where would you build the url? in the controller or in the model? -c. -- Jeffry Houser Flex, ColdFusion, AIR AIM: Reboog711 | Phone: 1-203-379-0773 -- Adobe Community Expert http://www.adobe.com/communities/experts/members/JeffryHouser.html My Company: http://www.dot-com-it.com My Podcast: http://www.theflexshow.com My Blog: http://www.jeffryhouser.com image001.jpg
Re: [flexcoders] View States Vs using the visible flag with multiple UI components..
I think if you wanted to reuse a single DataGrid and states, you would have to keep multiple Arrays representing the columns each DataGrid needed, and in your states set the columns property of the DataGrid to the appropriate Array of columns, and then set the dataProvider to the appropriate dataProvider for that grid. Could be done but might not be worth it? Keep in mind if you're toggling the visibility property and you're in a container that isn't absolutely laid out, the grids will still take up the same amount of space, it'll just be a big empty square. You'll also need to toggle the includeInLayout property. I believe this could be a pretty ineffecient mechanism thought because each invalidate/update pass on your parent container would be slowed down since these objects are still on the display list but are just ignored in the layout/measurement passes? I'm more of an ActionScript junkie than an MXML guy, so assuming all the grid properties except for columns and dataProvider were the same, I'd build the grid and columns in ActionScript and then swap them out in AS based on the comboBox or whatever the user is selecting to change the view. Just my 2 cents though. On Tue, Apr 15, 2008 at 7:58 AM, sk_acura [EMAIL PROTECTED] wrote: Hi All, I am trying to display multiple DataGrids in a Panel. User will have the option of switching between DataGrids. What's the advantages of having one DataGrid with multiple states (if that is possible).. I am planning to do it by defining one DataGrid ( as the Structure of these data grids are different) for each of my views and showing and hiding them depending on user selection. Could some one point out the pros cons of each approach.. Thanks Mars
Re: [flexcoders] pulling my hair out with e4x!!!
worked for me using this: debugModel.employees.node.(@display == Employee First Name) On Tue, Apr 15, 2008 at 10:43 AM, Derrick Anderson [EMAIL PROTECTED] wrote: can someone please explain why this does not return an XMLList? public var debugModel:XML = mergefields display=Merge Fields employees display=Employees node display=Employee First Name data=Employee_234234-234234-234234-234234 / node display=Employee Last Name data=Employee_234234-234234-234234-234234 / . var fieldNode:XMLList = debugModel.employees.node.(attribute(display) == Employee First Name); but this does... public var thePeople:XML = people person name=Mims Wright suffix=III age27/age akaMims H Wright/aka akaTeh AWesoeomes!/aka bio/bio /person . var fieldNode:XMLList = thePeople.person.(attribute(suffix) == III); i've tried a million different variations and i cannot get it to work with my XML- what am i doing wrong here? thanks, d.
Re: [flexcoders] BindingUtils question
Binding will not work with dynamic objects, which it sounds like you're using. I have a feeling your invisible text field trick is only working when you switch selectedItem. Seems like if you kept the same item selected and the TYPE property changed on that item, the binding would not fire, but since selectedItem was in your MXML binding chain, a binding will fire anytime you select a different item in the list, then it will pull out the TYPE property and update your text field. If you don't really need binding and just need to update when a selection changes, you could always listen for the itemClicked property or add a ChangeWatcher for the list.selectedItem property and call a function that pulls out the TYPE property and updates your currentOp object. On Tue, Apr 15, 2008 at 8:55 AM, Dominic Pazula [EMAIL PROTECTED] wrote: I have a List Component whose dataProvider is an ArrayCollection of generic objects. I have another object I would like to bind a property of to a property to the selectedItem of the List. I have: BindingUtils.bindProperty (currentOp,type,this.columnList.selectedItem,TYPE); No go... I see that the binding util cannot work with the property TYPE on the generic object, does not implement IEventDispatcher, etc. I get why it doesn't work. So if I add mx:Text id=selectedType text={this.columnList.selectedItem.TYPE} visable=false/ and BindingUtils.bindProperty(currentOp,type,this.selectedType,text); it works. I would prefer NOT to have a bunch of invisible text fields running around. How can I accomplish this in AS? Thanks Dom
Re: [flexcoders] Re: BindingUtils question
Honestly I would first look into replacing your Objects with strongly typed objects, just create a simple class to represent your properties and make the Class Bindable. Accessing properties of a strongly typed object versus a dynamic Object is a considerable performance boost if you have a lot of data floating around. The Flex help has a pretty in-depth data-binding chapter that is a good reference: http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_2.html On Tue, Apr 15, 2008 at 11:25 AM, Dominic Pazula [EMAIL PROTECTED] wrote: Daniel, Thanks for the reply. You are correct, the text trick works because of the change on the selected item. This is what I am trying to programatically define. The List contains static items. I need a property on an object bound to a property of the selectedItem. I will look into the ChangeWatcher class. I'm still trying to learn and understand how Binding works. If you know of a good tutorial or explanation, could you please let me know. Thanks Dominic --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote: Binding will not work with dynamic objects, which it sounds like you're using. I have a feeling your invisible text field trick is only working when you switch selectedItem. Seems like if you kept the same item selected and the TYPE property changed on that item, the binding would not fire, but since selectedItem was in your MXML binding chain, a binding will fire anytime you select a different item in the list, then it will pull out the TYPE property and update your text field. If you don't really need binding and just need to update when a selection changes, you could always listen for the itemClicked property or add a ChangeWatcher for the list.selectedItem property and call a function that pulls out the TYPE property and updates your currentOp object. On Tue, Apr 15, 2008 at 8:55 AM, Dominic Pazula [EMAIL PROTECTED] wrote: I have a List Component whose dataProvider is an ArrayCollection of generic objects. I have another object I would like to bind a property of to a property to the selectedItem of the List. I have: BindingUtils.bindProperty (currentOp,type,this.columnList.selectedItem,TYPE); No go... I see that the binding util cannot work with the property TYPE on the generic object, does not implement IEventDispatcher, etc. I get why it doesn't work. So if I add mx:Text id=selectedType text={this.columnList.selectedItem.TYPE} visable=false/ and BindingUtils.bindProperty (currentOp,type,this.selectedType,text); it works. I would prefer NOT to have a bunch of invisible text fields running around. How can I accomplish this in AS? Thanks Dom
Re: [flexcoders] Re: BindingUtils question
so I'm guessing your constructor is setting these properties from XML? If you bind to a read only property of an Object, the binding will fire when object reference changes, so if it was null and then you created the object the binding would fire once. If you have a method on the object that updates its properties via XML or some other mechanism, you will have to trigger the Binding yourself from that method. For example, you would declare your getter Bindable with a custom event like [Bindable(event=myPropUpdated)] public function get myProp():String { return _myProp; } public function updateProps(xml:XML):void { _myProp = [EMAIL PROTECTED]; dispatchEvent(new Event(myPropUpdated)); } On Tue, Apr 15, 2008 at 1:20 PM, Dominic Pazula [EMAIL PROTECTED] wrote: Thanks for the information. I am in the process of moving what I can to typed classes. Unfortunately that data comes from our server component and it will take a while before our Java guy can get to it on his end. One last question. I have a custom class, extends EventDispatcher, declared as [Bindable]. It has a read-only status property. I have tried binding things to it like: mx:Text text={myCustomObj.status}/ In the case above, I cannot get the text to update when the object updates. Do I need the class to dispatch a specific event to trigger the binding to update? Thanks Dominic --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote: Binding will not work with dynamic objects, which it sounds like you're using. I have a feeling your invisible text field trick is only working when you switch selectedItem. Seems like if you kept the same item selected and the TYPE property changed on that item, the binding would not fire, but since selectedItem was in your MXML binding chain, a binding will fire anytime you select a different item in the list, then it will pull out the TYPE property and update your text field. If you don't really need binding and just need to update when a selection changes, you could always listen for the itemClicked property or add a ChangeWatcher for the list.selectedItem property and call a function that pulls out the TYPE property and updates your currentOp object. On Tue, Apr 15, 2008 at 8:55 AM, Dominic Pazula [EMAIL PROTECTED] wrote: I have a List Component whose dataProvider is an ArrayCollection of generic objects. I have another object I would like to bind a property of to a property to the selectedItem of the List. I have: BindingUtils.bindProperty (currentOp,type,this.columnList.selectedItem,TYPE); No go... I see that the binding util cannot work with the property TYPE on the generic object, does not implement IEventDispatcher, etc. I get why it doesn't work. So if I add mx:Text id=selectedType text={this.columnList.selectedItem.TYPE} visable=false/ and BindingUtils.bindProperty (currentOp,type,this.selectedType,text); it works. I would prefer NOT to have a bunch of invisible text fields running around. How can I accomplish this in AS? Thanks Dom
Re: [flexcoders] pulling my hair out with e4x!!!
I've never used the attribute syntax you're using, so I'm not familiar with it, but in your first employee example this syntax returned the matching node, have you tried it? debugModel.employees.node.(@display == Employee First Name) looks like you added another level in your latest example so for that case this should return the node: debugModel.group.(@label == Employees).node.(@label == Employee First Name) On Tue, Apr 15, 2008 at 1:04 PM, Derrick Anderson [EMAIL PROTECTED] wrote: thanks guys, i'm sure that my xml is valid, i've refined what i'm trying to do here a bit public var debugModel:XML = mergefields label=Merge Fields group label=Employees node label=Employee First Name data=Employee_234234-234234-234234-234234 / node label=Employee Last Name data=Employee_1-11-11-11 / node label=Last Performance Note Date data=Employee_234234-234234-234234-234234 / node label=Login data=Employee_234234-234234-234234-234234 / node label=Login Link data=Employee_234234-234234-234234-234234 / /group ... what i'm trying to do is find any node that has a certain label, like so var fieldNode:XMLList = debugModel.children().node.(attribute(label) == Employee First Name); and no matter what i try it is not working, what it seems to be doing is returning me all children of the node i'm looking for (there are none). if I give that node some arbitrary child nodes, then the node is returned with it's children, what gives?. d. On Tue, Apr 15, 2008 at 1:22 PM, Varun Shetty [EMAIL PROTECTED] wrote: make sure that your xml is wellformed it did work for me. --- code ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical initialize=runthis(); mx:Script ![CDATA[ public var debugModel:XML = mergefields display=Merge Fields employees display=Employees node display=Employee First Name data=Employee_234234-234234-234234-234234 / node display=Employee Last Name data=Employee_234234-234234-234234-234234 / node display=Employee First Name data=Employee_1212121-121212-12121-12112121 / node display=Employee Last Name data=Employee_1212121-121212-12121-12112121 / /employees /mergefields; public function runthis():void { var fieldNode:XMLList = debugModel.employees.node.(attribute(display) == Employee First Name); trace(fieldNode); } ]] /mx:Script /mx:Application --- code On Tue, Apr 15, 2008 at 11:43 AM, Derrick Anderson [EMAIL PROTECTED] wrote: can someone please explain why this does not return an XMLList? public var debugModel:XML = mergefields display=Merge Fields employees display=Employees node display=Employee First Name data=Employee_234234-234234-234234-234234 / node display=Employee Last Name data=Employee_234234-234234-234234-234234 / . var fieldNode:XMLList = debugModel.employees.node.(attribute(display) == Employee First Name); but this does... public var thePeople:XML = people person name=Mims Wright suffix=III age27/age akaMims H Wright/aka akaTeh AWesoeomes!/aka bio/bio /person . var fieldNode:XMLList = thePeople.person.(attribute(suffix) == III); i've tried a million different variations and i cannot get it to work with my XML- what am i doing wrong here? thanks, d.
Re: [flexcoders] pulling my hair out with e4x!!!
toXMLString is almost always the way to go. I hit a major problem related to that early on in our application. I was passing XML objects to the server in an httpService.send(xml), this method will call toString on the objects you pass it to shove them in the HTTP parameters. if you have no children in your XML object, toString returns empty string, and it took me quite a while to figure out why the server wasn't getting any data from my flex app. Now I make sure to explicitly call toXMLString if I'm sending XML objects on my services. I've seen plenty of other posts about this and was actually wondering why toXMLString is not the default string representation of an XML object? On Tue, Apr 15, 2008 at 2:48 PM, Gordon Smith [EMAIL PROTECTED] wrote: You probably want to use toXMLString() rather than toString(). Note that the cause of your problem wasn't in the code that you posted. That's a reason why it's best to post a complete non-working sample. Gordon Smith Adobe Flex SDK Team -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Derrick Anderson *Sent:* Tuesday, April 15, 2008 12:20 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] pulling my hair out with e4x!!! yes, i tried it and have it working now- mostly user error but I must say not being able to debug e4x expressions has ruined my day on many occasions. i was using toString on the xml list, thinking it would show me the xml node it found and children (if any), toString was returning nothing and a length of 0 so I assumed nothing was coming back. when i added children, the toString started showing me the node i was trying to find. so, the blank response held the object i was looking for- but toString was not showing it. thanks for your help on this! d. On Tue, Apr 15, 2008 at 2:53 PM, Daniel Gold [EMAIL PROTECTED] wrote: I've never used the attribute syntax you're using, so I'm not familiar with it, but in your first employee example this syntax returned the matching node, have you tried it? debugModel.employees.node.(@display == Employee First Name) looks like you added another level in your latest example so for that case this should return the node: debugModel.group.(@label == Employees).node.(@label == Employee First Name) On Tue, Apr 15, 2008 at 1:04 PM, Derrick Anderson [EMAIL PROTECTED] wrote: thanks guys, i'm sure that my xml is valid, i've refined what i'm trying to do here a bit public var debugModel:XML = mergefields label=Merge Fields group label=Employees node label=Employee First Name data=Employee_234234-234234-234234-234234 / node label=Employee Last Name data=Employee_1-11-11-11 / node label=Last Performance Note Date data=Employee_234234-234234-234234-234234 / node label=Login data=Employee_234234-234234-234234-234234 / node label=Login Link data=Employee_234234-234234-234234-234234 / /group ... what i'm trying to do is find any node that has a certain label, like so var fieldNode:XMLList = debugModel.children().node.(attribute(label) == Employee First Name); and no matter what i try it is not working, what it seems to be doing is returning me all children of the node i'm looking for (there are none). if I give that node some arbitrary child nodes, then the node is returned with it's children, what gives?. d. On Tue, Apr 15, 2008 at 1:22 PM, Varun Shetty [EMAIL PROTECTED] wrote: make sure that your xml is wellformed it did work for me. --- code ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical initialize=runthis(); mx:Script ![CDATA[ public var debugModel:XML = mergefields display=Merge Fields employees display=Employees node display=Employee First Name data=Employee_234234-234234-234234-234234 / node display=Employee Last Name data=Employee_234234-234234-234234-234234 / node display=Employee First Name data=Employee_1212121-121212-12121-12112121 / node display=Employee Last Name data=Employee_1212121-121212-12121-12112121 / /employees /mergefields; public function runthis():void { var fieldNode:XMLList = debugModel.employees.node.(attribute(display) == Employee First Name); trace(fieldNode); } ]] /mx:Script /mx:Application --- code On Tue, Apr 15, 2008 at 11:43 AM, Derrick Anderson [EMAIL PROTECTED] wrote: can someone please explain why this does not return an XMLList? public var debugModel:XML = mergefields display=Merge Fields
Re: [flexcoders] Cairngorm ModelLocator array filter...
depends on your architecture and what feels best in your project. Problem with filtering an ArrayCollection directly in the model is that any views bound to that model will also be filtered. Usually I have a large dataset in an ArrayCollection in the model, and have a view that might have a search box that filters items in a list. I create a new ArrayCollection in that view, set the arrayCollection.source = modelLocator.dataArrayCollection.source, and then apply a filterFunction to the local arrayCollection specific to that view. That way each view has ways of filtering its own local ArrayCollection wrapper around the same data set in the model. But to each their own. Depends on how shared the data is and how you like to keep things divided On Mon, Apr 14, 2008 at 1:49 PM, hworke [EMAIL PROTECTED] wrote: Hi I am using Cairngorm and in my ModelLocator I do have an array. I want to filter that array with a filter function. My question is where do I put this filter function: in a separate file or in the ModelLocator class?
[flexcoders] Initializing styles for custom border skin
I'm apparently still having problems grasping custom border skins. I'm extending RectangularBorder and I have a few custom CSS styles declared for my class. I'm trying to set defaults for these styles using the static function method private static const DEFAULT_STYLE_NAME:String = AngledRightBorder; private static var _stylesInitialized:Boolean = initStyles(); private static function initStyles():Boolean { var styleDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration(DEFAULT_STYLE_NAME); // If there's no default style declaration already, create one. styleDeclaration = styleDeclaration ? styleDeclaration : new CSSStyleDeclaration(); styleDeclaration.defaultFactory = function ():void { this.angleWidth = 10; this.borderThickness = 3; } StyleManager.setStyleDeclaration(DEFAULT_STYLE_NAME,styleDeclaration,true); return true; } but the defaultFactory function never runs because the styleName is never set for the borderSkin, it is always null, it seems to just inherit properties from the class that is declaring it. Is there some trick I'm missing on how to set default styles for a border skin? I've come up with something that seems to work but I'm sure there are some holes in it. Basically I override getStyle, and attempt to get the style, if it's null I get the DEFAULT_STYLE_NAME css declaration and pull the style out of that. The problem there is if I want to specify a different default for a style this is already set for the styleName of the class using my borderSkin, I can't because getStyle will return the default set for that class instead of my borderSkin class. At least it works for the new custom styles defined by my class. Any thoughts? This is my current hack, but as mentioned above only works if a style of null is returned, so I can't override defaults set by the class using the borderSkin override public function getStyle(styleProp:String):* { var style:* = super.getStyle(styleProp); if(style == null) { var styleDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration(DEFAULT_STYLE_NAME); style = styleDeclaration.getStyle(styleProp); } return style; }
Re: [flexcoders] How to display a button's icon from a remote source?
Sure switching on the type of an argument to a setter would work, for some reason I thought the 'source' on an image was a style instead of a property. I try to expose as many styles as possibly for custom components so they're easily skinnable in CSS, but I guess there's no way to expose a style that allows multiple types. Would have to have iconClass and iconPath styles if I wanted it to be flexible for embedded or runtime assets. Thanks for the reality check on SWFLoader, I was off in the weeds. On Sat, Apr 5, 2008 at 3:33 PM, Tracy Spratt [EMAIL PROTECTED] wrote: Oooops. I'd best slow down a bit. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Rick Winscot *Sent:* Friday, April 04, 2008 9:55 PM *To:* flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] How to display a button's icon from a remote source? Tracy… Dr. McCoy of Star Trek fame said it best. Damnit Jim, I'm a –class– not an externally loaded asset. – Through the Loader Class …universal translation… The Icon takes a class as an argument… not an externally loadable asset. Dynamically loading an image (for a button) is more difficult – but still possible. Ben Stucki has done some marvelous work in that arena. Ping me off line if you need the hook up. Rick Winscot *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Tracy Spratt *Sent:* Friday, April 04, 2008 9:11 PM *To:* flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] How to display a button's icon from a remote source? Just set source=[url] Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *guillaumeracine *Sent:* Friday, April 04, 2008 7:20 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] How to display a button's icon from a remote source? Hi, i know we can set the icon of a button using this syntax: mx:Button label=myBtn icon=@Embed(source='assets/slideshow/1.png')/ but my image icon is on a remote server... How i can set the icon of a button from a remote source?
Re: [flexcoders] Drop anywhere to remove
I would think you'd have to write completely custom drag functions that listen for mouse down on your component, and then on mouse move keep listening for the target to not be your container, as soon as it isn't, accept the DragDrop and start listening for mouse up to handle the removal. I keep this doc handy for anytime I get into custom drag situations: http://blogs.adobe.com/flexdoc/pdf/dragdrop.pdf On Sat, Apr 5, 2008 at 11:38 AM, [EMAIL PROTECTED] wrote: Thanks. Do you have an example? Can you tell it to remove it if it's dragged *anywhere*? cheers, David *Bob Wohl [EMAIL PROTECTED]* Sent by: flexcoders@yahoogroups.com 04/04/2008 06:59 PM Please respond to flexcoders@yahoogroups.com To flexcoders@yahoogroups.com cc Subject Re: [flexcoders] Drop anywhere to remove Yes, would work the same as your 'drag to container', just a different target to drop to. B. On Fri, Apr 4, 2008 at 3:09 PM, newflexer [EMAIL PROTECTED][EMAIL PROTECTED] wrote: Hi, We have a container we can drag and drop objects to, and would like to remove them by allowing users to drag and drop them anywhere outside of the container. Is this possible?
Re: [flexcoders] Drop anywhere to remove
Well after trying to write a quick example now I'm not so sure. The document I linked to earlier has this statement: A control must define a handler for a dragEnter event to be a drop target. That leads me to believe every other container in the application would have to add a dragEnter handler in order for your drag anywhere to be implemented. Each container has to explicitly accept the drop with DragManager.acceptDragDrop() On Sun, Apr 6, 2008 at 9:08 AM, Daniel Gold [EMAIL PROTECTED] wrote: I would think you'd have to write completely custom drag functions that listen for mouse down on your component, and then on mouse move keep listening for the target to not be your container, as soon as it isn't, accept the DragDrop and start listening for mouse up to handle the removal. I keep this doc handy for anytime I get into custom drag situations: http://blogs.adobe.com/flexdoc/pdf/dragdrop.pdf On Sat, Apr 5, 2008 at 11:38 AM, [EMAIL PROTECTED] wrote: Thanks. Do you have an example? Can you tell it to remove it if it's dragged *anywhere*? cheers, David *Bob Wohl [EMAIL PROTECTED]* Sent by: flexcoders@yahoogroups.com 04/04/2008 06:59 PM Please respond to flexcoders@yahoogroups.com To flexcoders@yahoogroups.com cc Subject Re: [flexcoders] Drop anywhere to remove Yes, would work the same as your 'drag to container', just a different target to drop to. B. On Fri, Apr 4, 2008 at 3:09 PM, newflexer [EMAIL PROTECTED][EMAIL PROTECTED] wrote: Hi, We have a container we can drag and drop objects to, and would like to remove them by allowing users to drag and drop them anywhere outside of the container. Is this possible?
Re: [flexcoders] Need to change the viewstack from a child container
if your structure is that simple, in the child you could do parent.selectedChild = newChild. It depends in what scope the code is executing. If your viewstack and children are defined in a single MXML file, then in a script block myviewstack would still be in scope and myviewstack.selectedChild would work. When dealing with similar situations my approach is to have the child dispatch a custom event, and have that event bubble and be handled by any appropriate listeners. So your viewstack could add an event listener for the ChangeChildView event, and that event could define a child index or enum representing the child to switch to. Then your children views dispatch the ChangeChildView event without being aware of any details about how it will be handled. On Fri, Apr 4, 2008 at 2:49 PM, Rubeel [EMAIL PROTECTED] wrote: Hoe can i change the viewstack from a child container. lets say if i have a viewstack and i move to a child by using the selectedChild property, can i call myviewstack.selectedChild from the child itself thanx in advance
Re: [flexcoders] Flex newbie stuck with DataGrid headerRenderer
I've seen a few different approaches to the checkbox grid. Alex has a clean implementation, but without the select all header renderer. I believe Josh Tynjala has a few checkbox list components as well http://www.zeuslabs.us/ My take on the checkbox datagrid with a header renderer can be found at http://www.thegoldhold.com/?p=4 Full source available if you want to hack on it for your own needs. On Fri, Apr 4, 2008 at 12:11 PM, Alex Harui [EMAIL PROTECTED] wrote: There are some headerRenderer examples on my blog ( blogs.adobe.com/aharui). You have to subclass and override the data setter and expect a DataGridColumn. The default code doesn't handle that. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Myth Kumar *Sent:* Friday, April 04, 2008 8:43 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Flex newbie stuck with DataGrid headerRenderer Hi Friends, I have a DataGrid with the first column acting as a selection column, where I've successfully rendered a Checkbox. Now I want to add a toggle button to the headerRenderer such that toggling the button would select/deselect all the checkboxes in the datagrid. For this, my code is something like this: DataGrid id=dtaMats width=100% height=100% horizontalScrollPolicy=off columns DataGridColumn headerText=Select dataField=isSel width=40 textAlign=center headerRenderer=DataGridHeaderButton itemRenderer Component CheckBox selected={data.isSel} click={data.isSel=!data.isSel}/ /Component /itemRenderer /DataGridColumn DataGridColumn headerText=Material dataField=Matnr/ DataGridColumn headerText=Plant dataField=Werks/ DataGridColumn headerText=Storage dataField=Lgort/ /columns /DataGrid I'm setting the dataProvider at runtime in the AS code, after getting the data from the webservice. And my custom button header class is like this: package { import mx.controls.Button; public class DataGridHeaderButton extends Button { public function DataGridHeaderButton() { //TODO: implement function super(); super.toggle = true; super.label = Select All; } } } But I get an error: ReferenceError: Error #1069: Property isSel not found on mx.controls.dataGridClasses.DataGridColumn and there is no default value. when I try to run this code. It runs fine without the 'headerRenderer' property set, but errors with it. Can you please suggest me how can I get around it? Do I have to override some functions of the Button class? If yes which ones would help me?
Re: [flexcoders] How to display a button's icon from a remote source?
I get asked this by new Flex developers I work with all the time, especially people from a more traditional web development background who are not used to embedding assets. Here's something that bugged me a while back and I never took the time to look into: So the button icon takes a Class, that's all good and well, but how does the Image class get by accepting either a Class OR a String representing the path to an image to load at runtime? The source style allows both doesn't it? If I was creating a custom component and wanted to add an imageSource custom style would that be possible? On Fri, Apr 4, 2008 at 8:55 PM, Rick Winscot [EMAIL PROTECTED] wrote: Tracy… Dr. McCoy of Star Trek fame said it best. Damnit Jim, I'm a –class– not an externally loaded asset. – Through the Loader Class …universal translation… The Icon takes a class as an argument… not an externally loadable asset. Dynamically loading an image (for a button) is more difficult – but still possible. Ben Stucki has done some marvelous work in that arena. Ping me off line if you need the hook up. Rick Winscot *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Tracy Spratt *Sent:* Friday, April 04, 2008 9:11 PM *To:* flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] How to display a button's icon from a remote source? Just set source=[url] Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *guillaumeracine *Sent:* Friday, April 04, 2008 7:20 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] How to display a button's icon from a remote source? Hi, i know we can set the icon of a button using this syntax: mx:Button label=myBtn icon=@Embed(source='assets/slideshow/1.png')/ but my image icon is on a remote server... How i can set the icon of a button from a remote source?
Re: [flexcoders] Sizing when dealing with custom borderSkin
So what is the approach to use for non-rectangular borders? If someone has some good resources for programmatic border skins I'll happily digest them, I've read anything I can find. So let's say I've got a VBox and I create a custom skin that tapers the right side into a point. I extend Border because it's not rectangular in nature, can I not use this skin with Flex containers? Do I need custom containers that work with borderSkins that are not rectangular? On Tue, Apr 1, 2008 at 11:28 PM, Alex Harui [EMAIL PROTECTED] wrote: You may have to implement IRectangularBorder -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Danny Gold *Sent:* Tuesday, April 01, 2008 1:23 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Sizing when dealing with custom borderSkin I've created a programmatic border skin that extends 'Border', but something seems a little off. I override the get borderMetrics function to return the EdgeMetrics object representing how large my custom border is, and I override updateDisplayList to draw the border. That's pretty much all this is in my skin class. When I use this skin on a container of some sort like a VBox, if I view the borderMetrics property of the VBox, it is all 0s, and the VBox doesn't seem to be taking the borderMetrics of its borderSkin property into account. Let's say the right side of my skin needs 20 pixels. The VBox contents seem to be drawn over my border skin instead of stopping 20 pixels before the width of the container to allow for the skin. Did I miss something? This is the first time I've written a programmatic borderSkin.
Re: [flexcoders] How to scroll to/navigate to an object in an app??
With a reference to the object you can get it's coordinates within the container that is scrolling. If it is nested you will have to get its index withing it's parent container, convert that to global coordinates, then convert that to the local coordinates of the scrolling container. From there you can set the vertical scroll position of your container to bring the object into view. On Mon, Mar 31, 2008 at 8:53 AM, anthony_morsey [EMAIL PROTECTED] wrote: I want to be able to scroll to the vertical position of an object in a flex app. I want to be able to click on an htmlText anchor tag and have the app scroll down to an object that is out of the viewable area. My app has a scrollbar. If this cannot be done using htmlText and anchors, then how would I do it with just actionscript? Tony
Re: [flexcoders] Best practice for filtering a large dataset
Well my thought was that it would actually be quicker to do it on the client since the data is there, instead of asking the server to filter and return matching IDs into the dataset I already have, so filtering under a progress bar on the client would be a better user experience to me. So breaking the filtering up into chunks is great and all, but does that basically mean extending ArrayCollection and overriding how it handles filterFunctions to break the work into specified chunk size and dispatch progress events as it goes? On Wed, Mar 26, 2008 at 9:44 AM, Tom Chiverton [EMAIL PROTECTED] wrote: On Wednesday 26 Mar 2008, Danny Gold wrote: operation? Would this even help me because the UI will be blocked while the filter is running anyways? I think I've optimized my You could break your filtering up into K chunks of N items, and use a ProgressBar to indicate something was happening. That wouldn't be too bad. Maybe the solution is to go server-side so I can show a processing screen, but just seems wasteful since the client has everything it needs. You have to think of the user experience - do they care it's a server round trip if it's quicker ? -- Tom Chiverton Helping to seamlessly grow granular services on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: How do I call a custom tooltip function for my TabBar items?
What kind of children are you adding to the TabBar? I have a tabbed based app where the children all extend Panel and are located in separate MXML files. I simply set the toolTip=Custom tooltip text in the attribute of the root MXML tab and each child shows its own tooltip when hovered. Is that what you're looking for? Even if you're creating and adding the children in AS you should be able to set the toolTip for each one to the string you want. The components will handle displaying their tooltips on their own.