[flexcoders] Re: How to extract data from XML
OMFG the namespace was the problem. After I added that line I was able to call Alert.show(myXML.logo.toXMLString()); and it worked like a charm. Thanks now I can finally start doing stuff with my application. This snag has been holding me up for a few days. One last thing, how would I go about extracting just what is between the tags logo and /logo instead of the entire element and attributes? Would I have to convert it to a single XML object first like you said? Or is there some function that can do that? Thanks for all your help Tracy, I'm starting to understand how XML works now because of you. -Leighton --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Ok, you may have a namespace problem. They can be a PITA. I'm not an expert and you should reveiw the docs/google if this doesn't work but try putting this in the declarations section of your app/component(instance scope level): default xml namespace = http://www.w3.org/2005/Atom;; There is more stuff in the xmlns declaration in your sample xml: feed xmlns=http://www.w3.org/2005/Atom http://www.w3.org/2005/Atom ... I do not understand what that second part of the string is. You might have to include that as well in the default namespace declaration. You can avoid the namespace issue if you use the node index to get a node, but this is a very clunky way to do it. To see, try: Alert.show(myXML.children()[4].toXMLString()) XMLList always has 0-n xml nodes in it. (the result of an e4x expression is never null) If there is only one node, then many of the XML methods will work on it the same as with XML. But for clarity, if I know I want to work with a single XML node then I do: var myXMLList:XMLList = myXML.logo; var xmlLogo:XML = myXMLList[0]; If just you do this below, you will get a datatype error: var xmlLogo:XML = myXML.logo; //even if that expression returns only a single node. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of wild.katana Sent: Thursday, May 22, 2008 7:08 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: How to extract data from XML Okay, first of all, thanks for all of your help, Tracy. I have checked the myXML variable with Alert.show(myXML) and it shows what I pasted in the first post (that's where I got it). So I know that myXML contains that. I tried doing Alert.show(myXML.logo.toXMLString()) but it is still showing nothing. I have read the documentation on using XML and tried many of the things it says, but to no avail. One thing I don't wuite understand... What is the difference between XML and XMLList? If the myXML.logo returns an XMLList, then should I make a variable that contains it first? Like var myXMLList:XMLList = myXML.logo; Alert.show(myXMLList); ? I will try that but let me know if that is what you were meaning or not... Thanks again.. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tspratt@ wrote: First, did you trace or alert your XML in yur result handler? If you did not and are assuming you know what your xml looks like exactly, do that now. Second, when attempting to view XML, always use toXMLString() (search the archives for why): Alert.show(myXML.logo.toXMLString()) Third, when writing e4x expressions, unless you are very certain of yourself, it is best to do it one step at a time, using temporary XML or XMLList variables as needed, and tracing the contained value using toXMLString(). Note that all e4x expressions(myXML.logo is one) return XMLList, not XML. The docs will show how to handle this. Fourth, review the XML class in the language Ref and the working with data cha[ter in the developers guide for an explanation on how to work with XML. The link below is for Flex 2, but the XML stuff has not changed. http://livedocs.adobe.com/flex/2/docs/1910.html http://livedocs.adobe.com/flex/2/docs/1910.html Tracy From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of wild.katana Sent: Thursday, May 22, 2008 4:00 AM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] How to extract data from XML Hello, I have loaded an XML from a URL using URLLoader. Now that I have it in an object, how do I access individual parts of that data? The XML looks like this: feed xmlns=http://www.w3.org/2005/Atom http://www.w3.org/2005/Atom http://www.w3.org/2005/Atom http://www.w3.org/2005/Atom xmlns:openSearch=http://a9.com/-/spec/opensearchrss/1.0/ http://a9.com/-/spec/opensearchrss/1.0/ http://a9.com/-/spec/opensearchrss/1.0/ http://a9.com/-/spec/opensearchrss/1.0/
[flexcoders] callLater, FPS, and lengthy background operations
Hi Guys, If I have a long list of things to process as a background task, I figure a good way to do it is a piece at a time with callLater(). However I'd like to be able to detect if I'm taking too long per block and running into the next frame. Also, I'd like to do more per cycle if my app finds itself running on a ninja machine :) Anyone have any tips for this sort of thing? Should I just be using the timer and striving for 1/4 of a frame measured in ms? What framerate are Flex SWFs set to run at normally? Cheers, -J -- 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] callLater, FPS, and lengthy background operations
Framerates by default are set to 40 FPS. If you happen to have a reference to the stage, you can use the stage.frameRate property. That way you have a solution for all frame rates. I would use an enterFrame solution like callLater, then just check the time within a while loop. Greetz Erik On 5/24/08, Josh McDonald [EMAIL PROTECTED] wrote: Hi Guys, If I have a long list of things to process as a background task, I figure a good way to do it is a piece at a time with callLater(). However I'd like to be able to detect if I'm taking too long per block and running into the next frame. Also, I'd like to do more per cycle if my app finds itself running on a ninja machine :) Anyone have any tips for this sort of thing? Should I just be using the timer and striving for 1/4 of a frame measured in ms? What framerate are Flex SWFs set to run at normally? Cheers, -J --
Re: [flexcoders] AIR capabilities
You can only open a socket if the server at the other hand has allows it on port 843. As far as I know you can only do simple requests and have no access to the response in terms of header and body. If I can't do any of that, are there plans to allow AIR apps to be Java with a Flex / Flash UI and some sort of nice communication layer between them? I am not sure if there are any plans like this. I think the top most requested feature is the ability to run 3rd party applications with AIR, but so far it is not possible. I am not aware of any java application that has a Flash player embedded for it GUI, not sure if it exists though. Greetz Erik On 5/24/08, Josh McDonald [EMAIL PROTECTED] wrote: Hey guys, Apologies if this is an FAQ but I can't seem to find straight answers via google. I'm about to start work on an app, and I'd prefer to use AIR over Swing or JavaFX - I'm just wondering exactly what capabilities you get on top of Flex with AIR besides file read/write. Specifically, a few of the following things: - Can I get http response bodies when I get a 500 from a remote server? - Can I make http requests other than GET and POST? - If not, can I open a socket? If I can't do any of that, are there plans to allow AIR apps to be Java with a Flex / Flash UI and some sort of nice communication layer between them? Is there a third party solution that does 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]
RE: [flexcoders] Re: Flash USB-API :)
There is an obvious solution: Flex/AIR - Web Services (or similar) - USB ... but _direct_ communication with USB? I'm stumped as to why you would even need something like this. What is your use case? Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Cato Paus Sent: Friday, May 23, 2008 9:35 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flash USB-API :) Hehe Totaly Agree with you on Joe Random, but I put my trust on Adobe to find a solution :) --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tom Chiverton [EMAIL PROTECTED] wrote: On Thursday 22 May 2008, Cato Paus wrote: I realy hope we can have USB communication in AIR and Flash Player :) USB communication from a web site ? I think not... unless you want Joe Random reading all your data. For AIR this makes more sense. -- Tom Chiverton 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. attachment: winmail.dat
[flexcoders] Multiple ItemRenderers for a single DataGridColumn
I have a DataGrid and one of the columns I need to be able to do the following based on the user security setting and the data in the column. So each row in the DataGrid for a single user may have different behavior and ItemRenderers. 1. Do not show any data and mark the cell not editable. Still show the column, just blank out the cell and do not allow editing. 2. Allow the user to see the data, but not edit it. I would like this to simply show as a Text field. 3. Display the data, and allow the user to edit the data via a TextInput control. 4. Display the data, and allow the user to edit the data via showing a CheckBox control. I know how to do each individually, but I do not know how to do this all at the same time in a single DataGridColumn. Can I do this? Thanks, Dale
[flexcoders] AS3 regexp doesnt implement lookbehind?
Hey people! I'm playing here with some RegExp stuff. Should have learned it long time ago tho I started just recently. So, i was playing with syntax highlighter in AS3 and stumbled upon difficulties on how to match doc tag inside block comment. After several hours I came up with genius expression - /(?=\/\*(?:[^*]|\*[^*\/])*)(@\w*)/mg It works perfectly in text editor I'm using to test expressions but it halts in AS3. Each of the groups select what they are supposed to perfectly, but they do not work togeather. I did some googling and couldnt find definitive answer what might be the problem. So, could it be that AS3 RegExp engine doesn't implement lookbehind? Can anyone confirm that or maybe someone knows how comet that bastid doesn't work in AS3? thanks in advance Jānis
Re: [flexcoders] custom event not added
fire? As in scrap and rewrite? dnk On 23-May-08, at 10:25 PM, Josh McDonald wrote: If you're getting a runtime error accessing Application.application you'll need fire to clean this up, methinks. -J On Sat, May 24, 2008 at 3:02 PM, dnk [EMAIL PROTECTED] wrote: That added an error: Access of undefined property Application researching that now... d On 23-May-08, at 9:35 PM, Josh McDonald wrote: The only thing i can think of after looking at that is that your controller (whatever that is) is not part of the display tree? Try replacing dispatchEvent() with Application.application.dispatchEvent() and see if it works then. -J On Sat, May 24, 2008 at 2:28 PM, dnk [EMAIL PROTECTED] wrote: It is dispatched like this (in function in my controller): dispatchEvent(new GetNewsEvent(GetNewsEvent.GET_NEWS_EVENT, null, false, false)); the null is used for an object (if I need to pass data with my event). In this particular case I did not. My actual event class looks like: package Flexb.events { import flash.events.Event; public class GetNewsEvent extends Event { protected var _data:Object; public static const GET_NEWS_EVENT:String=GetNewsEventType; public function GetNewsEvent( type:String, data:Object = null, bubbles:Boolean=true, cancelable:Boolean=false ):void { _data = data; super(GET_NEWS_EVENT,true,false); } public function get data():Object { return _data; } } } dnk On 23-May-08, at 6:16 PM, Josh McDonald wrote: What's the event dispatch code look like? On Sat, May 24, 2008 at 11:01 AM, dnk [EMAIL PROTECTED] wrote: ok, well that explains that part, however either my event is not added, or my event handler is never called. My trace statements never show up So I guess I still am wondering if anyone has any ideas dnk On 23-May-08, at 4:56 AM, Paul Andrews wrote: addEventListener() does not return a value.. - Original Message - From: dnk [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, May 23, 2008 12:47 PM Subject: [flexcoders] custom event not added Hi there, I have a controller that is adding my custom event listeners, but for some reason my event handler was not being fired. My original code was (snippet): (in controler) //constructor public function FlexbController() { //turn the key, start it up addEventListener( FlexEvent.CREATION_COMPLETE, onInit ); } private function onInit( event:Event ):void { //setup event listeners /*systemManager is where event listener hangs out defines the relationship between event and handler*/ systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, handler_GetNewsEvent ); systemManager.addEventListener( AddNewsEvent.ADD_NEWS_EVENT, handler_AddNewsEvent ); systemManager .addEventListener( NewsDataLoadedEvent.NEWS_LOADED_EVENT, handler_NewsLoadedEvent ); getNewsData(); } And I had trace statements in all of my handlers... this is how i noticed things were not working as they should. SO I added a simple check like (in my FlexbController constructor): if (systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, handler_GetNewsEvent )) { trace(true); } else { trace(false); } And I obviously am getting false. Ideas? dnk -- 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 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- 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 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- 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 -- 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] AS3 regexp doesnt implement lookbehind?
It should have a look behind. I think you can find all your answers here: http://gskinner.com/RegExr/ There is also an Air version available. At the right side you can find the capabilities. Greetz Erik On 5/24/08, Janis Radins [EMAIL PROTECTED] wrote: Hey people! I'm playing here with some RegExp stuff. Should have learned it long time ago tho I started just recently. So, i was playing with syntax highlighter in AS3 and stumbled upon difficulties on how to match doc tag inside block comment. After several hours I came up with genius expression - /(?=\/\*(?:[^*]|\*[^*\/])*)(@\w*)/mg It works perfectly in text editor I'm using to test expressions but it halts in AS3. Each of the groups select what they are supposed to perfectly, but they do not work togeather. I did some googling and couldnt find definitive answer what might be the problem. So, could it be that AS3 RegExp engine doesn't implement lookbehind? Can anyone confirm that or maybe someone knows how comet that bastid doesn't work in AS3? thanks in advance Jānis
[flexcoders] Why is this renderer so slow?
I have created a checkbox renderer. My datagrid has 5 out of 8 columns that use it. The datagrid has only about 80 rows it it. When using this renderer the performance of the datagrid is horrible. Scrolling is extremely slow, click a checkbox is extremely slow. If I swap out and use a normal mx:CheckBox for the renderer the performance is just fine, but of course that doesn't work as it will not retain the state of the checkbox when scrolling. Here is my code for the renderer. I notice that many of these are re-executed whenever anything happens to the datagrid. That includes just mousing over. Thanks. Dale package renderer { import flash.events.MouseEvent; import mx.controls.CheckBox; import spectrumk12.minerva.util.BaseEvent; import spectrumk12.minerva.util.Utils; [Event(name=selectionSet, type=util.BaseEvent)] public class RendererCheckBoxXML extends CheckBox { private var _xmlItem : XML;//holds the current item xml node private var count:int=0; private var debug:String=; /** The attribute in the xml to use to store the selected state of this checkbox. */ [Inspectable(default=rendererSelected)] public var selectedAttribute : String = rendererSelected; /** The default selection state (true/false) to give if the selectedAttribute is not there or null */ [Inspectable(default=false, enumeration=true,false)] public var defaultSelectedState : Boolean = false; public function RendererCheckBoxXML() { super(); trace(RendererCheckBoxXML:Constructor); this.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); } // Sets the state of the checkbox based on the selectedAttribute attribute. override public function set data(oItem:Object) : void { _xmlItem = XML(oItem); trace(RendererCheckBoxXML:set data: + [EMAIL PROTECTED]); var bSelected : Boolean = false; var attrSelected : String = [EMAIL PROTECTED]; this.selected = ( Utils.nullOrBlank(attrSelected) ? defaultSelectedState : (attrSelected == true) ); } override public function get data() : Object { trace(RendererCheckBoxXML:get data: + (_xmlItem != null ? [EMAIL PROTECTED] : null)); return _xmlItem; } /** * This overridden function is where the logic is for updating the xml. */ override public function set selected(selectedFlag:Boolean) : void { trace(RendererCheckBoxXML:set selected: + [EMAIL PROTECTED]); super.selected = selectedFlag; // Only update the xml if it needs to be updated. Each time the xml // is updated it will fire any bindings to it so we want to keep these // to a minimum. if ( [EMAIL PROTECTED] != selectedFlag ) { // The selected flag is different than the selectedAttribute attribute. // Now we make one last check to see if the selectedFlag is false and // there is no attribute selectedAttribute. If this is the case, then // we do NOT update because having no attribute selectedAttribute will // default to a false. Again, we do this so that we update the xml as // infrequently as possible. if ( selectedFlag || [EMAIL PROTECTED]() 0 ) { [EMAIL PROTECTED] = String(this.selected); //set the checkbox state into the dataProvider } } dispatchEvent(new BaseEvent(selectionSet, selectedFlag)); } // Called by click of the checkbox private function onClick(mouseEvent:MouseEvent) : void { trace(RendererCheckBoxXML:onClick: + [EMAIL PROTECTED]); // Simply need to trigger the set selected function as that is where the logic for updating the xml is. this.selected = this.selected; } } }
[flexcoders] Can a 'child' tell when its parents view state changed?
I have a set of viewstates that are used many times. When the view state is changed, I would like the child to reset its view. I would like the child to know when it is revealed due to the state change of the parent. It seems that the child does not know when the parent changes view states at all so the only way I could do this would be to 1) Have the controller that changes states reset the child 2) Have the child register for the viewstate ENTER_STATE event on its parent I've tried capturing hide/show/render on the child, but none of those fit What does flex actually do to children when they are no visible due to a remove child in a state, I would have assumed that they would be hidden but that doesn't seem to be the case and digging through the viewstate and addchild code of the sdk its not obvious to me what a state change really does under the covers to hide or reveal a set of children. ... b l u e t u b e i n t e r a c t i v e. .: Development solutions for creatives :. .: grant davies .: 404.428.6839 (c) .: 404.921.9550 (F) [EMAIL PROTECTED] http://www.bluetube.com/bti http://www.bluetube.com/bti image001.jpg
[flexcoders] Re: callLater, FPS, and lengthy background operations
Hmm, I thought that the default was 24 fps. Not related to the question, but a little trick that you can use sometimes, to boost performance, is to set the frameRate to 99 in the Application tag. Makes the busy cursor go nuts, but it makes transitions smoother. -TH --- In flexcoders@yahoogroups.com, EECOLOR [EMAIL PROTECTED] wrote: Framerates by default are set to 40 FPS. If you happen to have a reference to the stage, you can use the stage.frameRate property. That way you have a solution for all frame rates. I would use an enterFrame solution like callLater, then just check the time within a while loop. Greetz Erik On 5/24/08, Josh McDonald [EMAIL PROTECTED] wrote: Hi Guys, If I have a long list of things to process as a background task, I figure a good way to do it is a piece at a time with callLater(). However I'd like to be able to detect if I'm taking too long per block and running into the next frame. Also, I'd like to do more per cycle if my app finds itself running on a ninja machine :) Anyone have any tips for this sort of thing? Should I just be using the timer and striving for 1/4 of a frame measured in ms? What framerate are Flex SWFs set to run at normally? Cheers, -J --
[flexcoders] Re: Multiple ItemRenderers for a single DataGridColumn
Hi Dale, An itemRenderer is a component. You can use states within an itemRenderer; that are conditionally set. If you override the set data method, you can change the component's state there; to meet your needs. You could also use a viewStack in the itemRenderer and do the same thing. -TH --- In flexcoders@yahoogroups.com, dbronk [EMAIL PROTECTED] wrote: I have a DataGrid and one of the columns I need to be able to do the following based on the user security setting and the data in the column. So each row in the DataGrid for a single user may have different behavior and ItemRenderers. 1. Do not show any data and mark the cell not editable. Still show the column, just blank out the cell and do not allow editing. 2. Allow the user to see the data, but not edit it. I would like this to simply show as a Text field. 3. Display the data, and allow the user to edit the data via a TextInput control. 4. Display the data, and allow the user to edit the data via showing a CheckBox control. I know how to do each individually, but I do not know how to do this all at the same time in a single DataGridColumn. Can I do this? Thanks, Dale
Re: [flexcoders] Can a 'child' tell when its parents view state changed?
have you tried the added/removed events? usually hiding/showing children in viewstates using the design mode entail adding/removing the corresponding children rather than just hiding or setting the visibilities unless you explicitly set them to be so in the source view.--- On Sun, 5/25/08, Grant Davies [EMAIL PROTECTED] wrote:From: Grant Davies [EMAIL PROTECTED]Subject: [flexcoders] Can a 'child' tell when its parents view state changed?To: flexcoders@yahoogroups.comDate: Sunday, May 25, 2008, 1:22 AMI have a set of viewstates that are used many times. When the view state is changed, I would like the child to “reset” its view. I would like the child to know when it is “revealed” due to the state change of the parent. It seems that the child does not know when the parent changes view states at all so the only way I could do this would be to 1) Have the controller that changes states reset the child2) Have the child register for the viewstate ENTER_STATE event on its parent I’ve tried capturing hide/show/render on the child, but none of those “fit” What does flex actually do to children when they are no visible due to a “remove child” in a state, I would have assumed that they would be hidden but that doesn’t seem to be the case and digging through the viewstate and addchild code of the sdk its not obvious to me what a state change really does under the covers to hide or reveal a set of children. . . . › b l u e t u b e i n t e r a c t i v e..: Development solutions for creatives :..: grant davies.: 404.428.6839 (c).: 404.921.9550 (F)› [EMAIL PROTECTED] comhttp://www.bluetube .com/bti
Re: [flexcoders] Why is this renderer so slow?
im just wondering why you think an ordinary check box wont retain it's selected state when scrolling? can you provide an example code that does that? maybe it will be more beneficial to approach the problem using that approach. Just a thought. --- On Sun, 5/25/08, dbronk lt;[EMAIL PROTECTED]gt; wrote: From: dbronk lt;[EMAIL PROTECTED]gt; Subject: [flexcoders] Why is this renderer so slow? To: flexcoders@yahoogroups.com Date: Sunday, May 25, 2008, 12:59 AM I have created a checkbox renderer. My datagrid has 5 out of 8 columns that use it. The datagrid has only about 80 rows it it. When using this renderer the performance of the datagrid is horrible. Scrolling is extremely slow, click a checkbox is extremely slow. If I swap out and use a normal mx:CheckBox for the renderer the performance is just fine, but of course that doesn't work as it will not retain the state of the checkbox when scrolling. Here is my code for the renderer. I notice that many of these are re-executed whenever anything happens to the datagrid. That includes just mousing over. Thanks. Dale package renderer { import flash.events. MouseEvent; import mx.controls. CheckBox; import spectrumk12. minerva.util. BaseEvent; import spectrumk12. minerva.util. Utils; [Event(name= selectionSet , type=util.BaseEven t)] public class RendererCheckBoxXML extends CheckBox { private var _xmlItem : XML;//holds the current item xml node private var count:int=0; private var debug:String= ; /** The attribute in the xml to use to store the selected state of this checkbox. */ [Inspectable( default= rendererSelected )] public var selectedAttribute : String = rendererSelected ; /** The default selection state (true/false) to give if the selectedAttribute is not there or null */ [Inspectable( default= false, enumeration= true,false )] public var defaultSelectedStat e : Boolean = false; public function RendererCheckBoxXML () { super(); trace(RendererChec kBoxXML:Construc tor); this.addEventListen er(MouseEvent. CLICK, onClick, false, 0, true); } // Sets the state of the checkbox based on the selectedAttribute attribute. override public function set data(oItem:Object) : void { _xmlItem = XML(oItem); trace(RendererChec kBoxXML:set data: + [EMAIL PROTECTED]) ; var bSelected : Boolean = false; var attrSelected : String = [EMAIL PROTECTED] Attribute] ; this.selected = ( Utils.nullOrBlank( attrSelected) ? defaultSelectedStat e : (attrSelected == true) ); } override public function get data() : Object { trace(RendererChec kBoxXML:get data: + (_xmlItem != null ? [EMAIL PROTECTED] : null)); return _xmlItem; } /** * This overridden function is where the logic is for updating the xml. */ override public function set selected(selectedFl ag:Boolean) : void { trace(RendererChec kBoxXML:set selected: + [EMAIL PROTECTED]) ; super.selected = selectedFlag; // Only update the xml if it needs to be updated. Each time the xml // is updated it will fire any bindings to it so we want to keep these // to a minimum. if ( [EMAIL PROTECTED] Attribute] != selectedFlag ) { // The selected flag is different than the selectedAttribute attribute. // Now we make one last check to see if the selectedFlag is false and // there is no attribute selectedAttribute. If this is the case, then // we do NOT update because having no attribute selectedAttribute will // default to a false. Again, we do this so that we update the xml as // infrequently as possible. if ( selectedFlag || [EMAIL PROTECTED] Attribute] .length() gt; 0 ) { [EMAIL PROTECTED] Attribute] = String(this. selected) ; //set the checkbox state into the dataProvider } } dispatchEvent( new BaseEvent(selectio nSet, selectedFlag) ); }
RE: [flexcoders] Can a 'child' tell when its parents view state changed?
Thanks for the idea leds, The added event is fired when the child is first added (same time as creationComplete is fired), but when the child is made visible due to a state change by the parent the added is not fired again on the child. Cheers, Grant ... b l u e t u b e i n t e r a c t i v e. .: Development solutions for creatives :. .: grant davies .: 404.428.6839 (c) .: 404.921.9550 (F) [EMAIL PROTECTED] http://www.bluetube.com/bti http://www.bluetube.com/bti From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of leds usop Sent: Saturday, May 24, 2008 2:09 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Can a 'child' tell when its parents view state changed? have you tried the added/removed events? usually hiding/showing children in viewstates using the design mode entail adding/removing the corresponding children rather than just hiding or setting the visibilities unless you explicitly set them to be so in the source view. --- On Sun, 5/25/08, Grant Davies [EMAIL PROTECTED] wrote: From: Grant Davies [EMAIL PROTECTED] Subject: [flexcoders] Can a 'child' tell when its parents view state changed? To: flexcoders@yahoogroups.com Date: Sunday, May 25, 2008, 1:22 AM I have a set of viewstates that are used many times. When the view state is changed, I would like the child to reset its view. I would like the child to know when it is revealed due to the state change of the parent. It seems that the child does not know when the parent changes view states at all so the only way I could do this would be to 1) Have the controller that changes states reset the child 2) Have the child register for the viewstate ENTER_STATE event on its parent I've tried capturing hide/show/render on the child, but none of those fit What does flex actually do to children when they are no visible due to a remove child in a state, I would have assumed that they would be hidden but that doesn't seem to be the case and digging through the viewstate and addchild code of the sdk its not obvious to me what a state change really does under the covers to hide or reveal a set of children. . . . b l u e t u b e i n t e r a c t i v e. .: Development solutions for creatives :. .: grant davies .: 404.428.6839 (c) .: 404.921.9550 (F) [EMAIL PROTECTED] com http://www.bluetube .com/bti http://www.bluetube.com/bti image001.jpg
Re: [flexcoders] Why is this renderer so slow?
ugh,yeah, CheckBox implements IDropInItemListRenderer (or whatever its called exactly) and can do the edit your data thing. Have you tried this? DK On Sat, May 24, 2008 at 2:25 PM, leds usop [EMAIL PROTECTED] wrote: im just wondering why you think an ordinary check box wont retain it's selected state when scrolling? can you provide an example code that does that? maybe it will be more beneficial to approach the problem using that approach. Just a thought. --- On *Sun, 5/25/08, dbronk [EMAIL PROTECTED]* wrote: From: dbronk [EMAIL PROTECTED] Subject: [flexcoders] Why is this renderer so slow? To: flexcoders@yahoogroups.com Date: Sunday, May 25, 2008, 12:59 AM I have created a checkbox renderer. My datagrid has 5 out of 8 columns that use it. The datagrid has only about 80 rows it it. When using this renderer the performance of the datagrid is horrible. Scrolling is extremely slow, click a checkbox is extremely slow. If I swap out and use a normal mx:CheckBox for the renderer the performance is just fine, but of course that doesn't work as it will not retain the state of the checkbox when scrolling. Here is my code for the renderer. I notice that many of these are re-executed whenever anything happens to the datagrid. That includes just mousing over. Thanks. Dale package renderer { import flash.events. MouseEvent; import mx.controls. CheckBox; import spectrumk12. minerva.util. BaseEvent; import spectrumk12. minerva.util. Utils; [Event(name= selectionSet , type=util.BaseEven t)] public class RendererCheckBoxXML extends CheckBox { private var _xmlItem : XML; //holds the current item xml node private var count:int=0; private var debug:String= ; /** The attribute in the xml to use to store the selected state of this checkbox. */ [Inspectable( default= rendererSelected )] public var selectedAttribute : String = rendererSelected ; /** The default selection state (true/false) to give if the selectedAttribute is not there or null */ [Inspectable( default= false, enumeration= true,false )] public var defaultSelectedStat e : Boolean = false; public function RendererCheckBoxXML () { super(); trace(RendererChec kBoxXML:Construc tor); this.addEventListen er(MouseEvent. CLICK, onClick, false, 0, true); } // Sets the state of the checkbox based on the selectedAttribute attribute. override public function set data(oItem:Object) : void { _xmlItem = XML(oItem); trace(RendererChec kBoxXML:set data: + [EMAIL PROTECTED]) ; var bSelected : Boolean = false; var attrSelected : String = [EMAIL PROTECTED] Attribute] ; this.selected = ( Utils.nullOrBlank( attrSelected) ? defaultSelectedStat e : (attrSelected == true) ); } override public function get data() : Object { trace(RendererChec kBoxXML:get data: + (_xmlItem != null ? [EMAIL PROTECTED] : null)); return _xmlItem; } /** * This overridden function is where the logic is for updating the xml. */ override public function set selected(selectedFl ag:Boolean) : void { trace(RendererChec kBoxXML:set selected: + [EMAIL PROTECTED]) ; super.selected = selectedFlag; // Only update the xml if it needs to be updated. Each time the xml // is updated it will fire any bindings to it so we want to keep these // to a minimum. if ( [EMAIL PROTECTED] Attribute] != selectedFlag ) { // The selected flag is different than the selectedAttribute attribute. // Now we make one last check to see if the selectedFlag is false and // there is no attribute selectedAttribute. If this is the case, then // we do NOT update because having no attribute selectedAttribute will // default to a false. Again, we do this so that we update the xml as // infrequently as possible. if ( selectedFlag || [EMAIL PROTECTED] Attribute] .length() 0 ) { [EMAIL PROTECTED] Attribute] = String(this. selected) ; //set the checkbox state into the dataProvider } } dispatchEvent( new BaseEvent(selectio nSet, selectedFlag) ); } // Called by click of the checkbox private function onClick(mouseEvent: MouseEvent) : void { trace(RendererChec kBoxXML:onClick: + [EMAIL PROTECTED]) ; // Simply need to trigger the set selected function as that is where the logic for updating the xml is. this.selected = this.selected; } } } -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it?
[flexcoders] Flex + Cairngorm + ASSQL
I am trying to use ASSQL in my sample application with Cairngorm. Now, am stuck at the point where my application will talk to the db and the responses returned by db. In my delegate class: public function getCategories( ): void { var call : AsyncToken = this.getCategoriesFromDB(); //instead of service.getCategoriesFromDB(); call.addResponder( responder ); } and in this method this.getCategoriesFromDB(), I 'll talk to db. What should be the return type of this method so that my responder can handle the results. You might like to have a look here too: http://code.google.com/p/assql/wiki/ExampleUsage Any suggestion here will be great. Thanks. -- View this message in context: http://www.nabble.com/Flex-%2B-Cairngorm-%2B-ASSQL-tp17451889p17451889.html Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] how could I get certified by flex
Hi coders , I was wondering, where could I find a flex book to study for a flex certification and also where could I get that test . Regards, Gustavo Duenas
[flexcoders] XMLRPC for Actionscript
Looking for clear documentation / examples on how to use XMLRPC for Actionscript. Anyone have any links? I'm reading through the comments in the source, but it's just not sinking in. Thanks! -- Steve Good http://lanctr.com/
RE: [flexcoders] how could I get certified by flex
The 'Training from the Source' series is a good place to start... http://www.amazon.com/Adobe-Flex-3-Training-Source/dp/0321529189 Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gustavo Duenas Sent: Saturday, May 24, 2008 5:41 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] how could I get certified by flex Hi coders , I was wondering, where could I find a flex book to study for a flex certification and also where could I get that test . Regards, Gustavo Duenas attachment: winmail.dat
RE: [flexcoders] Flex + Cairngorm + ASSQL
What should be the return type of this method so that my responder can handle the results? Assuming you're using the standard cairngorm model and using the command that called the delegate as the delegates responder, then it's result method takes an Object as it's parameter. So it could be anything you like, but for it to be useful you'd cast it in the command's result method to whatever type you expect to get back. Assuming that does not fail, you then know what it is and how to deal with it. -Original Message- From: flexcoders@yahoogroups.com on behalf of Manu Dhanda Sent: Sat 24/05/2008 22:06 To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex + Cairngorm + ASSQL I am trying to use ASSQL in my sample application with Cairngorm. Now, am stuck at the point where my application will talk to the db and the responses returned by db. In my delegate class: public function getCategories( ): void { var call : AsyncToken = this.getCategoriesFromDB(); //instead of service.getCategoriesFromDB(); call.addResponder( responder ); } and in this method this.getCategoriesFromDB(), I 'll talk to db. What should be the return type of this method so that my responder can handle the results. You might like to have a look here too: http://code.google.com/p/assql/wiki/ExampleUsage Any suggestion here will be great. Thanks. -- View this message in context: http://www.nabble.com/Flex-%2B-Cairngorm-%2B-ASSQL-tp17451889p17451889.html Sent from the FlexCoders mailing list archive at Nabble.com. __ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. __winmail.dat
[flexcoders] Re: Back Button issues . . .
Hi, The history manager saves and loads state properties for registered components; not ModelLocator state variables. Each time that the selectedChild of the ViewStack changes, the history manager saves the ViewStack's selectedIndex. When the browser's back button is clicked, the history manager loads and sets the ViewStack's selectedIndex to the previous value. This bypasses the binding of selectedChild and does not update model.workflowState to the current view's value. So when you click the back button to return to Page1 from Page2, model.workflowState is still stuck at ModelLocator.PAGE_2. Since clicking the linkText to go to Page2 updates model.workflowState to ModelLocator.PAGE_2, the binding isn't notified of the change; because the variable's value isn't being changed. You can write some custom history management by implementing IHistoryManagerClient. Or, you could try: view:Page1 id=somePage1 show=showPage(1)/ view:Page2 id=somePage2 show=showPage(2)/ view:Page3 id=somePage3 show=showPage(3)/ This is kind of a hack, but it should keep you state variable in sync with the current view. -TH --- In flexcoders@yahoogroups.com, srieger_1 [EMAIL PROTECTED] wrote: Hi All, I am having an issue with the ViewStack when the user clicks the back button. The browser takes them back a page however, my Flex application doesn't recognize the change thus none of my links work on the previous page. Let me give an example as that sounds confusing. The user is viewing a page in my application. Lets call it page one. On page one the user clicks a link to go to page 2. Now the user is viewing page 2 and clicks the back button to go back to page 1. For some reason the link to page 2 no longer works. I found if the user is viewing page 2 and clicks a button or link that use flex code to navigate to Page 1, anything besides the back button, then the links on page 2 will work. Below is some sample code of how I am working with the ViewStack Links and Buttons . . . Thanks for any help you can offer .. . .. private function showPage( pageNumber : Number ) : void { switch( pageNumber ) { case (1) : model.workflowState = ModelLocator.PAGE_1; break; case (2) : model.workflowState = ModelLocator.PAGE_2; break; case (3) : model.workflowState = ModelLocator.PAGE_3; break; } } public function getView( workflowState : Number ) : Container { switch( workflowState ) { case ( ModelLocator.PAGE_1 ) : return somePage1; case ( ModelLocator.PAGE_2 ) : return somePage2; case ( ModelLocator.PAGE_3 ) : return somePage3; } return pageError; } mx:ViewStack id=appView width=100% height=100% selectedChild={getView( model.workflowState )} historyManagementEnabled=true view:Page1 id=somePage1 / view:Page2 id=somePage2 / view:Page3 id=somePage3 / /mx:ViewStack mx:Text styleName=linkText text=Link to Page 2 mouseChildren=false buttonMode=true useHandCursor=true click=showPage(2)/ mx:Button label=Go to Page 1 click = showPage(1)/
Re: [flexcoders] how could I get certified by flex
Hi, I have adobe flex 2 training from the the source, once I got it finished where should I go have the test to be certified? Regards, Gustavo Duenas On May 24, 2008, at 5:55 PM, Rick Winscot wrote: The 'Training from the Source' series is a good place to start... http://www.amazon.com/Adobe-Flex-3-Training-Source/dp/0321529189 Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gustavo Duenas Sent: Saturday, May 24, 2008 5:41 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] how could I get certified by flex Hi coders , I was wondering, where could I find a flex book to study for a flex certification and also where could I get that test . Regards, Gustavo Duenas winmail.dat
[flexcoders] Publish Flex dev application to Production problem!
Hi, my application in dev mode works fine with blazeDS. But when i put it on my web server i cannot access the blazeDS application (messagebroker) anymore from my flex client. in dev mode i access to my flex app like this http://192.168.1.101:8080/myapp/chidaca.html In production mode i use myapp.4java.ca/chidaca.html Do i have to change the service-config.xml before deploying or change any compiler arguments in flex builder ??? Here is my error : FaultEvent fault=[RPC Fault faultString=Send failed faultCode=Client.Error.MessageSend faultDetail=Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://myapp.4java.ca/messagebroker/amf'] messageId=4DAEE9EF-90D9-499E-977A-1C7FCE4EFFFD type=fault bubbles=false
[flexcoders] Text Question
Ok, this will probably sound stupid but ... How can I write a paragraph of text inside of an accordion? My example accordion that I am using uses mxForm for each accordion element. How can I write a paragraph of wrapped text inside of the accordion? Thanks in advance. -e
[flexcoders] Re: Amazon S3 + Flex Uploader // help!
an AIR solution will not help me..since im not building an AIR app. has anyone successfully managed to Batch Upload ( and auto process ) files to S3? if so can u tell me how? are their libraries ? or classes out there? and should this be strictly done in PHP? or in the Flex App? thanks --- In flexcoders@yahoogroups.com, Peter Connolly [EMAIL PROTECTED] wrote: Take a look at the Salsa sample application. It's an AIR app that manages files on Amazon S3.
[flexcoders] Re: Amazon S3 + Flex Uploader // help!
i am aware of the app.. however its AIR. however - im not building an AIR app. and i cant use it. has anyone on this successfully connected and batch uploaded to S3? without using AIR? thanks artur
[flexcoders] Flex3---Reduced by size module doesn't show Button
Hi! I have compiled module with 'MXMLC' command. Its size is more than 100 K. It contains only one button. when I call this module in main application, it is called perfectly and button is showed on the screen. 2nd Time: Now I want to reduce the size of the module. And for this I do following I have complied the module using 'MXMLC' command using '-link-report' switch. It generates a XML file. Then I use again 'MXMLC' command using '-load-externs' switch. All works well, but when I compile and run the same application through FLEX 3 builder, I am unable to view the button [which was seen earlier before reducing the size of module]. Can some one guide me about the problem. Thanks in advance
Re: [flexcoders] Re: Flash USB-API :)
a couple of reasons, https://bugs.adobe.com/jira/browse/SDK-14000 http://bugs.adobe.com/jira/browse/SDK-13999 On Sat, May 24, 2008 at 6:35 AM, Rick Winscot [EMAIL PROTECTED] wrote: There is an obvious solution: Flex/AIR - Web Services (or similar) - USB ... but _direct_ communication with USB? I'm stumped as to why you would even need something like this. What is your use case? Rick Winscot From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Cato Paus Sent: Friday, May 23, 2008 9:35 AM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Flash USB-API :) Hehe Totaly Agree with you on Joe Random, but I put my trust on Adobe to find a solution :) --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto: flexcoders%40yahoogroups.com flexcoders%2540yahoogroups.com , Tom Chiverton [EMAIL PROTECTED] wrote: On Thursday 22 May 2008, Cato Paus wrote: I realy hope we can have USB communication in AIR and Flash Player :) USB communication from a web site ? I think not... unless you want Joe Random reading all your data. For AIR this makes more sense. -- Tom Chiverton 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] Re: Importing SWC Files in FLEX
Hey Anuj, People tend to respond more to questions that have enough info to get to the root of the problem such as coding issues. This one is more of a system issue and perhaps I'm still missing some info because I don't understand exactly what you're trying to do, and it's tough to post your environment. (I'm still feeling a bit jilted that nobody answered my question some time ago about browser scrollbars ;-) You SHOULDN'T be able to look at swc file in the browser. You should be able to add the swc to the lib path of your project and then have access to those components (those inside the swc) in the design view in the custom folder. If you have added it, and can see the components in the custom tab of the design view then perhaps there is something wrong with your swc? I would suggest getting a well known swc, say flexlib.swc, and adding it to your lib path, and trying to use some elements from it. If that works okay, then look to your swc as the problem. Where did you get the swc? What type of component in the swc are you trying to use? Do you get build errors when you use any symbol or component? If it's a visual component, are you sure it should be visible in the application view you put it in? --Danny
[flexcoders] dataTipItems
I want to show multiple datatip items on the chart when user click a button. How it this possible? I read dataTipItems could be userful but never found any sample.
[flexcoders] Footer for AdvancedDataGrid
Appreciate suggestions for this ... are there any updates to the earlier solutions e.g. Alex's DataFooterGrid etc? Which are excellent but do not seem to work with grids which need grouped data from flat sources ... I don't think the DataFooterGrid inherits enough to do this - lot of properties not available. Thanks in advance, Mic.
[flexcoders] Re: Autherizing a computer using an AIR application
Currently in AIR, you can't do this. I believe it's a candidate for a future version of AIR though. -Andrew --- In flexcoders@yahoogroups.com, vipinck [EMAIL PROTECTED] wrote: Hi there, Does anyone knows a way to authorize a computer when an AIR application runs for the first time. For examples, I could do this with a Zinc application, where I can get the MAC address of the machine and send to a server for authorizing the machine. Can we read a system specific value or ID using an AIR application? This is needed restrict the number of installations allowed for a particular license. Thanks Vipin
Re: [flexcoders] custom event not added
As in, I've got no idea what's going on :) Application.application should always point to the running instance of your mx:Application On Sun, May 25, 2008 at 2:19 AM, dnk [EMAIL PROTECTED] wrote: fire? As in scrap and rewrite? dnk On 23-May-08, at 10:25 PM, Josh McDonald wrote: If you're getting a runtime error accessing Application.application you'll need fire to clean this up, methinks. -J On Sat, May 24, 2008 at 3:02 PM, dnk [EMAIL PROTECTED] wrote: That added an error: Access of undefined property Application researching that now... d On 23-May-08, at 9:35 PM, Josh McDonald wrote: The only thing i can think of after looking at that is that your controller (whatever that is) is not part of the display tree? Try replacing dispatchEvent() with Application.application.dispatchEvent() and see if it works then. -J On Sat, May 24, 2008 at 2:28 PM, dnk [EMAIL PROTECTED] wrote: It is dispatched like this (in function in my controller): dispatchEvent(new GetNewsEvent(GetNewsEvent.GET_NEWS_EVENT, null, false, false)); the null is used for an object (if I need to pass data with my event). In this particular case I did not. My actual event class looks like: package Flexb.events { import flash.events.Event; public class GetNewsEvent extends Event { protected var _data:Object; public static const GET_NEWS_EVENT:String=GetNewsEventType; public function GetNewsEvent( type:String, data:Object = null, bubbles:Boolean=true, cancelable:Boolean=false ):void { _data = data; super(GET_NEWS_EVENT,true,false); } public function get data():Object { return _data; } } } dnk On 23-May-08, at 6:16 PM, Josh McDonald wrote: What's the event dispatch code look like? On Sat, May 24, 2008 at 11:01 AM, dnk [EMAIL PROTECTED] wrote: ok, well that explains that part, however either my event is not added, or my event handler is never called. My trace statements never show up So I guess I still am wondering if anyone has any ideas dnk On 23-May-08, at 4:56 AM, Paul Andrews wrote: addEventListener() does not return a value.. - Original Message - From: dnk [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, May 23, 2008 12:47 PM Subject: [flexcoders] custom event not added Hi there, I have a controller that is adding my custom event listeners, but for some reason my event handler was not being fired. My original code was (snippet): (in controler) //constructor public function FlexbController() { //turn the key, start it up addEventListener( FlexEvent.CREATION_COMPLETE, onInit ); } private function onInit( event:Event ):void { //setup event listeners /*systemManager is where event listener hangs out defines the relationship between event and handler*/ systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, handler_GetNewsEvent ); systemManager.addEventListener( AddNewsEvent.ADD_NEWS_EVENT, handler_AddNewsEvent ); systemManager .addEventListener( NewsDataLoadedEvent.NEWS_LOADED_EVENT, handler_NewsLoadedEvent ); getNewsData(); } And I had trace statements in all of my handlers... this is how i noticed things were not working as they should. SO I added a simple check like (in my FlexbController constructor): if (systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, handler_GetNewsEvent )) { trace(true); } else { trace(false); } And I obviously am getting false. Ideas? dnk -- 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 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- 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 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Flexcoders Mailing List FAQ:
[flexcoders] Re: Why is this renderer so slow?
mx:DataGrid dataProvider={yourCollection} mx:columns mx:DataGridColumn dataField=yourBooleanField itemRenderer=mx.controls.CheckBox editable=true/ /mx:columns /mx:DataGrid Fill up the yourCollection with a bunch of objects or xml with a field named yourBooleanField. Run it and they will initially display fine. Select some, unselect others. Scroll them off the page the scroll them back into view and their state will not be kept. I posted a question about that and Tracy set me straight with an example (I tweeked it a bit as I needed and is the renderer in my post here). He gave me a couple links about why I had to write a checkbox renderer for it to remember state. I'll look into the option given by the other response to this tread. Thanks, Dale --- In flexcoders@yahoogroups.com, leds usop [EMAIL PROTECTED] wrote: im just wondering why you think an ordinary check box wont retain it's selected state when scrolling? can you provide an example code that does that? maybe it will be more beneficial to approach the problem using that approach. Just a thought. --- On Sun, 5/25/08, dbronk [EMAIL PROTECTED] wrote: From: dbronk [EMAIL PROTECTED] Subject: [flexcoders] Why is this renderer so slow? To: flexcoders@yahoogroups.com Date: Sunday, May 25, 2008, 12:59 AM I have created a checkbox renderer. My datagrid has 5 out of 8 columns that use it. The datagrid has only about 80 rows it it. When using this renderer the performance of the datagrid is horrible. Scrolling is extremely slow, click a checkbox is extremely slow. If I swap out and use a normal mx:CheckBox for the renderer the performance is just fine, but of course that doesn't work as it will not retain the state of the checkbox when scrolling. Here is my code for the renderer. I notice that many of these are re-executed whenever anything happens to the datagrid. That includes just mousing over. Thanks. Dale package renderer { import flash.events. MouseEvent; import mx.controls. CheckBox; import spectrumk12. minerva.util. BaseEvent; import spectrumk12. minerva.util. Utils; [Event(name= selectionSet , type=util.BaseEven t)] public class RendererCheckBoxXML extends CheckBox { private var _xmlItem : XML;//holds the current item xml node private var count:int=0; private var debug:String= ; /** The attribute in the xml to use to store the selected state of this checkbox. */ [Inspectable( default= rendererSelected )] public var selectedAttribute : String = rendererSelected ; /** The default selection state (true/false) to give if the selectedAttribute is not there or null */ [Inspectable( default= false, enumeration= true,false )] public var defaultSelectedStat e : Boolean = false; public function RendererCheckBoxXML () { super(); trace(RendererChec kBoxXML:Construc tor); this.addEventListen er(MouseEvent. CLICK, onClick, false, 0, true); } // Sets the state of the checkbox based on the selectedAttribute attribute. override public function set data(oItem:Object) : void { _xmlItem = XML(oItem); trace(RendererChec kBoxXML:set data: + [EMAIL PROTECTED]) ; var bSelected : Boolean = false; var attrSelected : String = [EMAIL PROTECTED] Attribute] ; this.selected = ( Utils.nullOrBlank( attrSelected) ? defaultSelectedStat e : (attrSelected == true) ); } override public function get data() : Object { trace(RendererChec kBoxXML:get data: + (_xmlItem != null ? [EMAIL PROTECTED] : null)); return _xmlItem; } /** * This overridden function is where the logic is for updating the xml. */ override public function set selected(selectedFl ag:Boolean) : void { trace(RendererChec kBoxXML:set selected: + [EMAIL PROTECTED]) ; super.selected = selectedFlag; // Only update the xml if it needs to be updated. Each time the xml // is updated it will fire any bindings to it so we want to keep these // to a minimum. if ( [EMAIL PROTECTED] Attribute] != selectedFlag ) { // The selected flag is different than the selectedAttribute attribute. // Now we make one last check to see if the selectedFlag is false and
RE: [flexcoders] Flex3---Reduced by size module doesn't show Button
Normally, you use -link-report on the main app, not the module, and use load-externs on the module using the main apps link-report From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dr_dumb99 Sent: Saturday, May 24, 2008 7:13 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex3---Reduced by size module doesn't show Button Hi! I have compiled module with 'MXMLC' command. Its size is more than 100 K. It contains only one button. when I call this module in main application, it is called perfectly and button is showed on the screen. 2nd Time: Now I want to reduce the size of the module. And for this I do following I have complied the module using 'MXMLC' command using '-link-report' switch. It generates a XML file. Then I use again 'MXMLC' command using '-load-externs' switch. All works well, but when I compile and run the same application through FLEX 3 builder, I am unable to view the button [which was seen earlier before reducing the size of module]. Can some one guide me about the problem. Thanks in advance
RE: [flexcoders] Why is this renderer so slow?
Updating the dataprovider is costly. Make sure it only happens when required (that is isn't happening during scrolling), and maybe avoid dispatching an event to do it. I'm not sure who's listening and what they will do in response. If you change the dataprovider, the DataGrid will do a lot of work. XML is much slower than objects, so it may pay to convert to object. Button already has logic for handling a selectedField in a dataprovider item. Since CheckBox inherits from button, you might just be able to use selectedField, or modify and piggy-back on its timing. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dbronk Sent: Saturday, May 24, 2008 10:00 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Why is this renderer so slow? I have created a checkbox renderer. My datagrid has 5 out of 8 columns that use it. The datagrid has only about 80 rows it it. When using this renderer the performance of the datagrid is horrible. Scrolling is extremely slow, click a checkbox is extremely slow. If I swap out and use a normal mx:CheckBox for the renderer the performance is just fine, but of course that doesn't work as it will not retain the state of the checkbox when scrolling. Here is my code for the renderer. I notice that many of these are re-executed whenever anything happens to the datagrid. That includes just mousing over. Thanks. Dale package renderer { import flash.events.MouseEvent; import mx.controls.CheckBox; import spectrumk12.minerva.util.BaseEvent; import spectrumk12.minerva.util.Utils; [Event(name=selectionSet, type=util.BaseEvent)] public class RendererCheckBoxXML extends CheckBox { private var _xmlItem : XML; //holds the current item xml node private var count:int=0; private var debug:String=; /** The attribute in the xml to use to store the selected state of this checkbox. */ [Inspectable(default=rendererSelected)] public var selectedAttribute : String = rendererSelected; /** The default selection state (true/false) to give if the selectedAttribute is not there or null */ [Inspectable(default=false, enumeration=true,false)] public var defaultSelectedState : Boolean = false; public function RendererCheckBoxXML() { super(); trace(RendererCheckBoxXML:Constructor); this.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); } // Sets the state of the checkbox based on the selectedAttribute attribute. override public function set data(oItem:Object) : void { _xmlItem = XML(oItem); trace(RendererCheckBoxXML:set data: + [EMAIL PROTECTED]); var bSelected : Boolean = false; var attrSelected : String = [EMAIL PROTECTED]; this.selected = ( Utils.nullOrBlank(attrSelected) ? defaultSelectedState : (attrSelected == true) ); } override public function get data() : Object { trace(RendererCheckBoxXML:get data: + (_xmlItem != null ? [EMAIL PROTECTED] : null)); return _xmlItem; } /** * This overridden function is where the logic is for updating the xml. */ override public function set selected(selectedFlag:Boolean) : void { trace(RendererCheckBoxXML:set selected: + [EMAIL PROTECTED]); super.selected = selectedFlag; // Only update the xml if it needs to be updated. Each time the xml // is updated it will fire any bindings to it so we want to keep these // to a minimum. if ( [EMAIL PROTECTED] != selectedFlag ) { // The selected flag is different than the selectedAttribute attribute. // Now we make one last check to see if the selectedFlag is false and // there is no attribute selectedAttribute. If this is the case, then // we do NOT update because having no attribute selectedAttribute will // default to a false. Again, we do this so that we update the xml as // infrequently as possible. if ( selectedFlag || [EMAIL PROTECTED]() 0 ) { [EMAIL PROTECTED] = String(this.selected); //set the checkbox state into the dataProvider } } dispatchEvent(new BaseEvent(selectionSet, selectedFlag)); } // Called by click of the checkbox private function onClick(mouseEvent:MouseEvent) : void { trace(RendererCheckBoxXML:onClick: + [EMAIL PROTECTED]); // Simply need to trigger the set selected function as that is where the logic for updating the xml is. this.selected = this.selected; } } }
RE: [flexcoders] Can a 'child' tell when its parents view state changed?
A state change may create components, add them to the display list or show them if hidden. The corresponding events are creationComplete, addedToStage, and show. You may need to listen to all three From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Grant Davies Sent: Saturday, May 24, 2008 10:23 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Can a 'child' tell when its parents view state changed? I have a set of viewstates that are used many times. When the view state is changed, I would like the child to reset its view. I would like the child to know when it is revealed due to the state change of the parent. It seems that the child does not know when the parent changes view states at all so the only way I could do this would be to 1) Have the controller that changes states reset the child 2) Have the child register for the viewstate ENTER_STATE event on its parent I've tried capturing hide/show/render on the child, but none of those fit What does flex actually do to children when they are no visible due to a remove child in a state, I would have assumed that they would be hidden but that doesn't seem to be the case and digging through the viewstate and addchild code of the sdk its not obvious to me what a state change really does under the covers to hide or reveal a set of children. ... b l u e t u b e i n t e r a c t i v e. .: Development solutions for creatives :. .: grant davies .: 404.428.6839 (c) .: 404.921.9550 (F) [EMAIL PROTECTED] http://www.bluetube.com/bti http://www.bluetube.com/bti image001.jpg
RE: [flexcoders] Restricting SWFLoader Content to its Dimensions
In theory, if you set scaleContent=false and fix the size of the SWFLoader, it should clip From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Miller Sent: Friday, May 23, 2008 9:00 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Restricting SWFLoader Content to its Dimensions Hello, I have a SWFLoader in my app that loads various SWF files created by other developers. They are supposed to create them in the specified dimensions, but I keep running into problems with them going outside the bounds. Is there any way I can just clip the content in Flex to ensure they don't interfere with any of the adjacent controls? I've tried playing around with various properties in the SWFLoader class but to no avail. Any advice will be greatly appreciated. Thanks in advance! ~Aaron
RE: [flexcoders] Data Grid issue
No, I haven't. What happened when you tried it? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jitendra jain Sent: Friday, May 23, 2008 3:52 AM To: flex group flex Subject: [flexcoders] Data Grid issue Hi Alex, I read your blog : http://blogs.adobe.com/aharui/2008/03/datagrid_doubleclick_to_edit.html Have u tried dispatching an itemEditEnd event with different DataGridEventReasons for submit and cancel ? Please let me know as iam facing the same problem. Thanks in advance. Thanks, with Regards, Jitendra Jain Software Engineer 91-9979960798
RE: [flexcoders] Row Height of DataGrid in CSS
Not really. You could subclass and have it pull from a custom style From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of linko27 Sent: Friday, May 23, 2008 1:54 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Row Height of DataGrid in CSS Hi! Is there a way to set the rowHeight property with css? I want to set the rowHeight of all my datagrids. Thanks in advance!!
RE: [flexcoders] Re: Button down event
Flex is pretty good, but not perfect. We design for 80% cases and do not always handle the 20% case. We have code size and developer resource restrictions. The 80% case is that some button should be activated on ENTER pretty much no matter what control has focus. It would seem to me to be a poor UI where ENTER could have more than one meaning. Once there is a defaultButton, focusing any other Button enables ENTER handling on that button. That's the way it seems to work on Windows as well. The current button that will be activated on ENTER is given special highlighting so it will hopefully be apparent to the user what ENTER will do. I would recommend you choose one button that is the default for ENTER. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Amy Sent: Thursday, May 22, 2008 7:30 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Button down event --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui [EMAIL PROTECTED] wrote: If you set defaultButton on the container it will do it for you What if there are multiple buttons? Surely they can't _all_ be the default button? I thought Flex was supposed to be easy to make accessible. Thanks; Amy
RE: [flexcoders] Trees backed by ListCollectionView with singlenode
I think ArrayUtil From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Maciek Sakrejda Sent: Thursday, May 22, 2008 5:42 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Trees backed by ListCollectionView with singlenode Actually, this seems to be an issue with remoting... While researching this, I've noticed that Flex remote calls helpfully strip the collection out when it contains only a single object. I was binding to lastResult (I know, Tracy will say 'I told you so'), so I did not notice this. Is there any way to turn off this behavior? Or do I need to manually work around it if !(event.result is ListCollectionView)? -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com http://www.truviso.com -Original Message- From: Alex Harui [EMAIL PROTECTED] mailto:aharui%40adobe.com Reply-To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: RE: [flexcoders] Trees backed by ListCollectionView with single node Date: Thu, 22 May 2008 16:23:11 -0700 Try to find a way to test without the custom descriptor __ From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Maciek Sakrejda Sent: Thursday, May 22, 2008 11:10 AM To: flexcoders Subject: [flexcoders] Trees backed by ListCollectionView with single node I have a tree of User objects backed by a ListCollectionView of Users. I have a custom TreeDataDescriptor that shows these users and their roles. This works fine when I have more than one user. However, if the tree contains just a single user, the user node does not appear, only the roles show up. How can I make my tree behave consistently here? That is with collection Users [ user1 , user2 ] tree is: user1 -- role1 -- role2 user2 -- role1 -- role2 -- role3 with collection Users [ user1 ] tree is: role1 role2 tree should be user1 -- role1 -- role2 -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com http://www.truviso.com
RE: [flexcoders] Datagrid cell editing question
You may need to detect that you're at the last row and column and not call preventDefault. You can always call setFocus on those controls as well. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pratima Rao Sent: Thursday, May 22, 2008 3:06 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Datagrid cell editing question Alex - I got the tabbing/enter key to work in the datagrid with your suggestion. It took me a while to make it work. One last problem (hopefully) - I have an Ok and Cancel button below the datagrid and when I tab in the datagrid it never gets to these buttons. It's due to the fact that event.preventDefault method is called to prevent editing of the cell. How do I work around this? I am sending you sample code where you can reproduce this behavior. I wouldn't have made it this far without your suggestions. I appreciate all your help. Pratima ?xml version=1.0? !-- itemRenderers\events\EndEditEventPreventEdit.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=100% height=100% mx:Script ![CDATA[ import mx.events.DataGridEvent; import mx.collections.ArrayCollection; import mx.controls.Alert; private var lastEditedItem:Object = new Object(); [Bindable] private var initDG:ArrayCollection = new ArrayCollection([ {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99}, {Artist:'Sting', Album:'Brighten the Corners', Price:11.99}, {Artist:'Madonna', Album:'Brighten the Corners', Price:11.99} ]); // Define event listener for the cellEdit event // to prohibit editing of the Album column. private function disableEditing(event:DataGridEvent):void { var selectedDType:String = myGrid.dataProvider[myGrid.selectedIndex].Price; if(event.columnIndex==2 selectedDType == '11.99') { event.preventDefault(); myGrid.editedItemPosition = {columnIndex:event.columnIndex-2, rowIndex:event.rowIndex+1}; } } ]] /mx:Script mx:VBox width=100% height=100% horizontalScrollPolicy=auto mx:DataGrid id=myGrid tabEnabled=false dataProvider={initDG} itemEditBeginning=disableEditing(event); editable=true width=100% height=100% mx:columns mx:DataGridColumn dataField=Artist/ mx:DataGridColumn dataField=Album/ mx:DataGridColumn dataField=Price/ /mx:columns /mx:DataGrid mx:HBox width=100% verticalAlign=middle horizontalAlign=right mx:Button id=okbtn label=OK/ mx:Spacer height=3/ mx:Button id=cancelbtn label=Cancel/ mx:Spacer height=5/ /mx:HBox /mx:VBox /mx:Application From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Tuesday, May 20, 2008 2:31 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Datagrid cell editing question Maybe if you keep track of the last editedItemPosition you can tell if the user is tabbing or not. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pratima Rao Sent: Tuesday, May 20, 2008 1:20 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Datagrid cell editing question I have one more question - I changed the code in the disableEditing function and added another condition (in bold below). This breaks when you enter the return key in the datagrid. I know why this is happening. Is there another way to handle cell editing where tab and return key works when you enable or disable specific cells? The reason I ask is that I built a database query tool in Flex and I have a Create Table GUI where a user can insert column name, data type, length, precision, scale, primary key etc in the grid. Based on the datatype (VARCHAR, BIGINT, NUMERIC etc) the user selects I have to disable length, precision or scale. I used the approach below and it works fine as long as you don't tab or use the return key. Based on Alex's suggestion I got the tab to work but the return key doesn't work. I'm thinking that maybe this approach is not the right way to go but we are 2 weeks away from going into production and I don't want to redesign the GUI this late in the game. ?xml version=1.0? !-- itemRenderers\events\EndEditEventPreventEdit.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=100% height=100% mx:Script ![CDATA[ import mx.events.DataGridEvent; import mx.collections.ArrayCollection; [Bindable] private var initDG:ArrayCollection = new ArrayCollection([ {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99}, {Artist:'Sting', Album:'Brighten the Corners', Price:11.99}, {Artist:'Madonna', Album:'Brighten the Corners', Price:11.99} ]); // Define event listener for the cellEdit event // to prohibit editing of the Album column. private function disableEditing(event:DataGridEvent):void {
RE: [flexcoders] Multiple ItemRenderers for a single DataGridColumn
In Flex3, we added a createColumnItemRenderer method that in theory will let you return different renderers per-row. Might be worth a try. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dbronk Sent: Saturday, May 24, 2008 6:45 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Multiple ItemRenderers for a single DataGridColumn I have a DataGrid and one of the columns I need to be able to do the following based on the user security setting and the data in the column. So each row in the DataGrid for a single user may have different behavior and ItemRenderers. 1. Do not show any data and mark the cell not editable. Still show the column, just blank out the cell and do not allow editing. 2. Allow the user to see the data, but not edit it. I would like this to simply show as a Text field. 3. Display the data, and allow the user to edit the data via a TextInput control. 4. Display the data, and allow the user to edit the data via showing a CheckBox control. I know how to do each individually, but I do not know how to do this all at the same time in a single DataGridColumn. Can I do this? Thanks, Dale
RE: [flexcoders] callLater, FPS, and lengthy background operations
There's a post on my blog you may find useful: http://blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh McDonald Sent: Saturday, May 24, 2008 3:36 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] callLater, FPS, and lengthy background operations Hi Guys, If I have a long list of things to process as a background task, I figure a good way to do it is a piece at a time with callLater(). However I'd like to be able to detect if I'm taking too long per block and running into the next frame. Also, I'd like to do more per cycle if my app finds itself running on a ninja machine :) Anyone have any tips for this sort of thing? Should I just be using the timer and striving for 1/4 of a frame measured in ms? What framerate are Flex SWFs set to run at normally? Cheers, -J -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
RE: [flexcoders] custom event not added
Who's dispatching and how? When does the control get instantiated? Could it be after creationComplete? If the controller is not a UIComponent, it will not get a creationComplete. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dnk Sent: Friday, May 23, 2008 4:48 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] custom event not added Hi there, I have a controller that is adding my custom event listeners, but for some reason my event handler was not being fired. My original code was (snippet): (in controler) //constructor public function FlexbController() { //turn the key, start it up addEventListener( FlexEvent.CREATION_COMPLETE, onInit ); } private function onInit( event:Event ):void { //setup event listeners /*systemManager is where event listener hangs out defines the relationship between event and handler*/ systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, handler_GetNewsEvent ); systemManager.addEventListener( AddNewsEvent.ADD_NEWS_EVENT, handler_AddNewsEvent ); systemManager.addEventListener( NewsDataLoadedEvent.NEWS_LOADED_EVENT, handler_NewsLoadedEvent ); getNewsData(); } And I had trace statements in all of my handlers... this is how i noticed things were not working as they should. SO I added a simple check like (in my FlexbController constructor): if (systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, handler_GetNewsEvent )) { trace(true); } else { trace(false); } And I obviously am getting false. Ideas? dnk