[flexcoders] Invalid data error while embedding symbols from external Swf
Hello All, Till now I have been successfully working by embedding movieclips from external swf in my flex application. But now I am facing a weird error. I have to create a form which contains these embedded movieclip symbols. As soon as the form comes up I get the run time error saying The swf contains invalid data. I dont know what is creating this issue. I have been searching google but the only solution I got was to remove any code on the timeline (which I do not have) and convert any jpeg to lossless gif/png ( have done that for all the bitmap even though my form does not use any of them). But still the issue is not going. I have also tried shifting the respective symbols at the origin but no result. Has somebody faced similar error before? Please provide me some pointers. Its driving me mad Thanks, Rohit
Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
Hi Sam, Basically this is the process which I am using. .NET Retrieve records from Oracle DB and store the same into a dataset. Return the dataset as XML string via the command DataSet.GetXML. Flex In the event handler of my webservice method call, I parse the string into XML, then ArrayCollection via the following codes: private var _xmlData:XML; [Bindable] private var arrDP:ArrayCollection = new ArrayCollection; _xmlData = XML(event.result); var oTemp:Object; var xl:XMLList = _xmlData.children(); var i:int; for(i = 0; i xl.length(); i++) { oTemp = {NAME:xl[i].NAME.text(), TEAM:xl[i].TEAM.text(), JERSEY:xl[i].JERSEY.text(), MANAGER:xl[i].MANAGER.text()}; arrDP.addItem(oTemp); } and in my datagrid, I am setting its dataProvider to the arrDP variable. I used Array Collection because I implemented a search and filter functionality which searches and filters the data accordingly for the dataprovider which is then reflected back to the datagrid. Now, when I need to return the ArrayCollection to .NET, I simply pass the same as a parameter to a .NET function which accepts ArrayList as parameter. .NET Once the function receieves the arraycollection (which is then now an array list), I get the arrays inside the arraylist and get the values inside the array. I think by doing things like this, it may not be the best way. You mentioned you'd map the XML to typed objects in .NET. How can I do this? Instead of using arraycollection as dataprovider in my datagrid, can I use another which would be much easier when I pass back to the .NET function? Whats the best way to interact large set of data (datasets) between .NET and Flex? Thanks a lot. From: Sam Lai samuel@gmail.com To: flexcoders@yahoogroups.com Sent: Friday, 3 July, 2009 13:52:12 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService Instead of using an array list and trying to emulate the type-less abilities of AS3, I'd try to map the XML to typed objects in .NET. Or does the XML from your Flex app differ too wildly to do this? Are you using the XmlSerializer to deserialize this? Or are you using WCF? Or are you doing it some other way, or manually? I'd provide an example, but I don't know enough details on your situation to give something useful :) 2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com: Hi Sam, Care to show some examples? I am parsing the arrayCollection into an ArrayList on .NET. This is particularly not too appealing since I just discovered that for example, if one of the objects in the arraycollection would have an empty string value, the number of items inside the array is not reflected properly in .NET. Like: private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 , Value:Select }, {ID:002, Value:Choose }, {ID:003, Value:},]) ; When I pass this var arrR into a .NET webservice and delegate it to an ArrayList, the items in the array list will have one of the arrays only containing 1 item (instead of 2). Adding to my problem is the fact that the arrays inside the array list when read in .NET should have the object ID and Value be in order but they are not. This is further true when there are many items in the array collection. Sometimes, the first item becomes the last one in the array list, and sometimes the order is not well. In any case, I am finding a solution on how I would be able to pass an ArrayCollection to .NET and be able to parse it properly. Thanks. _ _ __ From: Sam Lai samuel@gmail. com To: flexcod...@yahoogro ups.com Sent: Thursday, 2 July, 2009 15:46:58 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService How is it being parsed in .NET? You can parse it into a hashtable, or better yet, use a pre-defined object. Not sure why the order is different, but it is probably fragile to rely on the order in this case. 2009/7/2 Angelo Anolin angelo_anolin@ yahoo.com: Hi FlexCoders, I have an array collection which I am populating as follows: var oTemp:Object; var xl:XMLList = _xmlData.children( ); var i:int; for(i = 0; i xl.length(); i++) { oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ), DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ), IND_TAG:xl[i] .IND.text( )}; arrDP.addItem( oTemp); } Now, when I pass back this Array Collection back into a web service, the fields are not in order as I have added them into the array collection. I am expecting that in my Web Service, when I parse this arraycollection (via arraylist), I would be getting the same order of columns as I have added them, i.e. the first array in the array list would have element 0 to be the value I placed in the ID. Since the arraylist does
[flexcoders] Bring forward something in flex
I have a lot titlewindow in the application. But the main panel which wrote by mxml is always covered by some titlewindow. How can I bring the main panel forward when I clicked it ?
Re: [flexcoders] Bring forward something in flex
It is related to the order that you declare component in your mxml ... The latter the better. C From: j2me_soul j2me_s...@163.com To: flexcoders flexcoders@yahoogroups.com Sent: Friday, July 3, 2009 11:36:20 AM Subject: [flexcoders] Bring forward something in flex I have a lot titlewindow in the application. But the main panel which wrote by mxml is always covered by some titlewindow. How can I bring the main panel forward when I clicked it ? 200万种商品,最低价格,疯狂诱惑你
[flexcoders] Vertical scroll bar on left hand side
-- View this message in context: http://www.nabble.com/Vertical-scroll-bar-on-left-hand-side-tp24320336p24320336.html Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] Vertical scroll bar on left hand side
Hey guys, I am trying to get a canvas component to display the vertical scroll bar on the left hand side, as opposed to the right. I can't seem to find anything online which suggests how to do this, any ideas? -- View this message in context: http://www.nabble.com/Vertical-scroll-bar-on-left-hand-side-tp24320345p24320345.html Sent from the FlexCoders mailing list archive at Nabble.com.
Re:Re: [flexcoders] Bring forward something in flex
How can I change the order at runtime? If I wanna bring some component forward. Just like the titlewindow, the titlewindow clicked bring to the most head of the screen. 在2009-07-03,claudiu ursica the_bran...@yahoo.com 写道: It is related to the order that you declare component in your mxml ... The latter the better. C From: j2me_soul j2me_s...@163.com To: flexcoders flexcoders@yahoogroups.com Sent: Friday, July 3, 2009 11:36:20 AM Subject: [flexcoders] Bring forward something in flex I have a lot titlewindow in the application. But the main panel which wrote by mxml is always covered by some titlewindow. How can I bring the main panel forward when I clicked it ? 200万种商品,最低价格,疯狂诱惑你
[flexcoders] dynamic image gallery
Hi guys I have a problem with an image gallery am trying to do. This is the scenario. In my application I have the main application file gallery.mxml and three custom components namely imageName.mxml, imageGallery.mxml and Thumbnail.mxml. what am trying to do is have a dynamic image gallery where imageName.mxml loads image names from a database and is used to point to a path to get corresponding images on the server. So am using events to tell the main application that image source has changed so that whenever someone clicks on the list of image names, different images are loaded in the horizontal list. Everything works perfectly well except the images are not showing up in the horizontal list component. Yet when I test the path to images everything is good and event the events are dispatched well. Please help me understand what is causing the images not to show in the horizontal list. Below is my code . Thanks in advance. gallery.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:ns1=components.* mx:Script ![CDATA[ import mx.rpc.events.ResultEvent; import mx.controls.Alert; import mx.managers.CursorManager; import mx.collections.ArrayCollection; [Bindable] private var dataAr1:ArrayCollection; private function concernOriginalReceived(event:ResultEvent):void { dataAr1 = event.result as ArrayCollection; } private function imageListHandler(event:Event):void{ trace(Someone clicked on the Large Green Button!); remoteObj.gallery.send(); } ]] /mx:Script mx:RemoteObject id=remoteObj destination=ColdFusion source=gallery.cfcs.gallery mx:method name=gallery result=concernOriginalReceived(event) fault=Alert.show(event.fault.faultString,'Error'); mx:arguments imgid_home{imgid_home.text}/imgid_home /mx:arguments /mx:method /mx:RemoteObject mx:Model id=homeImages images img1{dataAr1.getItemAt(0).img1}/img1 img2{dataAr1.getItemAt(0).img2}/img2 img3{dataAr1.getItemAt(0).img3}/img3 img4{dataAr1.getItemAt(0).img4}/img4 /images /mx:Model !--mx:Array id=home_img mx:Stringassets/homeprofile_pics/extra_pics/{homeImages.img1}/mx:String mx:Stringassets/homeprofile_pics/extra_pics/{homeImages.img2}/mx:String mx:Stringassets/homeprofile_pics/extra_pics/{homeImages.img3}/mx:String mx:Stringassets/homeprofile_pics/extra_pics/{homeImages.img4}/mx:String /mx:Array -- ns1:imageName id=home_tiles x=0 y=140 addImageEvent=imageListHandler(event)/ ns1:imgGallery x=170 y=140/ mx:Text id=imgid_home text={home_tiles.selectedItem.imgid_home}/ mx:Label id=img1 x=254 y=0 text={dataAr1.getItemAt(0).img1}/ mx:Image x=499 y=0 mx:sourceassets/homeprofile_pics/extra_pics/{homeImages.img4}/mx:source /mx:Image /mx:Application imageName.mxml ?xml version=1.0 encoding=utf-8? mx:List xmlns:mx=http://www.adobe.com/2006/mxml; dataProvider={dataAr} labelField=location creationComplete=Init() change=ClickEventHandler() mx:Script ![CDATA[ import mx.rpc.events.ResultEvent; import mx.controls.Alert; import mx.managers.CursorManager; import mx.collections.ArrayCollection; public function Init():void{ homeSvc.load(); } [Bindable] private var dataAr:ArrayCollection = new ArrayCollection; public function displayResult(event:ResultEvent):void{ dataAr = new ArrayCollection( (event.result as ArrayCollection).source); } private function ClickEventHandler():void{ trace(Ouch! I got clicked! Let me tell this to the world.); dispatchEvent(new Event(addImageEvent, true));// bubble to parent } ]] /mx:Script mx:RemoteObject id=homeSvc destination=ColdFusion source=gallery.cfcs.homes1 showBusyCursor=true
Re: [flexcoders] Re: Is license required to deploye the flex chart application
thanks, From: valdhor valdhorli...@embarqmail.com To: flexcoders@yahoogroups.com Sent: Wednesday, 1 July, 2009 22:33:19 Subject: [flexcoders] Re: Is license required to deploye the flex chart application Sorry, I think I put you wrong there. If you have the Flex Builder license then when you deploy the SWF file you do NOT need a license to distribute with it. --- In flexcod...@yahoogro ups.com, Krunal Panchal panchal_kru@ ... wrote: thanks for response. i read somewhere that to develope the flex application license is required but to depoly the application on server it does not required. Let me help to clear my understanding. Regards, _ _ __ Krunal Panchal _ _ __ From: valdhor valdhorlists@ ... To: flexcod...@yahoogro ups.com Sent: Tuesday, 30 June, 2009 21:21:51 Subject: [flexcoders] Re: Is license required to deploye the flex chart application Yes --- In flexcod...@yahoogro ups.com, Krunal Panchal panchal_kru@ ... wrote: Is license required to deploye the flex chart application? Regards, _ _ __ Krunal Panchal | Senior Software Engineer
Re: [flexcoders] Testing socket...
That was exactly what I was trying to avoid using an external language I would like to keep pure as3 here... But see no way to do that. VELO On Fri, Jul 3, 2009 at 12:51 AM, Gautam P p.gau...@gmail.com wrote: [Attachment(s) #1223eede90fcd523_TopText from Gautam P included below] Hope this helps... On Thu, Jul 2, 2009 at 7:27 PM, Marvin Froeder velo...@gmail.com wrote: Hi, I have an APP that connects to a server using socket... but, I would like to unit test it w/o connecting the real server... is there any way I can create a flex server socket? Maybe using AIR? I found no way so far. VELO
[flexcoders] Re: Data Pushing
You can push data yourself using a sockect class. One product I have tried was Lighstreamer. --- In flexcoders@yahoogroups.com, Adrian Resa Jones noregret...@... wrote: The software (flex or air) needs to allow more than one user to work on the same data at the same time in a collaborative effort and to reflect the changes made by the other users. Has anyone worked with data pushing? What products have you used for .Net or for .Php and which tools worked best for you? Would flex + ajax be the best way to go, flourinefx, WebOrb? A. Resa Jones
Re: [flexcoders] Bring forward something in flex
The initial layout is related tot he order you declare things in MXML, but that doesn't help him move children around by clicking on something in the background. Take a look at SwapChildren and/or SwampChildrenAt: http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObjectContainer.html#swapChildren() http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObjectContainer.html#swapChildrenAt() claudiu ursica wrote: It is related to the order that you declare component in your mxml ... The latter the better. C *From:* j2me_soul j2me_s...@163.com *To:* flexcoders flexcoders@yahoogroups.com *Sent:* Friday, July 3, 2009 11:36:20 AM *Subject:* [flexcoders] Bring forward something in flex I have a lot titlewindow in the application. But the main panel which wrote by mxml is always covered by some titlewindow. How can I bring the main panel forward when I clicked it ? 200 万种商品,最低价格,疯狂诱惑你 http://count.mail.163.com/redirect/footer.htm?f=http://gouwu.youdao.com -- Jeffry Houser, Technical Entrepreneur Adobe Community Expert: http://tinyurl.com/684b5h http://www.twitter.com/reboog711 | Phone: 203-379-0773 -- Easy to use Interface Components for Flex Developers http://www.flextras.com?c=104 -- http://www.theflexshow.com http://www.jeffryhouser.com -- Part of the DotComIt Brain Trust
[flexcoders] Popup in new Browser window
Hi, I am facing some trouble on working with Popups. In my application, I have 2 panels, leftPanel(contains a tree) and rightPanel(shows charts/live data from DB based on the selected tree leaf and it autorefreshes every 10 seconds). I am trying to implement a functionality in which I have a button(show in new window) in the rightPanel, and on clicking the button, I would like the current contents of the right panel to be presented in a new Browser Window. The user can then choose some other tree leaf(from leftPanel) and view other chart on the rightPanel, while the popped up browser window still show data pertaining to the first tree leaf. Can someone please help me out? Thanks
[flexcoders] HELP PLS
I'm trying to learn Flex. Can anyone guide me, where I can get the information about this. I am beginner to Flex Thanks in Advance.
[flexcoders] Flex in eclipse
Is there on the internet some good explanation step by step, how to configure eclipse to develop flex applications. Thanks
[flexcoders] Re: Flex in eclipse
O yeah, I want to connect eclipse to flex SDK, looking for free solution :) --- In flexcoders@yahoogroups.com, vladakg85 vladak...@... wrote: Is there on the internet some good explanation step by step, how to configure eclipse to develop flex applications. Thanks
[flexcoders] Disable TitleList,DataGrid scroll on click and drag
TitleList and DataGrid scroll the view area when you click and drag outside of the control area. In my application I would like to drag items from one control to another and don't want them to scroll. Is there a way I disable this click-drag functionality? thanks, Michael
Re: [flexcoders] HELP PLS
http://www.adobe.com/devnet/flex/videotraining/ On Fri, Jul 3, 2009 at 8:21 AM, veerendragaonkar.viren...@yahoo.com wrote: I'm trying to learn Flex. Can anyone guide me, where I can get the information about this. I am beginner to Flex Thanks in Advance.
[flexcoders] Problems with Julian Dates with AIR percision?
I'm writing some unit tests for my database, and I'm having a real problem with Julian date comparisons in the SQLite database. I'm trying to load records by the following query: select * from Table where created_at ? If my given Date is less than stored dates by 100ms SQLite fails to hand them back. I've taken the times stored in SQLite and put them into coversion programs to convert them to unix epoch longs, and millisecond percision is stored in the number. SQLIte does have percision down to the millisecond, but when I do a sql query they fail to compare correctly. I've also confirmed that I do get back the milliseconds correctly stored in the actionscript's Date object. Has anyone else had trouble like this? Should I just store them as unix epoch integers rather than SQLite's Julian? These timestamps are important and I want them to be as precise as possible so while I could chalk it up to only have second precision that increases the likelyhood of mistakes if operations occur within that second. Charlie
Re: [flexcoders] Re: why does my MXML act differently than my AS?
I'm torn on whether to submit this as a bug. I wish someone at adobe could step in and say well, that's not equivalent MXML because you forgot about __. On Thu, Jul 2, 2009 at 10:32 AM, valdhor valdhorli...@embarqmail.comwrote: Nope. I confirmed what you are seeing but couldn't figure out why in the limited time I had to look at it. I am going to have to defer to someone more knowledgeable. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: No ideas on this one? On Wed, Jun 17, 2009 at 12:00 PM, Pan Troglodytes chimpathetic@ ...wrote: I have a test program that, as far as I can tell, does the same thing using an MXML component and the equivalent actionscript. When I click on the button to execute the AS version, everything is fine. But when I click on the button to execute the MXML version, I get a layout flicker. It's bad enough that if you try to click on the MXML button over and over really fast, you'll wind up clicking the main app and the menu will go away. Here's the code: ?xml version=1.0 encoding=utf-8? Application xmlns=http://www.adobe.com/2006/mxml; layout=absolute Script ![CDATA[ import mx.containers.GridItem; import mx.controls.Label; import mx.controls.DateField; private function addCategoryAS():void { var gi:GridItem; var gr:GridRow = new GridRow; gi = new GridItem; gr.addChild(gi); gi.addChild(new Label); addRow(gr); } private function addCategoryMXML():void { var gr:GridRow = new TestGridRow; gr.initialize(); // this is just to try to make it equivalent - doesn't change flicker addRow(gr); } private function addRow(gr:GridRow):void { grid.addChildAt(gr, 0); var gi:GridItem; gi = gr.getChildAt(0) as GridItem; (gi.getChildAt(0) as Label).text = item + grid.numChildren + :; gr.validateSize(true); var verticalGap:Number = grid.getStyle(verticalGap); popup.scrollRect = new Rectangle(0, 0, Math.max(popup.width + gr.measuredWidth), popup.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap)); if (popup.localToGlobal(new Point(0, 0)).y popup.owner.localToGlobal(new Point(0, 0)).y) popup.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); } ]] /Script Canvas bottom=0 PopUpButton id=myPopupButton openAlways=true popUp Canvas id=popup Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4 paddingRight=4 fontSize=12 backgroundColor=0xFF borderStyle=outset borderThickness=2 GridRow GridItem Button label=Add AS click=addCategoryAS()/ Button label=Add MXML click=addCategoryMXML()/ /GridItem /GridRow /Grid /Canvas /popUp /PopUpButton /Canvas /Application TestGridRow.mxml: ?xml version=1.0 encoding=utf-8? GridRow xmlns=http://www.adobe.com/2006/mxml; GridItem Label/ /GridItem /GridRow I've dug through the generated code and have not been able to find anything that I think would account for the problem. This is frustrating, because what I really want to do is a more complicated MXML component to make it a lot nicer to add rows in my addCategory function. But I can't as long as it's going to be so jittery. Thanks! -- Jason -- Jason -- Jason
[flexcoders] Re: getting the xml data from a dispatched event
any Idea? --- In flexcoders@yahoogroups.com, Jason B nos...@... wrote: yes heres the results Main0.vsMain.HBox8.VBox968.vsCreateMeals.VBox971.pnlCreateBreakfast.coverflow.Panelcreatemealitem1006 How can I access the object data, it's in a file thats under the folder /com/nutrition/file.mxml --- In flexcoders@yahoogroups.com, Sam Lai samuel.lai@ wrote: I'd add a trace statement just before it to see what type of object event.target is - it could be that the target is the UI component, and not the data object. //throws error on this line trace(event.target); customMeals.addItem((event.target as mealitem).mealDetails); 2009/7/2 Jason B nospam@: I've got an problem when the user clicks on button Add to Meal it throws an error because it can't seem to reference the data in mealDetails object inside the com/ directory? I'm trying to add the item to the list control. I have the code located here in case you want more details http://files.getdropbox.com/u/228472/mealsflex.zip [Bindable] private var customMeals:ArrayCollection = new ArrayCollection; //throws error on this line customMeals.addItem((event.target as mealitem).mealDetails); ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; width=310 height=320 title={mealDetails.title} horizontalAlign=center mx:Metadata [Event(name=addToMeal)] [Event(name=learnAboutThis)] /mx:Metadata mx:Script ![CDATA[ import mx.controls.Alert; [Bindable] public var mealDetails:Object; private function calldispatch():void { parentApplication.createmeals_loadswf_var = mealDetails.swf; dispatchEvent(new Event('learnAboutThis', true)); } ]] /mx:Script mx:Image source={'/uploads/nutrition/' + mealDetails.imgsource } width=285 height=159/ mx:Label text={mealDetails.serving}/ mx:Button label=Add to Meal click=dispatchEvent(new Event('addToMeal', true))/ mx:Button label=Learn About This click=calldispatch()/ /mx:Panel -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders]How to get the UITextField to remeasure
bump Here is an example. Create a new Application, paste this code in and then hit the button. As you can see it resizes the image but the text does not reflow. Been working on this all week. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute backgroundColor=#cc mx:Script ![CDATA[ import mx.core.UITextField; protected function button1_clickHandler(event:MouseEvent):void { var text1:UITextField = UITextField(text1.getChildAt(0)); var loader:Loader = text1.getImageReference(loader1) as Loader; loader.width = 200; } ]] /mx:Script mx:HDividedBox x=24 y=54 width=100% mx:Text id=text1 width=457 mx:htmlText ![CDATA[some text before swf img src=http://www.google.com/intl/en_ALL/images/logo.gif; id=loader1/ some text after swf some text after swf some text after swf some text after swf some text after swf some text after swf some text after swf some text after swf some text after swf some text after swfbr/ some text after swfbr/ some text after swfbr/ some text after swfbr/ some text after swfbr/]] /mx:htmlText /mx:Text mx:Text id=text2 width=100% mx:htmlText ![CDATA[another column of text]] /mx:htmlText /mx:Text /mx:HDividedBox mx:Button x=24 y=24 label=Button click=button1_clickHandler(event)/ /mx:Application On Thu, Jul 2, 2009 at 2:23 AM, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com wrote: I have an image in a UITextField that I grab a reference to and resize. When I resize it larger or smaller than it's initial size the text around it doesn't reflow. It stays in exactly the same space.
[flexcoders] Re: getting the xml data from a dispatched event
The zip file doesn't contain any code in the src folder. Kind of hard to see what's happening without it. -TH --- In flexcoders@yahoogroups.com, Jason B nos...@... wrote: any Idea? --- In flexcoders@yahoogroups.com, Jason B nospam@ wrote: yes heres the results Main0.vsMain.HBox8.VBox968.vsCreateMeals.VBox971.pnlCreateBreakfast.cov\ erflow.Panelcreatemealitem1006 How can I access the object data, it's in a file thats under the folder /com/nutrition/file.mxml --- In flexcoders@yahoogroups.com, Sam Lai samuel.lai@ wrote: I'd add a trace statement just before it to see what type of object event.target is - it could be that the target is the UI component, and not the data object. //throws error on this line trace(event.target); customMeals.addItem((event.target as mealitem).mealDetails); 2009/7/2 Jason B nospam@: I've got an problem when the user clicks on button Add to Meal it throws an error because it can't seem to reference the data in mealDetails object inside the com/ directory? I'm trying to add the item to the list control. I have the code located here in case you want more details http://files.getdropbox.com/u/228472/mealsflex.zip [Bindable] private var customMeals:ArrayCollection = new ArrayCollection; //throws error on this line customMeals.addItem((event.target as mealitem).mealDetails); ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; width=310 height=320 title={mealDetails.title} horizontalAlign=center mx:Metadata [Event(name=addToMeal)] [Event(name=learnAboutThis)] /mx:Metadata mx:Script ![CDATA[ import mx.controls.Alert; [Bindable] public var mealDetails:Object; private function calldispatch():void { parentApplication.createmeals_loadswf_var = mealDetails.swf; dispatchEvent(new Event('learnAboutThis', true)); } ]] /mx:Script mx:Image source={'/uploads/nutrition/' + mealDetails.imgsource } width=285 height=159/ mx:Label text={mealDetails.serving}/ mx:Button label=Add to Meal click=dispatchEvent(new Event('addToMeal', true))/ mx:Button label=Learn About This click=calldispatch()/ /mx:Panel -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\ 1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] List ScrollToIndex does not work for last item in List
How do you make scrollToIndex work on a List where the last item in the List is currently not visible? When I use List.scrollToIndex it works for any item above my current selection, but will never scroll to the end of the List.
Re: [flexcoders] Re: getting the xml data from a dispatched event
It seems like wherever this code is - [Bindable] private var customMeals:ArrayCollection = new ArrayCollection; //throws error on this line customMeals.addItem((event.target as mealitem).mealDetails); event.target is actually the panel containing the 'create meal item' button, as opposed to the mealitem itself. Can you post some more of the script and MXML for that part? The src folder is empty for me too in the ZIP file. 2009/7/2 Jason B nos...@advancedonsite.com: yes heres the results Main0.vsMain.HBox8.VBox968.vsCreateMeals.VBox971.pnlCreateBreakfast.coverflow.Panelcreatemealitem1006 How can I access the object data, it's in a file thats under the folder /com/nutrition/file.mxml --- In flexcoders@yahoogroups.com, Sam Lai samuel@... wrote: I'd add a trace statement just before it to see what type of object event.target is - it could be that the target is the UI component, and not the data object. //throws error on this line trace(event.target); customMeals.addItem((event.target as mealitem).mealDetails); 2009/7/2 Jason B nos...@...: I've got an problem when the user clicks on button Add to Meal it throws an error because it can't seem to reference the data in mealDetails object inside the com/ directory? I'm trying to add the item to the list control. I have the code located here in case you want more details http://files.getdropbox.com/u/228472/mealsflex.zip [Bindable] private var customMeals:ArrayCollection = new ArrayCollection; //throws error on this line customMeals.addItem((event.target as mealitem).mealDetails); ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; width=310 height=320 title={mealDetails.title} horizontalAlign=center mx:Metadata [Event(name=addToMeal)] [Event(name=learnAboutThis)] /mx:Metadata mx:Script ![CDATA[ import mx.controls.Alert; [Bindable] public var mealDetails:Object; private function calldispatch():void { parentApplication.createmeals_loadswf_var = mealDetails.swf; dispatchEvent(new Event('learnAboutThis', true)); } ]] /mx:Script mx:Image source={'/uploads/nutrition/' + mealDetails.imgsource } width=285 height=159/ mx:Label text={mealDetails.serving}/ mx:Button label=Add to Meal click=dispatchEvent(new Event('addToMeal', true))/ mx:Button label=Learn About This click=calldispatch()/ /mx:Panel -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
I just wrote up a simple C# web service that accepts an ArrayList: [WebMethod] public bool ArrayListTest(System.Collections.ArrayList a) { ... } Then in Flex I wrote this, mx:Script ![CDATA[ import mx.collections.ArrayCollection; private function sendWebServiceCall():void { trace(appComplete); ws.ArrayListTest(new ArrayCollection([ {name:bob, id:808 }, { name:fred, id: }])); } ]] /mx:Script mx:WebService wsdl=http://localhost:63868/Service1.asmx?WSDL; id=ws mx:operation name=ArrayListTest result=trace(event.result) fault=trace(event.fault.faultString)/ /mx:WebService When sendWebServiceCall is triggered, it calls the C# web service and passes the ArrayCollection to it. In the web service, the ArrayCollection is received as an array list of XmlNodes. Each XmlNode contains a node for each field, even if it is an empty string. tns:id xmlns:tns=http://tempuri.org/;808/tns:id tns:name xmlns:tns=http://tempuri.org/;bob/tns:name tns:id xmlns:tns=http://tempuri.org/;/tns:id tns:name xmlns:tns=http://tempuri.org/;fred/tns:name Is this anything like what you're getting? The edge case you described in another email about an empty string causing problems doesn't seem to cause problems. Also see inline. 2009/7/3 Angelo Anolin angelo_ano...@yahoo.com: I think by doing things like this, it may not be the best way. You mentioned you'd map the XML to typed objects in .NET. How can I do this? As you're using a dataset, this isn't really an option. A dataset as opposed to a collection of typed objects are two ways of handling data from data sources; it is arguable which way is better. The problem in your case, is that the XML generated as a result of passing an ArrayCollection to a web service method cannot be passed into the dataset's readXml method. (Even if it could by inferring a schema, it would be different to your database's schema.) The only way I know of to do seamless transfer of data without having to parse XML is to use WebORB. Otherwise you will have to parse the XML produced on both sides to re-create the dataset/object. Instead of using arraycollection as dataprovider in my datagrid, can I use another which would be much easier when I pass back to the .NET function? I wonder if it is possible to bind your datagrid directly to the e4x XML? That way you can pass the entire XML doc back to .NET via the web service, and hence you can re-create the dataset using dataset.readXML. From: Sam Lai samuel@gmail.com To: flexcoders@yahoogroups.com Sent: Friday, 3 July, 2009 13:52:12 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService Instead of using an array list and trying to emulate the type-less abilities of AS3, I'd try to map the XML to typed objects in .NET. Or does the XML from your Flex app differ too wildly to do this? Are you using the XmlSerializer to deserialize this? Or are you using WCF? Or are you doing it some other way, or manually? I'd provide an example, but I don't know enough details on your situation to give something useful :) 2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com: Hi Sam, Care to show some examples? I am parsing the arrayCollection into an ArrayList on .NET. This is particularly not too appealing since I just discovered that for example, if one of the objects in the arraycollection would have an empty string value, the number of items inside the array is not reflected properly in .NET. Like: private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 , Value:Select }, {ID:002, Value:Choose }, {ID:003, Value:},]) ; When I pass this var arrR into a .NET webservice and delegate it to an ArrayList, the items in the array list will have one of the arrays only containing 1 item (instead of 2). Adding to my problem is the fact that the arrays inside the array list when read in .NET should have the object ID and Value be in order but they are not. This is further true when there are many items in the array collection. Sometimes, the first item becomes the last one in the array list, and sometimes the order is not well. In any case, I am finding a solution on how I would be able to pass an ArrayCollection to .NET and be able to parse it properly. Thanks. _ _ __ From: Sam Lai samuel@gmail. com To: flexcod...@yahoogro ups.com Sent: Thursday, 2 July, 2009 15:46:58 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService How is it being parsed in .NET? You can parse it into a hashtable, or better yet, use a pre-defined object. Not sure why the order is