[flexcoders] Flex Framework Cache Statistics
Hi All, I am just wondering if there is some data on the percentage of Flash players which would already have a the flex framework cache. Our application without the cache is 456Kb and when i use framework caching its 256Kb and the swz file is around 500kb. In this scenario if the user doesn't already have the framework cached, it won't make any sense to use framework caching. We don't have a high percentage of returning users yet. So if there is any data which gives an idea about the percentage of Flash players out there with the Flex framework cache, it will be really helpful. Thank you Nayan
Re: [flexcoders] VideoDisplay lies about bytesLoaded
Hi Dennis, I would just listen for progress event of the videodisplay component and get my bytesLoaded/bytesTotal from that. It has always worked correctly for me. Nayan On Apr 19, 2008, at 8:56 PM, Dennis Falling wrote: I'm using a changewatcher to observe the bytesLoaded attribute of a videoDisplay and update the UI accordingly. This works well most of the time, but once during each of the longer videos, bytesLoaded will jump, then continue loading. bytesLoaded / bytesTotal: 3186688/4971903 4971903/4971903 -- wrong 1900544/4971903 4247552/4971903 4971903/4971903 Does anyone know what could be causing this? Is there a better way to do this than using a changewatcher? Thanks.
[flexcoders] variables don't show up while debugging
Hi All, I am using Flex Builder 3 plugin for Eclipse and running on OS X, I have 9.0.115 version installed. When i debug the flex application, none of the variables show up in the variables window, earlier i used to see them all. this happened all of sudden, I have no clue why? any ideas / suggestions. thanks Nayan
Re: [flexcoders] Need some help with a function.
you have to listen for result event for the first function call and then call the RoTwo function from that resultEventHandler. Nayan On Apr 17, 2008, at 1:46 PM, Phill B wrote: I have an initialization function that gets ran on creationComplete. The init function calls two functions (RoOne RoTwo) that access a remote object. RoTwo needs the first value in the RoOne returned array. How do i make RoTwo wait for a respons from RoOne? Thanks -- Phil
Re: [flexcoders] How to add text properties to dragged Image.
you need to pass the parameters as drag source and then your drop handler should populate those values. Nayan On Apr 1, 2008, at 11:48 PM, Swamy Nathan wrote: Hi i am new to flex. i am using drag and drop functionality in canvas. when i dragdrop the image to canvas the image will add to the canvas container. In that situation i need add the label or text to the image like[ the image name and the image taken date etx.,] how can i do that stuff with the image when i dragdrop to canvas. please any one reply me. -- Thanks Regards Swaminathan. M
Re: [flexcoders] Question on calling multiple Functions in sequence
by scaling if you mean tweening and animations being executed inside a function, then the answer is no the flash player doesn't wait for the animation to finish. lets say if you have inside myFunction1 an animation which is supposed to scale a movie and it runs for 1 second. the flash player will begin the animation and then run myFunction2 immediately and not wait for 1 second so that the animation is finished, if you want your myFunction2 to run after the animation is finished, you have to listen for relevant events, there is no other way out. Nayan On Apr 2, 2008, at 7:27 PM, Mike Anderson wrote: Thank you Tracy and Eric - this DOES help me a lot - But I need to ask, what facilities are built into the FlashPlayer, that guarantees that Function2 doesn't run until Function1 not only executes, but actually FINISHES? Doing computations is one thing, but when you are doing scaling functions, or anything else that really doesn't provide any feedback one way or another when it's actually finished (scaling an object in this case), how can the containing function really KNOW? I know these may be novice questions, but these types of issues have been nagging me for a long time. The more I can understand what's really going on under the hood, the more effective of a programmer I can be. Thank you again for all your comments - please keep them coming :) Mike From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Eric Cancil Sent: Wednesday, April 02, 2008 6:34 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Question on calling multiple Functions in sequence When dealing with things inside the flash player - you need to deal with it as if it was single threaded - because generally, it is. In your example, the functions would be called in order, one after another...not all at the same time as you may think so lets say you had an example like this var myNumber:Number = 0; private function doThisFunction():void{ myFunction1(); myFunction2(); myFunction3(); } if function 1 added 10 to myNumber, function 2 multiplied it by 5, and function 3 subtracted 12 - it would happen in that order exactly - and you can count on that - so your final result would be 38 hope this helps eric On Wed, Apr 2, 2008 at 7:54 PM, Mike Anderson [EMAIL PROTECTED] wrote: Hello All, I was wondering how things work, when calling multiple functions in sequence. For example, in this function: private function doThisFunction():void { myFunctionOne(); myFunctionTwo(); myFunctionThree(); } When I execute doThisFunction, does it literally run the 3 functions one-two-three, or does it execute the first function, waits for it to finish, then runs the second function, waits for it to finish, then finally runs the third function. How could doThisFunction possibly know when myFunctionOne even finishes? My end goal, is to create a way for a function (containing more functions within) to stop and wait for each function to run complete, before executing the next one. I know Events are used quite often when things must happen in a sequence, but when it comes to things like Scaling or Sizing a Component, how could I possibly know when something like that finishes? Thanks in advance for any advice you can all throw my way :) Mike
[flexcoders] preventing removal of child in states before transition
Hi All, I am impressed with Flex the more i learn about it, I am using states and defining transitions when the states change. I add a child in one of the states and then when i go back to the default state this child gets removed by default immediately but i don't want this to happen. I want the transition to finish and then the child to be removed, is there a way to achieve that? or i shouldn't be using states in this situation. thanks Nayan
Re: [flexcoders] Mp3 player causing 40% CPU power
it would be the itunes art in bottom which would consume the cpu, We have no problems with Video files being played and the files are as large as 100 meg. Nayan On Thu, Mar 27, 2008 at 4:58 PM, Sajid Hussain [EMAIL PROTECTED] wrote: Hello , I have done one mp3 player with flex 2 but during streaming its taking more cpu power any suggestion? http://www.synergyi.com/videos/player2/MusicPlayer.html Sajid Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Re: [flexcoders] Mp3 player causing 40% CPU power
700 kbps videos, encoded using On2 no problems. They weren't HD videos though. Nayan On Thu, Mar 27, 2008 at 5:27 PM, Shiv Kumar [EMAIL PROTECTED] wrote: It's not the file size of the video that makes the difference but rather the bitrate at which the video is encoded. Our site supports HD video but we have to cut down the bitrate quite a bit (losing the HD ness of the video). From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Thursday, March 27, 2008 8:06 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Mp3 player causing 40% CPU power it would be the itunes art in bottom which would consume the cpu, We have no problems with Video files being played and the files are as large as 100 meg. Nayan On Thu, Mar 27, 2008 at 4:58 PM, Sajid Hussain [EMAIL PROTECTED] wrote: Hello , I have done one mp3 player with flex 2 but during streaming its taking more cpu power any suggestion? http://www.synergyi.com/videos/player2/MusicPlayer.html Sajid Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[flexcoders] making custom component scrollable
Hi All, I have a class extending UIComponent and i want to add a dynamic scrollbar to it. I could extend this class from ScrollControlBase instead but not sure how it will make it scrollable. Can I do an addChild in the createChildren of scrollcontrolbase and will it determine the child which is scrolled? I tried using this component inside HBox and make the box scrollable but it doesn't work. any help will be appreciated. thanks Nayan
Re: [flexcoders] making custom component scrollable
I looked at those classes and then extended my component from ScrollControlBase, the scrollbar shows up fine but it doesn't mask the child contents. The height of scrollbar also adjusts itself to the height of my component children but they just don't get masked. i see that updateDisplayList is the function in ScrollControlBase which sets the mask width and height. I am overridding updateDisplayList in my component. maybe i am missing something fundamental here. thanks Naayan On Wed, Mar 26, 2008 at 1:25 PM, Alex Harui [EMAIL PROTECTED] wrote: You can look at how TextArea and ListBase use the setScrollProperties method and respond to scroll events. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Wednesday, March 26, 2008 12:07 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] making custom component scrollable Hi All, I have a class extending UIComponent and i want to add a dynamic scrollbar to it. I could extend this class from ScrollControlBase instead but not sure how it will make it scrollable. Can I do an addChild in the createChildren of scrollcontrolbase and will it determine the child which is scrolled? I tried using this component inside HBox and make the box scrollable but it doesn't work. any help will be appreciated. thanks Nayan
Re: [flexcoders] making custom component scrollable
I am using the scrollcontrolbase and it doesn't have any mask property. messing with themashShape variable didn't yield good results as well. thanks for your suggestions. Nayan On Wed, Mar 26, 2008 at 4:47 PM, Alex Harui [EMAIL PROTECTED] wrote: You have to set the mask as the .mask property on some internal container of your children. For TextArea, the TextField does the masking, for ListBase, it is the listContent property that gets masked and all children are within it. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Wednesday, March 26, 2008 3:04 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] making custom component scrollable I looked at those classes and then extended my component from ScrollControlBase, the scrollbar shows up fine but it doesn't mask the child contents. The height of scrollbar also adjusts itself to the height of my component children but they just don't get masked. i see that updateDisplayList is the function in ScrollControlBase which sets the mask width and height. I am overridding updateDisplayList in my component. maybe i am missing something fundamental here. thanks Naayan On Wed, Mar 26, 2008 at 1:25 PM, Alex Harui [EMAIL PROTECTED] wrote: You can look at how TextArea and ListBase use the setScrollProperties method and respond to scroll events. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Wednesday, March 26, 2008 12:07 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] making custom component scrollable Hi All, I have a class extending UIComponent and i want to add a dynamic scrollbar to it. I could extend this class from ScrollControlBase instead but not sure how it will make it scrollable. Can I do an addChild in the createChildren of scrollcontrolbase and will it determine the child which is scrolled? I tried using this component inside HBox and make the box scrollable but it doesn't work. any help will be appreciated. thanks Nayan
Re: [flexcoders] arraycollection and tree
Hi Luke, Just create a List in Java and return it. alternatively you can add it to a Value Object and then return it. below is example of my function, CategoriesVo is simple java class with three public variables. public List getCategoriesAll(){ List list = new ArrayList(); String query = SELECT main.id, main.name, sub.name FROM maincategories AS main, subcategories AS sub WHERE main.id = sub.maincategoryId; //String query = SELECT * FROM maincategories; try { ResultSet results = connManager.stmt.executeQuery(query); //results.first(); String secondKey = ; String firstKey = ; Integer categoryId; while (results.next()){ CategoriesVo categories = new CategoriesVo(); firstKey = results.getString(2); categoryId = results.getInt(1); secondKey = results.getString(3); categories.mainCategory = secondKey; categories.subCategories = firstKey; categories.categoryId = prevCategory; list.add(categories); // hashMap.put(secondKey, list); // System.out.println(adding to the hashmap + secondKey); } } catch (SQLException e){ } return list; } this can be cast to arraycollection in Flex or you can loop through the result and add it to a collection. hope this helps. Nayan On Mar 24, 2008, at 10:57 PM, Luke Vanderfluit wrote: Hi. I am using remoteobject to get stuff from a database (java/mysql). I want to represent the List, generated on the server side and sent to the client as an arraycollection, as a tree. Does anyone have examples of how to do this. I have been reading the online docs but Im making very slow progress. Thanks. Kind regards. Luke.
Re: [flexcoders] RPC FaultEvent with BlazeDS
Hi Dominic, I had this problem when i replaced the {server}:{port} in the config files make sure you don't do that. The best thing would be to use the blazeds sample directory and add you classes in there to debug the application. Another useful thing i have found that if you run blazeds in terminal using Catalina command then you can use System.out.println in your java code and see the messages you want in the terminal. hope this helps. Nayan On Fri, Mar 21, 2008 at 7:10 AM, Dominic Pazula [EMAIL PROTECTED] wrote: I recently took the plunge and bucked up the $$$ for Flex Builder Pro. Today I uninstalled my Beta version and installed the new one. I imported my projects and recompiled. When running one that uses a RemoteObject and BlazeDS, I started getting the following RPC FaultError: The Fault String is Send Failed The Fault Detail is: Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8400/Components/messagebroker/amfpolling' I haven't changed anything server side. The compile options all look good (i.e. -services points to the correct XML file). Ideas? Thanks, Dominic
Re: [flexcoders] Error: channel not found for reference 'my-http'
its not and hence the following error, channel not found for reference 'my-http'. project Unknown 1205219746960 1210 thanks Nayan On Mar 11, 2008, at 1:59 PM, Seth Hodgson wrote: Check the Problems tab in FlexBuilder, and make sure your app is successfully compiling against your referenced configuration files. Best, Seth From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Tuesday, March 11, 2008 12:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Error: channel not found for reference 'my-http' Hi All, I am developing a blazeds application and getting the following error, I am using flexbuilder as eclipse plugin. channel not found for reference 'my-http' Funny thing is that i created a new project using the same server side configurations and it worked fine, I am guessing some corrupt project files. Can anyone point me to which one it would be. thanks for your help Nayan
(solved) Re: [flexcoders] Error: channel not found for reference 'my-http'
funny, i deleted the project and created a new one. now it works fine. weird issue. I had tried closing and opening the project but that didn't help. On Mar 12, 2008, at 12:32 AM, Nayan Savla wrote: its not and hence the following error, channel not found for reference 'my-http'. project Unknown 1205219746960 1210 thanks Nayan On Mar 11, 2008, at 1:59 PM, Seth Hodgson wrote: Check the Problems tab in FlexBuilder, and make sure your app is successfully compiling against your referenced configuration files. Best, Seth From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Tuesday, March 11, 2008 12:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Error: channel not found for reference 'my- http' Hi All, I am developing a blazeds application and getting the following error, I am using flexbuilder as eclipse plugin. channel not found for reference 'my-http' Funny thing is that i created a new project using the same server side configurations and it worked fine, I am guessing some corrupt project files. Can anyone point me to which one it would be. thanks for your help Nayan
[flexcoders] Error: channel not found for reference 'my-http'
Hi All, I am developing a blazeds application and getting the following error, I am using flexbuilder as eclipse plugin. channel not found for reference 'my-http' Funny thing is that i created a new project using the same server side configurations and it worked fine, I am guessing some corrupt project files. Can anyone point me to which one it would be. thanks for your help Nayan
Re: [flexcoders] extracting items from array collection getItemAt doesn't work
Tracy, I see your point in using e4x expressions and the performance hit i take just to use dynamic nested structure. It won't take much for me to convert my code to make use of e4x functionality. I have started doing that and i couldn't find a way to search and match attributes, for eg. property name=username value=me/ property name=account_status value=active/ property name=session_id value=h5142ner7vq5oitqcvi0/ property name=salt value=e9d6b14092524122254/ property name=signup_date value=2007-08-16/ property name=now value=2008-03-04/ property name=first_name value=Nayan/ how do i retrieve the value attribute associated with the attribute name=username ? I know i could always run a for loop and then store the data as name-value pairs in an object but i want to know if there is a way doing it using the xmllist class. testList.property.(@name == account_status)[EMAIL PROTECTED] something like this, it will be really helpful since something like this would be the beginning. thanks for all your help. Nayan On Mon, Mar 3, 2008 at 7:12 PM, Tracy Spratt [EMAIL PROTECTED] wrote: As I suspected, you are not using xml: I haven't set the resultformat of my httpservice, its using the default format. The default resultFormat is to have Flex convert your XML into a nested dynamic object structure. This converts XMLLists into arrays, among other things. Generally this is bad. There is no benefit to a nested dynamic structure over XML and in fact, there are many reasons to use XML, e4x expressions being chief among those reasons. Your current situation is actually the worst of both worlds: you lose the e4x functionality and suffer from the performance hits of non-strongly-typed data access. The only reason to stay on this course is laziness. If you absolutely insist, I will tell you how to get a ArrayCollection out of the mess you have, but it would be a mistake. Two better options are: * Use XMLListCollection * Use e4x and convert your XMLList into an ArrayCollection of strongly typed data objects. This is a manual process of looping over the XMLList and building each object and then adding it to the ArrayCollection Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Monday, March 03, 2008 7:11 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] extracting items from array collection getItemAt doesn't work the url parameter for the httpService is a XML file so yes, var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. this is true. I haven't set the resultformat of my httpservice, its using the default format. Also in the debugger i see that the variable bigCollection stores the xml file as a object list and as i mentioned i can easily extract the array from this using, var smallCollection:Array = bigCollection.toArray().slice(0,10); //this works just fine. the data in this array is as expected, What i don't understand is why i can't convert it into an ArrayCollection. Nayan On Mon, Mar 3, 2008 at 3:39 PM, Tracy Spratt [EMAIL PROTECTED] wrote: Have you verified this line below? It raises doubts: var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. First, XML will only yield an XMLList and you cannot cast an XMLList to an ArrayCollection. I suspect you may not have xml as you think, but instead a nested object structure. It depends on how you are getting your data. If that is so, it is not a good way to do it. Have you set your resultFormat=e4x? If you are getting XML from the server, why not use XMLListCollection? If you do not want to use that, you should convert your XMLList into an ArrayCollection of strongly typed data objects. This is a manual process of looping over the XMLList and building each object and then adding it to the AC. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Monday, March 03, 2008 4:00 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] extracting items from array collection getItemAt doesn't work Hi All, I am trying to get data from an ArrayCollection and i tried various things without any luck. this is the code, var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. 1) var smallCollection:ArrayCollection = bigCollection.getItemAt(0,10); //i believe this is the correct method but doesn't work 2) var smallCollection:ArrayCollection = bigCollection.toArray().slice(0,10) as ArrayCollection; //this returns null 3) var
Re: [flexcoders] Flickr Libraries on Adobe Labs
Hi Ethan, the flickr libraries last time i tried it had some show stopping bugs in it (http://code.google.com/p/as3flickrlib/issues/detail?id=14q=farm), it also depends on what exactly are you doing with the api's i have some code sample if you are just trying to fetch a photoset by username. haven't got chance to dig further into them. Nayan On Tue, Mar 4, 2008 at 11:36 AM, Ethan Miller [EMAIL PROTECTED] wrote: Greetings - Have been trying to use the Flickr AS3 libraries on labs.adobe.com (now hosted on Google Code) and seem to be hitting the same early roadblocks that many have, ie at the get authorization token area of things. Has anyone gotten past this, or have alternate code/samples etc. Note that if anyone needs even earlier help, regarding the api_key and shared secret, lemme know as I've gotten at least that far. cheers, ethan
Re: [flexcoders] Re: Flickr Libraries on Adobe Labs
?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:local=* initialize=init() mx:Script ![CDATA[ import mx.controls.Alert; import com.adobe.webapis.flickr.FlickrService; import com.adobe.webapis.flickr.events.FlickrResultEvent; import com.adobe.webapis.flickr.methodgroups.PhotoSets; private var service:FlickrService; //private var sets:PhotoSets; private function init():void{ service = new FlickrService(YOUR_API_KEY); service.secret = SECRET_KEY; service.addEventListener(FlickrResultEvent.PHOTOSETS_GET_LIST,gotPhotoList); var sets:PhotoSets = new PhotoSets(service); sets.getList(USERNAME); } private function gotPhotoList(event:FlickrResultEvent):void{ if (event.success){ var titleArr:Array = new Array(); for (var temp:String in event.data.photoSets){ //str += \ntitle is + event.data.photoSets[temp].title; titleArr.push({label:event.data.photoSets[temp].title,data:event.data.photoSets[temp].id}); } setsList.dataProvider = titleArr; // } else { mx.controls.Alert.show(Error Getting Photosets); } } private function setSelected():void{ //Alert.show(setsList.selectedItem.data); service.addEventListener(FlickrResultEvent.PHOTOSETS_GET_PHOTOS,photosReceived); var sets:PhotoSets = new PhotoSets(service); sets.getPhotos(setsList.selectedItem.data); } private function photosReceived(event:FlickrResultEvent):void{ //mx.controls.Alert.show(String(event.success)); if (event.success){ var str:String =; var tempStr:String = come on; var urlArray:Array = new Array(); for (var temp:String in event.data.photoSet.photos){ str += \n+temp + event.data.photoSet.photos[0] ; for (var str2:String in event.data.photoSet.photos[temp]){ tempStr += \n give me + str2; } // str += .static.flickr.com/+event.data.photoSet.photos[temp].server; // str += /+event.data.photoSet.photos[temp].id + _+event.data.photoSet.photos[temp].secret; // str += _s.jpg; //urlArray.push(str); //titleArr.push({label:event.data.photoSets[temp].title,data:event.data.photoSets[temp].id}); } mx.controls.Alert.show(str); mx.controls.Alert.show(tempStr); //displayImage.source = urlArray[0]; }else { mx.controls.Alert.show(Error Getting Photos); } } ]] /mx:Script mx:List x=10 y=10 height=599 id=setsList click=setSelected() /mx:List mx:Image x=180 y=10 width=548 height=599 id=displayImage/ /mx:Application This is all i had tried, never got chance to go further. Nayan On Tue, Mar 4, 2008 at 12:31 PM, Khuffie [EMAIL PROTECTED] wrote: The sample code here: http://code.google.com/p/as3flickrlib/wiki/LoginProcess is fine for the most part. Just replace the following line: var authResult:AuthResult = AuthResult( event.data ); With: var authResult:AuthResult = AuthResult( event.data.auth ); And it will
Re: [flexcoders] extracting items from array collection getItemAt doesn't work
cool, found out what i was doing wrong, testList.property.(@name == account_status)[EMAIL PROTECTED] //not the correct node had to use, testList.(@name == account_status)[EMAIL PROTECTED] in this case there is name, value attributes for every node, will keep the other way in mind as well. thanks once again. Nayan On Tue, Mar 4, 2008 at 4:33 PM, Tracy Spratt [EMAIL PROTECTED] wrote: NO FOR LOOPS with e4x! Well, hardly ever anyway. You access serach on attributes like this: var xlFound:XMLList = myXML.property.(@name==username); //*all e4x expressions return an xmllist* var xmlFound:XML = xlFound[0]; //if we know there wil be only one node found, get it trace([EMAIL PROTECTED]); //will show 'me' Note, if you are filtering on an attribute value, and not all nodes have that attribute, you will get an error with the above syntax. To avoid that I always use this form: var xlFound:XMLList = myXML.property.(attribute(name)==username); //*all e4x expressions return an xmllist* That format also lends itself to dynamic expressions, since name or whatever can be a variable containing the attribute name. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Tuesday, March 04, 2008 2:36 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] extracting items from array collection getItemAt doesn't work Tracy, I see your point in using e4x expressions and the performance hit i take just to use dynamic nested structure. It won't take much for me to convert my code to make use of e4x functionality. I have started doing that and i couldn't find a way to search and match attributes, for eg. property name=username value=me/ property name=account_status value=active/ property name=session_id value=h5142ner7vq5oitqcvi0/ property name=salt value=e9d6b14092524122254/ property name=signup_date value=2007-08-16/ property name=now value=2008-03-04/ property name=first_name value=Nayan/ how do i retrieve the value attribute associated with the attribute name=username ? I know i could always run a for loop and then store the data as name-value pairs in an object but i want to know if there is a way doing it using the xmllist class. testList.property.(@name == account_status)[EMAIL PROTECTED] something like this, it will be really helpful since something like this would be the beginning. thanks for all your help. Nayan On Mon, Mar 3, 2008 at 7:12 PM, Tracy Spratt [EMAIL PROTECTED] wrote: As I suspected, you are not using xml: I haven't set the resultformat of my httpservice, its using the default format. The default resultFormat is to have Flex convert your XML into a nested dynamic object structure. This converts XMLLists into arrays, among other things. Generally this is bad. There is no benefit to a nested dynamic structure over XML and in fact, there are many reasons to use XML, e4x expressions being chief among those reasons. Your current situation is actually the worst of both worlds: you lose the e4x functionality and suffer from the performance hits of non-strongly-typed data access. The only reason to stay on this course is laziness. If you absolutely insist, I will tell you how to get a ArrayCollection out of the mess you have, but it would be a mistake. Two better options are: * Use XMLListCollection * Use e4x and convert your XMLList into an ArrayCollection of strongly typed data objects. This is a manual process of looping over the XMLList and building each object and then adding it to the ArrayCollection Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Monday, March 03, 2008 7:11 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] extracting items from array collection getItemAt doesn't work the url parameter for the httpService is a XML file so yes, var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. this is true. I haven't set the resultformat of my httpservice, its using the default format. Also in the debugger i see that the variable bigCollection stores the xml file as a object list and as i mentioned i can easily extract the array from this using, var smallCollection:Array = bigCollection.toArray().slice(0,10); //this works just fine. the data in this array is as expected, What i don't understand is why i can't convert it into an ArrayCollection. Nayan On Mon, Mar 3, 2008 at 3:39 PM, Tracy Spratt [EMAIL PROTECTED] wrote: Have you verified this line below? It raises
[flexcoders] extracting items from array collection getItemAt doesn't work
Hi All, I am trying to get data from an ArrayCollection and i tried various things without any luck. this is the code, var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. 1) var smallCollection:ArrayCollection = bigCollection.getItemAt(0,10); //i believe this is the correct method but doesn't work 2) var smallCollection:ArrayCollection = bigCollection.toArray().slice(0,10) as ArrayCollection; //this returns null 3) var smallCollection:Array = bigCollection.toArray().slice(0,10); //this works just fine. any ideas why i can't just use the second statement, please ignore my knowledge of flex if i am missing something fundamental. thanks Nayan
Re: [flexcoders] extracting items from array collection getItemAt doesn't work
the url parameter for the httpService is a XML file so yes, var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. this is true. I haven't set the resultformat of my httpservice, its using the default format. Also in the debugger i see that the variable bigCollection stores the xml file as a object list and as i mentioned i can easily extract the array from this using, var smallCollection:Array = bigCollection.toArray().slice(0,10); //this works just fine. the data in this array is as expected, What i don't understand is why i can't convert it into an ArrayCollection. Nayan On Mon, Mar 3, 2008 at 3:39 PM, Tracy Spratt [EMAIL PROTECTED] wrote: Have you verified this line below? It raises doubts: var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. First, XML will only yield an XMLList and you cannot cast an XMLList to an ArrayCollection. I suspect you may not have xml as you think, but instead a nested object structure. It depends on how you are getting your data. If that is so, it is not a good way to do it. Have you set your resultFormat=e4x? If you are getting XML from the server, why not use XMLListCollection? If you do not want to use that, you should convert your XMLList into an ArrayCollection of strongly typed data objects. This is a manual process of looping over the XMLList and building each object and then adding it to the AC. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Monday, March 03, 2008 4:00 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] extracting items from array collection getItemAt doesn't work Hi All, I am trying to get data from an ArrayCollection and i tried various things without any luck. this is the code, var bigCollection:ArrayCollection = data.result.myBigList as ArrayCollection; //I am reading an xml file. 1) var smallCollection:ArrayCollection = bigCollection.getItemAt(0,10); //i believe this is the correct method but doesn't work 2) var smallCollection:ArrayCollection = bigCollection.toArray().slice(0,10) as ArrayCollection; //this returns null 3) var smallCollection:Array = bigCollection.toArray().slice(0,10); //this works just fine. any ideas why i can't just use the second statement, please ignore my knowledge of flex if i am missing something fundamental. thanks Nayan
[flexcoders] debugging with flashvars
Hi All, I just started foray in Flex 3 and have been using flex builder plugin for eclipse. I have modified my output html file so that is passes the flashvars but then everytime i run the application a new html file is generated. If i uncheck the generation of html page in the project properties then the swf file is launched in the browser and there is no html wrapper to pass the flashvars. I would ideally like the debugger to launch the html file and it not being regenerated everytime. Any ideas, suggestions to this problem? thanks Nayan
Re: [flexcoders] debugging with flashvars
It seems that flex only changes the default html file all the time, made changes to the template html and then copied it to the bin-debug and then changed the run properties to run that html fine. works perfect. thanks Nayan On Fri, Feb 29, 2008 at 4:08 PM, Tracy Spratt [EMAIL PROTECTED] wrote: Make your changes to the index.template.html file. Do a project, clean to make sure the wrapper gets re-generated. If you need multiple start-up conditions, copy the generated wrapper, modify it and put it in html-template folder (it will get copied to the bin folder on compile). You can use the menu, Run, Run, Other dialog to set up multiple run environments. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nayan Savla Sent: Friday, February 29, 2008 5:21 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] debugging with flashvars Hi All, I just started foray in Flex 3 and have been using flex builder plugin for eclipse. I have modified my output html file so that is passes the flashvars but then everytime i run the application a new html file is generated. If i uncheck the generation of html page in the project properties then the swf file is launched in the browser and there is no html wrapper to pass the flashvars. I would ideally like the debugger to launch the html file and it not being regenerated everytime. Any ideas, suggestions to this problem? thanks Nayan
Re: [flexcoders] Re: DataGrid - programmatically selecting the first row - selectedItem is null
i used updateComplete to listen for changes in the dataProvider. private function categoryDataChanged(event:FlexEvent):void{ if(event.currentTarget == categoryCombo){ //this is to prevent it from collecting garbage data for the first time try { if (event.target.selectedItem.data != -1) { } } catch(e:Error){ //do nothing } } } this is how my listener is implemented, i had to use try block because the first time the value would be null and i wouldn't get error in flex. Nayan On Fri, Feb 29, 2008 at 4:03 PM, Tracy Spratt [EMAIL PROTECTED] wrote: I have found that whenever you programatically assign a dataProvider, you must use callLater() to invoke any methods that affect the visual UI. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of guitarguy555 Sent: Friday, February 29, 2008 3:50 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: DataGrid - programmatically selecting the first row - selectedItem is null Thanks for the replies - well, I tried that suggestion ( dg.selectedItem = xmlData[0] )and the XML is null at this point. Yes, the XML data is not available yet when the App's creation complete is called. I should have mentioned as well that this DataGrid and form are in a component. The component's DataGrid data source is set from the mxml declaration in the application. The XML data is retrieved from an HTTPSService object. So in the main App, once this XML data is retrieved, I now try to set the selectedItem as follows in the result handler: private function onHandleGetData(event:ResultEvent):void{ tableData = event.result as XML; dg.dgSelector.selectedItem = tableData[0]; } When I step through the code, I can see that the result contains the desired XML. But when I step into the code on that last line - where I try to assign a value to dg.selectedItem, Flex ends up in the ListBase.as clearSelected() function. In this function these 2 lines get called: _selectedIndex = -1; _selectedItem = null; which cancel out the assignment!! Has anybody else run into this situation? I just want to programmatically select that first row and have the corresponding form populate with that row's values. Given that the Grid and form are in a component, this might complicate things but it seems to me that this would be a common scenario - having a master/detail Grid/Form in a component. Thanks --- In flexcoders@yahoogroups.com, letterpigeon [EMAIL PROTECTED] wrote: I think this might be a race condition problem. Your data might not have been loaded when the creationComplete event is fired (it is fired after all the UI components are created, but any service call you made to load up the data might not have returned yet). Ban --- In flexcoders@yahoogroups.com, guitarguy555 djohnson29@ wrote: In my application, I have a datagrid that is bound to XML data. The datagrid has a corresponding form that contains the details. When the user clicks on a row in the datagrid the form populates with the values from the DataGrid's selectedItem. I want to programatically select the first row in my DataGrid when the application loads. In order to do this, I have to call validateNow() and scrollToIndex() eg. dg.selectedIndex = 0; dg.validateNow(); dg.scrollToIndex(0); I put this code in the Applications creationComplete handler. This all works great - the first row is highlighted and selected and the selectedIndex is 0. The problem is that I can't access the data to populate the details form. When I try to retrieve the dg.SelectedItem property - it is null. How does one programatically select the first row in the grid on load AND access the row data? thanks