[flexcoders] flex 4.0 component focus issue
trying to use tab key to tab through some inputfields in a form but none of my components get focus. anyone have any experience with focus issues using the flex 4.0 sdk? heres a sample of my code: mx:Form width=340 mx:FormItem label=Username width=100% s:TextInput tabEnabled=true tabIndex=0/ /mx:FormItem mx:FormItem label=Password width=100% s:TextInput tabEnabled=true tabIndex=1 / /mx:FormItem /mx:Form s:Button label=Login tabEnabled=true tabIndex=2 / I am trying to tab through username to password to the login button. But when I hit tab the focus goes either to the location bar or possibly to the app itself (seems like there is a light gray focus rect around the entire app at some times). Also tried this without the form or formitems, just two textInputs and a button without any luck. Has anything changed with the focus manager or enabling tabbing through components that I might be missing?
[flexcoders] keeping aspect ratios of containers
is there an easy way to keep a container at a specific aspect ratio? i have an hDividedBox but i want the vbox on the left side to always be twice as high as it is wide. how can i keep a container at this aspect ratio while having the child on the right in the hDividedBox fill the rest of the space?
[flexcoders] using webcam to broadcast through a video object, how to stop broadcasting?
I have a video object that I am attaching a webcam to. Video works, camera broadcasts fine. Problem is, when I close the window with the video in it, I want to be able to shut the camera off. Right now the light on the camera is still on to indicate it is still broadcasting. Documentation says to pass a null object to video.attachCamera(null) to drop the connection to the camera. I am doing the following: _videoCamera.attachCamera(null); _videoCamera.attachNetStream(null); _videoCamera.clear(); _videoCamera = null; Yet my video camera still looks like it's on and broadcasting. Is there any other way to shut the camera itself off?
[flexcoders] Re: using webcam to broadcast through a video object, how to stop broadcasting?
Nevermind, attachCamera(null) works just fine. Had another instance of the video object lingering so camera was still in use! --- In flexcoders@yahoogroups.com, blc187 blc...@... wrote: I have a video object that I am attaching a webcam to. Video works, camera broadcasts fine. Problem is, when I close the window with the video in it, I want to be able to shut the camera off. Right now the light on the camera is still on to indicate it is still broadcasting. Documentation says to pass a null object to video.attachCamera(null) to drop the connection to the camera. I am doing the following: _videoCamera.attachCamera(null); _videoCamera.attachNetStream(null); _videoCamera.clear(); _videoCamera = null; Yet my video camera still looks like it's on and broadcasting. Is there any other way to shut the camera itself off?
[flexcoders] can you truncate a multiline TextArea?
does anyone know of an existing component that can truncate multiline text? I'm looking to either use an already made one, or create my own multiline TextArea and be able to truncate when the textHeight reaches more than the set height of the component. So far I haven't been able to get a correct height for it, I keep getting a much larger height than it actually is because the textHeight reflects the size of the htmlText, even though I'm only setting text, not htmlText on it. Is there a way to get a more accurate textHeight?
[flexcoders] how can i get a columnIndex from an item in my TileList?
I have a TileList that displays images. I'd like to be able to mouseover one of the images and get the index of the column it's in. Is there any way to get a row or column index on MouseOver? For context, I am displaying a custom tooltip on mouseover and I'd like to be able to tell if I'm mousing over the last image in the row so that I can prevent my tooltip from displaying offscreen.
[flexcoders] Re: how can i get a columnIndex from an item in my TileList?
Thanks Alex, that's what I ended up doing. I was hoping there was a quick columnIndex just to see if it was the last in the row without having to calculate positions. --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Then you don't want the index, you just want to know position. Using localToGlobal and globalToLocal will help you compute where the renderer is relative to the TileLIst. You may also need to factor in viewmetrics. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of blc187 Sent: Wednesday, December 03, 2008 10:21 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] how can i get a columnIndex from an item in my TileList? I have a TileList that displays images. I'd like to be able to mouseover one of the images and get the index of the column it's in. Is there any way to get a row or column index on MouseOver? For context, I am displaying a custom tooltip on mouseover and I'd like to be able to tell if I'm mousing over the last image in the row so that I can prevent my tooltip from displaying offscreen.
[flexcoders] Re: AdvancedDataGrid grouping name gets cut off if the first column is thin
Yes, I do mean spanning multiple columns. And I am using column renderers and renderer providers. But I'd like to be able to span multiple columns in the row that is the group folder, not just the individual item rows. --- In flexcoders@yahoogroups.com, valdhor [EMAIL PROTECTED] wrote: Do you mean column spanning? If so, according to the docs at http://livedocs.adobe.com/flex/3/html/help.html? content=advdatagrid_10.html you can Span multiple columns with a renderer --- In flexcoders@yahoogroups.com, blc187 blc187@ wrote: Does anyone have any experience using AdvancedDataGrids? I would like the row that displays the folder and the grouping name to span the entire datagrid. For example, I have a data set that creates 3 groups titled Group 1, Group 2, Group 3. Each of these nodes has items underneath of it. I've noticed that the columns apply to the row with the folder and the group name, not just the items below each, so that if my group's name is long it gets ellipsed (...) if the first column is short. Is there any way I can extend this across the entire row. Does that make sense? I realize it's a bit of a tricky situation to explain...
[flexcoders] AdvancedDataGrid grouping name gets cut off if the first column is thin
Does anyone have any experience using AdvancedDataGrids? I would like the row that displays the folder and the grouping name to span the entire datagrid. For example, I have a data set that creates 3 groups titled Group 1, Group 2, Group 3. Each of these nodes has items underneath of it. I've noticed that the columns apply to the row with the folder and the group name, not just the items below each, so that if my group's name is long it gets ellipsed (...) if the first column is short. Is there any way I can extend this across the entire row. Does that make sense? I realize it's a bit of a tricky situation to explain...
[flexcoders] Re: word highlighting
Does anybody know how to apply a similar style of text highlighting to a Text component? This example uses TextField and I'd like to be able to do a similar highlight effect without rewriting the Highlighter component from FlexLib. Initially tried setting the highlight in the htmlText but it apparently isn't supported. Help please! --- In flexcoders@yahoogroups.com, ibo [EMAIL PROTECTED] wrote: Have anyone worked on something like this before? What I want is to highlight the word by changing the background color of each keyword from a sentence/paragraph. Here is my code so far: private function applyTextHighlight(textField:UIComponent, listOfWordPositions:Array):void { var textArea:TextArea = TextArea(textField); var tr:TextRange = new TextRange(textArea); tr.htmlText = textArea[htmlText]; for (var i:int=0; ilistOfWordPositions.length; i++) { var metaWord:WordPositions = listOfWordPositions[i]; tr.beginIndex = metaWord.startIndex; tr.endIndex = metaWord.endIndex; tr.htmlText = formattedText(tr.text, metaWord.color); //tr[color] = metaWord.color; //tr[fontWeight] = bold; //tr[fontSize] = 12; } } private function formattedText(text:String, color:uint):String { return FONT style='BACKGROUND-COLOR: + color + ' + text + /FONT; } TextRange seems to be very limited on how much you can format your html text so I'm not surprised it doesnt really fully support HTML. Any workaround to get a similar behavior? Changing the text color, size and weight works though (see commented out lines). -Stephen
[flexcoders] how to retrieve sorted subset of an arraycollection?
Hi, I have an arraycollection of about a dozen or so items. I am applying a sort to that collection and I usually end up with about 3-4 items after the sort is applied. Is there a way I can grab just the sorted subset of those 3-4 items from that arraycollection? If I clone the array or grab the source it includes the entire collection instead of just the subset.
[flexcoders] Re: how to retrieve sorted subset of an arraycollection?
What I meant to say is that I am applying a filter, not a sort to the arraycollection. Applying the filter results in a subset of the items being shown. There is an internal property called localIndex that holds just the filtered items, but I am not sure if there is any way to access or manipulate this? --- In flexcoders@yahoogroups.com, blc187 [EMAIL PROTECTED] wrote: Hi, I have an arraycollection of about a dozen or so items. I am applying a sort to that collection and I usually end up with about 3-4 items after the sort is applied. Is there a way I can grab just the sorted subset of those 3-4 items from that arraycollection? If I clone the array or grab the source it includes the entire collection instead of just the subset.
[flexcoders] tabindex set but components not tabbing in order
I have a vbox that consists of 5 formItems, 1 checkbox, and 2 buttons, in that order. I have the tabIndex of the page set up so that the formItems have a tabindex of 1-5, the checkbox is 6, and the buttons are 7-8. However, when I tab through them I get all 5 formItems, then 1 button, then the checkbox, then the other button. The only thing I can think is that maybe its because the one button that gets out of place is not enabled at the time I set the tabIndex, would it still be in order? In other words, when I set the button to enabled after the tabIndexes are set, is there any way it could be getting stuck into the middle of the tab order instead of staying in spot #8 like it was originally assigned?
[flexcoders] key listeners in air windows
Does anyone know if its possible to add a key down listener for an entire air app? As it stands now I have several air windows open, I'm adding the listener to the stage but its window specific. I'd like to be able to recognize whether a key is pressed anywhere in the app, instead of only one window recognizing it. Otherwise is there any way to check, say when a mouse click event triggers if a key is currently down?
[flexcoders] Re: key listeners in air windows
I'm not sure that solves the problem, we may be talking about two different issues... So when you call registerGlobalKeyHandler(), where do you do it and what are you listening to that it registers a key was pressed in different windows? Because when I add the listener to stage, only the window that the key was pressed in responds to the listener, it is the stage for that specific window, not the entire app. --- In flexcoders@yahoogroups.com, Andrew Wetmore [EMAIL PROTECTED] wrote: the way I deal with this is to use a switch statement on the currentState: in init() I call registerGlobalKeyHandler() which is private function registerGlobalKeyHandler(): void{ stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); } and has this event handler: private function keyHandler(event:KeyboardEvent):void{ //handle the Enter key if (event.keyCode == 13){ switch (currentState){ case 'login': if ( loginButton.enabled == true ){ tryLogin(); } break; case 'register': if (registerButton.enabled == true){ tryRegister(); } break; ... } } } This gives me a lot of control over what function responds in each part of the application, and lets me govern a variety of keys in different ways depending on what page we're on. You could dispense with the switch statement and have the key click work the same everywhere. -- Andrew Wetmore User Experience Director Open Learning Exchange - www.ole.org 978-319-7324
[flexcoders] Re: Mouse Wheel over TextArea
I have this same problem with the mouse_wheel event getting caught by something on top of my canvas that I want to scroll. Except instead of a TextArea, it's an HBox. And HBox has no mouseWheelHandler to override. How can I stop the HBox from keeping the event to itself? --- In flexcoders@yahoogroups.com, toofah_gm [EMAIL PROTECTED] wrote: I have a Canvas with a number of TextArea components, Images, Sprites, etc, on top of it. The Canvas itself is a scrollable area. When I use the Mouse Wheel over most parts of the Canvas, it scrolls up and down. If my mouse is on top of one of my TextAreas, the Canvas does not scroll when I use the Mouse Wheel. This is the case even though my TextAreas are not editable nor selectable. Is there a way to get my Mouse Wheel to scroll my Canvas even when it is over my TextArea components?
[flexcoders] how to search an arraycollection
I have an arraycollection of objects, each of which has a timestamp. ex: {timestamp:4342423432, value:5} I want to search the arraycollection for the object which has the closest timestamp to the time I'm looking for. Is there a way to search the arraycollection for an approximate value? As of right now I'm looping through each object in my arraycollection to find if the value is between 2 numbers. for(var i:int = 0; i dataProvider.length; i++) { if(myTimestamp dataProvider[i] myTimestamp dataProvider[i+1]) //this is the correct spot. }
[flexcoders] Re: how to search an arraycollection
can i use a binary search if the value i am searching for is not explicitly in my arraycollection? i want to get the closest value to the timestamp i am searching for. --- In flexcoders@yahoogroups.com, Michael VanDaniker [EMAIL PROTECTED] wrote: If your collection is sorted by timestamp a binary search would be faster. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: You'll have to loop through yourself and keep track of the minimum difference From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of blc187 Sent: Wednesday, August 13, 2008 12:57 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] how to search an arraycollection I have an arraycollection of objects, each of which has a timestamp. ex: {timestamp:4342423432, value:5} I want to search the arraycollection for the object which has the closest timestamp to the time I'm looking for. Is there a way to search the arraycollection for an approximate value? As of right now I'm looping through each object in my arraycollection to find if the value is between 2 numbers. for(var i:int = 0; i dataProvider.length; i++) { if(myTimestamp dataProvider[i] myTimestamp dataProvider [i+1]) //this is the correct spot. }
[flexcoders] removing default 1/1/70 label on DateTimeAxis
A DateTimeAxis on a chart with no data shows 1 label: 1/1/70. Is there a way to either make the whole axis invisible, or not show any date labels at all? I want to do this before I populate the chart, then when the data comes in, turn the visibility back on so that the 1/1/70 never shows.
[flexcoders] Re: removing default 1/1/70 label on DateTimeAxis
figured this out... in the DateTimeAxis there is a method called buildLabelCache. creating a class that extends DateTimeAxis and overriding buildLabelCache like this: override protected function buildLabelCache():Boolean { var returnVal:Boolean = super.buildLabelCache(); if(labelCache.length == 1 labelCache[0].text == 1/1/70) labelCache.pop(); return returnVal; } If there is only one label and it is the default label (from a Date object with time=0), removing it from the labelCache so it never gets created. --- In flexcoders@yahoogroups.com, blc187 [EMAIL PROTECTED] wrote: A DateTimeAxis on a chart with no data shows 1 label: 1/1/70. Is there a way to either make the whole axis invisible, or not show any date labels at all? I want to do this before I populate the chart, then when the data comes in, turn the visibility back on so that the 1/1/70 never shows.
[flexcoders] error: DisplayObject must be a child of the caller
I have a chart on stage that is attached to a VBox with a few other components underneath. I want to remove the VBox but keep the chart. So I'm doing: var myChart:LineChart = vbox.removeChild(lineChart) as LineChart; this.addChild(myChart); this.removeChild(vbox); mx:VBox id=vbox mx:LineChart id=lineChart / mx:HBox . other components . /mx:HBox /mx:VBox However, I get the following error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() I know that removeChild() it is complaining about is vbox.removeChild (lineChart), because I commented out this.removeChild(vbox) and still get the error. I also know that the removeChild call works fine because I see the LineChart in the var myChart when I put a breakpoint on it. Any thoughts on why it might be complaining?
[flexcoders] annotations are set to chart dimensions instead of specific width, why?
When creating an annotation on a chart, I noticed that no matter what I specifically set the width and height to, the annotation is always the entire size of the chart. For example, I am creating an annotation that extends Canvas, setting width = 15, height = 20. When I trace out the width and height, they are the dimensions of my entire chart, 707 x 500. Adding an outline to the annotation that its size matches exactly the size of the chart. This is affecting the hit area of a sprite I put underneath the annotations because the Sprite now no longer gets roll_over events because the annotation's area covers the whole graph. Any ideas on why the annotations are the size of the entire chart, or how to get around this issue? Setting mouse_enabled = false on the annotations is not a viable options, as I need to be able to click on them.
[flexcoders] adding mouse events to annotation items in a chart
Using annotations in a chart, creating a few labels and assigning them to the annotation property of my line chart. var annotations:Array = new Array(); var lbl:Label = new Label(); lbl.text = annotation; annotations.push(lbl); myChart.annotationElements = annotations; If I try to listen to mouse events on these annotations, they never come through, maybe the chart is swallowing them? I'd like to be able to add a CLICK listener to tell when I am clicking on the annotation label. Any thoughts on how to do this?
[flexcoders] Re: adding mouse events to annotation items in a chart
The question is not how to add a listener, that was obviously the first thing I tried. The problem is that the chart itself gets click events, not the annotations. So when I add the listener you suggest to the annotation itself, it never fires. So, either listen to the CLICK event on the chart and decifer if it is clicking on something specific within the chart, or find another way to listen on an annotation item. --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Just add an event listener to the label; before you push it to the array: var annotations:Array = new Array(); var lbl:Label = new Label(); lbl.text = annotation; lbl.addEventListener(MouseEvent.CLICK,onAnnotationClick); annotations.push(lbl); myChart.annotationElements = annotations; private function onAnnotationClick(event:MouseEvent) : void { Alert.show(I got clicked); } -TH --- In flexcoders@yahoogroups.com, blc187 blc187@ wrote: Using annotations in a chart, creating a few labels and assigning them to the annotation property of my line chart. var annotations:Array = new Array(); var lbl:Label = new Label(); lbl.text = annotation; annotations.push(lbl); myChart.annotationElements = annotations; If I try to listen to mouse events on these annotations, they never come through, maybe the chart is swallowing them? I'd like to be able to add a CLICK listener to tell when I am clicking on the annotation label. Any thoughts on how to do this?
[flexcoders] how to get the y position of item in list
Is there a way to get the y position of a row in a list or datagrid? I noticed that list has a protected var rowInfo that holds an array of ListRowInfo objects with x and y properties. From the list class I could do rowInfo[rowNumber].y but am trying to get the y value from outside the list though... Also, rowInfo only holds info for the visible rows. For example, I have a list with 65 items, 20 of which are shown before the scrollbar shows up. I want to get rowInfo[5], fine. I want to get rowInfo[25] it throws an error. So I need to scrollToIndex(25) but then I don't know which entry in rowInfo corresponds to my selected item.
[flexcoders] Re: how to get the y position of item in list
In order to get that I would have to click on the item. I'm not clicking, I just need to scroll then grab the position of the item. Thanks for the try, but this is not a viable solution. --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Here's one way. If you're scrolling to the index and setting the currentItem, you an use this code with the change event: private function onItemClick(event:ListEvent):void { var pt:Point = new Point(event.itemRenderer.x, event.itemRenderer.y); pt = event.currentTarget.localToGlobal(pt); Alert.show(pt.y.toString()); } mx:List itemClick=onItemClick(event) -TH --- In flexcoders@yahoogroups.com, blc187 blc187@ wrote: Is there a way to get the y position of a row in a list or datagrid? I noticed that list has a protected var rowInfo that holds an array of ListRowInfo objects with x and y properties. From the list class I could do rowInfo[rowNumber].y but am trying to get the y value from outside the list though... Also, rowInfo only holds info for the visible rows. For example, I have a list with 65 items, 20 of which are shown before the scrollbar shows up. I want to get rowInfo[5], fine. I want to get rowInfo[25] it throws an error. So I need to scrollToIndex(25) but then I don't know which entry in rowInfo corresponds to my selected item.
[flexcoders] annotations on flex charts?
I am using chart annotations like the following example: var annotationElement:MyAnnotationElement = new MyAnnotationElement(); myChart.annotationElements = [annotationElement]; The problem is, I need the annotations to start a few pixels above my chart's dataRegion. Does anybody know how to modify this? I tried moving the _annotationElementHolder.y up a few pixels but then it doesn't cover all the way down to the axis, and changing the height value does nothing. Any suggestions?
[flexcoders] attaching one instance of a displayobject to multiple containers
Is there a way to attach a displayobject to more than one container? I have a canvas that I instantiated and drew onto, but I want to attach it onto two separate containers without having 2 separate instances of it. When I do this: var obj:MyCanvas = new MyCanvas(); container1.addChild(obj); container2.addChild(obj); it only shows up as attached to the second container. How can I attach it to two without having to instantiate two versions of it?
[flexcoders] dateTimeAxis labels missing from entire project?
Is it possible to have some type of global setting that removes label from the charting axes? I've got a basic LineChart with a DateTimeAxis that is missing labels. But when I copy the class to a new project and display the chart by itself, the labels are there and display fine. I would like the labels to show, and I am not manipulating this class at all from anywhere else so I can't figure out how the labels might be getting shut off. This is my class: mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=onInit() width=100% height=100% mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var dataProvider:ArrayCollection; //this is just to populate the data with a diagonal line public function onInit():void { dataProvider = new ArrayCollection(); var i:int = 10; var date:Date; while(i 0) { date = new Date(2008, 8, 30-i, 10,11, 12); dataProvider.addItem({date:date, yField:i}); i--; } } ]] /mx:Script mx:LineChart id=lineChart width=100% showDataTips=true dataProvider={dataProvider} height=100% mx:horizontalAxis mx:DateTimeAxis id=dateTimeAxis labelUnits=days dataUnits=days / /mx:horizontalAxis mx:verticalAxis mx:LinearAxis id=yAxis/ /mx:verticalAxis mx:series mx:LineSeries horizontalAxis={dateTimeAxis} yField=yField xField=date / /mx:series /mx:LineChart /mx:Canvas
[flexcoders] text style prop not applied to checkboxes?
does the textRollOverColor style get applied for the text on checkboxes? I'm styling my checkbox and I can get the label text to change color with checkbox.setStyle(color, 0xff00ff) but not with checkbox.setStyle(textRollOverColor, 0x00ff00) Anyone using it successfully anywhere else?
[flexcoders] Re: replacing items in an arraycollection?
that would be great to take a look at. thanks! --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote: Got something that does this, it's almost done. I'll post it online somewhere soon and post a link on the list. It's a helper class rather than an extension of ArrayCollection though, coz that's more useful to me. -J On Thu, Jun 5, 2008 at 3:00 AM, Tracy Spratt [EMAIL PROTECTED] wrote: Depending on how you will use this, you might consider extending ArrayCollection and adding getItemByKey support. I have not done this, but would probably try maintaining an associative array in the extended AC. Come to think of it one of our component gurus might already have done such a thing, or know why not to try! Do a search. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Tim Hoff *Sent:* Tuesday, June 03, 2008 9:42 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Re: replacing items in an arraycollection? If you're rolling your own, that's the way. -TH --- In flexcoders@yahoogroups.com flexcoders% 40yahoogroups.com, blc187 blc187@ wrote: I have an ArrayCollection of objects that I am receiving updates on. On update, I get the updated item as an argument and I need to replace the old item in the list. Right now I am cycling through the ArrayCollection until i find the id of the item and returning the index, then replacing the item at that index. Any thoughts on a better way to do this? public var itemCollection:ArrayCollection; public function onUpdateReceived(newItem:Object):void { findIndex(newItem); if(index -1) itemCollection.setItemAt(newItem, index); } public function findIndex(newItem:Object):Number { for each(var itemInCollection:Object in itemCollection){ if(itemInCollection.id == newItem.id) return itemCollection.getItemIndex(itemInCollection); } return -1; } -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
[flexcoders] programmatically using RemoteObject
I'm trying to move some code out of my MXML into AS classes but having trouble with the RemoteObject. The following code: mx:RemoteObject id=remoteObject destination=genericDestination mx:method name=myMethod result=gotServerData(event)/ /mx:RemoteObject How do I go about setting up the remoteObject method programmatically?
[flexcoders] replacing items in an arraycollection?
I have an ArrayCollection of objects that I am receiving updates on. On update, I get the updated item as an argument and I need to replace the old item in the list. Right now I am cycling through the ArrayCollection until i find the id of the item and returning the index, then replacing the item at that index. Any thoughts on a better way to do this? public var itemCollection:ArrayCollection; public function onUpdateReceived(newItem:Object):void { findIndex(newItem); if(index -1) itemCollection.setItemAt(newItem, index); } public function findIndex(newItem:Object):Number { for each(var itemInCollection:Object in itemCollection){ if(itemInCollection.id == newItem.id) return itemCollection.getItemIndex(itemInCollection); } return -1; }
[flexcoders] Re: Can't figure out how to parse RSS
This is a good blog post that might help about a component that takes in an XML file and generates an object out of it. Not sure if it fits specifically the type you're parsing but it lets you define a value object that the XML will get populated into. http://9mmedia.com/blog/?p=15 --- In flexcoders@yahoogroups.com, dfalling [EMAIL PROTECTED] wrote: I'm trying to write a small app that will parse an inputted RSS feed. On some feeds (reddit.com) it works fine, but on others (slashdot.org) the xml seems to be cut off... the description and title for the feed are there, but none of the items. What is causing this? I've wandered tried to adapt code from dozens of different examples and still can't understand exactly what I need. Here's the minimal code that I'm using now, without all the hacks and attempts I've tried: import mx.collections.XMLListCollection; import mx.utils.ArrayUtil; import mx.rpc.http.HTTPService; import mx.rpc.events.ResultEvent; import mx.collections.ArrayCollection; import mx.events.FlexEvent; [Bindable] private var _dataProvider:XMLListCollection = new XMLListCollection(); private var _httpService:HTTPService; private function urlSubmitted():void { var feedUrl:String = urlText.text; _httpService = new HTTPService(); _httpService.url = feedUrl; _httpService.resultFormat = e4x; _httpService.addEventListener (ResultEvent.RESULT,dataReceived,false,0,tr\ ue); _httpService.send(); } private function dataReceived(event:ResultEvent):void { _dataProvider.source = event.result.channel.item as XMLList; noDataView.visible = false; dataGrid.visible = true; }
[flexcoders] creating multiple series in a chart programatically?
Does anybody have any good links to examples of programatically creating multiple series in a chart? I have a chart that I'd like to populate with a new series everytime a checkbox is checked, so it is possible to have up to maybe half a dozen different series on the chart at the same time. I'm having some difficulty to get them to overlay each other though... var cs:AreaSeries = new AreaSeries(); cs.id = brokerId; cs.yField = 'value'; this.chart.series.push(cs); The chart itself holds the dataProvider, not the series. This works with the first series, but not more than one. Any suggestions?
[flexcoders] can you translate keyCode or charCode from number into letter?
Is it possible to capture a keyboard event and tell which letter key was pressed? The KeyboardEvent has a charCode and keyCode but these are numbers, is there a way to associate them with the specific letter they represent? For example, I want to trace out which letter was pressed on key_down however I can only trace the numerical equivalent. If I press a Q, the keyCode prints 81 when I would like to see Q.
[flexcoders] got any good air styling references?
anybody know any good sites about skinning air apps, specifically ways to skin air windows? or have any good tips?
[flexcoders] Re: got any good air styling references?
thanks, but i was looking more for resources on css styling of the windows. i have an air app that uses WindowedApplication, but it is also spawning other windows using new Window(). i wanted to be able to use css styling on those Windows, but it seems as though the default close, minimize, restore buttons are difficult to assign styles to. was just wondering if anyone had any good inspiration or resources for how to go about this? --- In flexcoders@yahoogroups.com, Kyle Neath [EMAIL PROTECTED] wrote: The best method I've found is to just remove all native controls (by uncommenting a directive in the air xml file, and adding showChrome=false to your WindowedApplication). From there, it's pretty trivial to mimic native functions. Here's the ones used for beta 3 (they changed it, so googling around gets confusing): this.nativeWindow.minimize(); // minimizes the window this.nativeWindow.close(); // closes the window this.nativeWindow.startResize(); // call this within a MouseDown event on your resizing handle this.nativeWindow.startMove(); // call this within a MouseDown event on your moving handle (title bar) All assuming this is the current window. - Kyle
[flexcoders] DragEvent in Air app causes values of mouseX and mouseY to remain constant?
On screen I have a VBox with a series of images inside of it. I am listening for a MouseDown event on each image and dragging it around inside the VBox. I am also listening in the VBox for a DragEvent.DRAG_OVER to detect where in the VBox the dragged image is. My problem is this: I receive the DragEvent fine whenever the mouse is dragging the image over the VBox. However, the value of the mouse position remains constant to where the image was originally dragged from. Ex: I start dragging one image when it its mouse position is at (20, 100). As the drag event fires, the mouseX and mouseY remain at 20 and 100 respectively, no matter where I try to get them from. Application.application.mouseY, this.mouseY, parent.mouseY, stage.mouseY all remain constant for the entire time the mouse button is held down. This is not the case in Flex web apps, seems to only occur in an Air app. Has anyone seen this before? Or have any suggestions on how to get around it?
[flexcoders] is it possible to create shortcuts in flexbuilder workbench?
Does anybody know if its possible to add a shortcut to the flexbuilder workbench? I'm trying to add a new option in the New menu to go along with New- Actionscript Class, New-MXML Component, etc. I'd really like to create a template for a specific file that I use often and would like to be able to click New-Custom File. I've seen that menu is customizable but only so far as to show or hide the built-in options. Anyone know if it's possible to add to this list?
[flexcoders] dynamically creating a class from a className string
im trying to dynamically create a new instance of a class from a string holding the class name in the following way: var cls:String = ((isMock == true) ? MockImplementation : RealImplementation); var clsToCreate:Object = ApplicationDomain.currentDomain.getDefinition (cls); serviceLocator = new clsToCreate(); to be sure the class is in the project and can be created, ive included the following lines to compile the 2 classes into the project (as discussed in this article: http://life.neophi.com/danielr/2006/07/flex_2_runtime_error_1065.html) private static const only2:MockImplementation = null; private static const only3:RealImplementation = null; however, i still run into the runtime error that says Error #1065: Variable MockImplementation is not defined. any thoughts on why it would still be undefined if the class is definitely compiled into the project?
[flexcoders] having trouble adding components to view using puremvc
Anyone out there using PureMVC? I'm sending a notification when an item is chosen from a list. What i want to happen is to attach a new component to the stage. So I have my list throwing an event on select, the mediator receives it and kicks out a notification. This is where I get tripped up, if I have a command that gets executed when this notification is sent, it can create the new component but how do I attach this new component to the stage? It seems as though I have no reference anywhere, including in the facade, to the application mxml.
[flexcoders] contents of a swf?
Is there a tool you can use to determine everything that is being compiled into a swf? I have a fairly large project and am wondering if there is anything out there that can help me determine if I am including older unused files or graphics, that way I can delete them to reduce my total swf size.
[flexcoders] error on NetStream streaming from FMS
i have a netstream object that is streaming video from FMS and throwing an odd error. I have the following 2 lines: _netStream = new NetStream(_netConnection); _netStream.play(_streamName, -2, -1, true); it kicks out the following error: Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback @setDataFrame. error=ReferenceError: Error #1069: Property @setDataFrame not found on VideoEditor and there is no default value. it is happening on _netStream.play() and in response to this error i added the following setter in VideoEditor: public function set setDataFrame(info:*):void{} but still get the same error. was getting 2 other errors of the same sort asking for @onMetaData and @onPlayStatus which were resolved by adding 2 setters for those. what else is the netstream expecting if not a setter for setDataFrame? any thoughts?
[flexcoders] glow effect on component with border shifts insides of component
I have a component that I am using a glow effect for mouseover. The component is an hbox with some labels and 2 images inside it, and a solid border around it. However, when the mouseover triggers and the glow effect plays, the labels inside shift down a pixel or two. When the border is removed, everything stays where it should on mouseover. Anyone have any ideas why the shift? Below is the mxml for the component (border of HBox mainBox is what can be removed to stop the shift) mx:HBox id=mainBox styleName=showCard borderStyle=solid borderColor={borderColor} left=0 right=0 top=0 bottom=0 clipContent=false paddingTop=3 paddingLeft=3 paddingRight=3 paddingBottom=3 verticalCenter=0 horizontalCenter=0 horizontalScrollPolicy=off verticalScrollPolicy=off verticalGap=0 mx:Canvas width=78 height=60 mx:Image id=bandImage / /mx:Canvas mx:Canvas id=contentCanvas mx:Label y=-3 letterSpacing=-1/ mx:Label y=17/ mx:Label y=31/ mx:Label y=45/ mx:HBox right=0 top=18 mx:Label id=liveText / mx:Image id=liveImage/ /mx:HBox /mx:Canvas /mx:HBox
[flexcoders] textfield vertical spacing
Is there a way to adjust the vertical spacing between lines in a textfield? I am using a multiline UITextField and would like to adjust the gap between lines, though can only find letterSpacing which adjusts the spacing between characters... any help?
[flexcoders] thoughts on loading graphics into my sprite
I've been trying to attach some things to a sprite with no luck. I was originally drawing into the graphics of it but decided I needed to load a graphic instead. So I tried var img:Image = new Image(); img.source = ... sprite.addChild(img); but I get nothing. the only positive results I've gotten so far are to use a loader and call my image through a URLRequest. var image:Sprite = new Sprite(); var pictLdr:Loader = new Loader(); var pictURLReq:URLRequest = new URLRequest (bgName); pictLdr.load(pictURLReq); image.addChild(pictLdr); Is there another way to do this? What exactly is sprite so picky about that I can't attach any UI components to it?
[flexcoders] Re: thoughts on loading graphics into my sprite
sorry, skimped on pasting the actual code. the height and width are set, just didnt include it in the example var img:Image = new Image(); img.source = recordings.jpg; img.height = 144; img.width = 142; img.maintainAspectRatio = false; sprite.addChild(img); still no image :(
[flexcoders] Re: thoughts on loading graphics into my sprite
yes sprite is really a sprite. its coming from the datagrid highlightIndicator, I am trying to load a graphic into the highlight instead of using the default blue box. so I am overriding drawHighlightIndicator override protected function drawHighlightIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void then trying to load an image into the indicator.
[flexcoders] anyone interested in some skinning?
does anyone have any experience skinning a header renderer? I'm implementing a custom header renderer but having trouble changing the background of it. I found you can set the 2 gradient colors from the data grid but can it be set to skins? at the moment it isn't responding to upSkin, overSkin, downSkin from my css and I'd like to get graphics in there instead of a gradient.
[flexcoders] can you trigger button states?
i have a button that i want to trigger the over and down states for without actually mousing over or clicking on it. so for example, i have another component that i mouseover and i want that and a separate button on the opposite side of the screen to react as if both had been moused over. so the button will listen for the other piece to send a mouseover event, but how does it actually set itself to a hover state?
[flexcoders] Re: datagrid cell renderers
thanks for the suggestion manish do you have an example of this working? from what i can figure, it looks as though the sprite is just a template for the row to fill a shape the same shape as whatever the sprite is. it looks like the same one gets reused for each row and just shifted down, as when i attach anything to it, they just get shifted down as the grid draws more rows and everything is attached to the same sprite.
[flexcoders] datagrid cell renderers
i am creating a custom datagrid that uses itemrenderers on DataGridColumn to make custom cells. var col1:BasicDataGridColumn = new DataGridColumn() ; col1.itemRenderer = itemRenderer; ... this.columns = new Array(col1, col2, col3) ; using the itemrenderers this way, is there any way to access one entire row of cells? for example: can i load a background into a row instead of each specific cell?
[flexcoders] Re: datagrid cell renderers
maybe i could elaborate on this a little bit. instead of using an item renderer for the entire row, i chose to set up renderers for the individual columns this makes accessing the whole row a little tricky. mainly i am trying to do 2 things: 1. load a bg into the row, trying to override drawRowBackground() for this. though i am having a bit of trouble trying to figure out what to attach the image to... 2. listen for events, rollovers and selections. i have tried with drawHighlightIndicator() but it doesnt seem to have a method to remove the previously highlighted row if i override this. anyone have any experience trying to use a graphic for the row backgrounds instead of just a color?
[flexcoders] trying to use scale 9 grid
attempting to load an image, set a scale9 for it, not quite sure whats going wrong here. bgOutImg = new Image(); bgOutImg.source = bgLightOut; var grid:Rectangle = new Rectangle(20, 20, 60, 60); bgOutImg.scale9Grid = grid ; bgOutImg.maintainAspectRatio = false; bgOutImg.width = 300; this.addChild(bgOutImg); getting the following error: ArgumentError: Error #2004: One of the parameters is invalid at flash.display::DisplayObject/set scale9Grid()
[flexcoders] getChildren
is there a way to tell if an object has a getChildren method before calling it? I'm calling something that takes any type as the first argument public function myFunc(obj:*):void I need to tell if obj has a getChildren() method before I call it and get an error saying Error #1006: getChildren is not a function.
[flexcoders] rendering checkboxes with as3 instead of mxml?
there is probably a super basic solution to this but i cant seem to find any information on making checkboxes with actionscript instead of laying them out with a repeater in mxml Here's my problem... I want to make checkboxes, in mxml the click event is triggered on toggle. So if I had laid it out in mxml it would look like this: mx:CheckBox id=cbox selected={myChoice.currentItem.selected} label={myChoice.currentItem.label} click=updateFld(event); / However, I am doing it through actionscript so I have this: var cbox:CheckBox = new CheckBox(); cbox.selected = myChoice.currentItem.selected; cbox.label = myChoice.currentItem.label; labelPanel.addChild(cbox); The problem comes in when I want to add functionality on toggle. I can't type cbox.click = updateFld and I'm not sure what events I can listen for on it. Little help on how to handle this?
[flexcoders] issue with dynamic class?
I have a dynamic singleton class that I'm trying to get to recognize a call to a dynamic method. In other words, I have the following class public dynamic class Log extends Proxy {} inside the class I am overriding the callProperty method to have the dynamic methods go wherever I direct them: override flash_proxy function callProperty(name:*, ... rest):* { sendLog(name); } However, I want to be able to statically call Log.newMethod() and have it resolve in callProperty. As it stands now I have to call Log.getInstance().newMethod() to get it to go to callProperty. Any suggestions on how to get around the getInstance() call?
[flexcoders] Flex2LocalDebugger?
Does anybody have any experience with using the Flex2LocalDebugger? Have been trying to use it with no luck. Wondering if anyone else had used it before since it seems like it has a lot of potential to be a useful tool.