<mx:VBox id="paSenate" label="PA Senate" width="100%" verticalGap="0">
<mx:HBox>
<mx:Label text="PA Senate" fontWeight="bold"></mx:Label>
<mx:Label id="paSenateConf" text="" />
</mx:HBox>
<mx:Label id="paSenateNameLabel" text="" paddingLeft="5"/>
<mx:Label id="paSenateCountyLabel" text="" paddingLeft="5"/>
<mx:Label id="paSenateURLLabel" text="" paddingLeft="5"/>
</mx:VBox>
The code I have above displays results based on an address search. All the information being displayed is coming from either database or a web service. Including the web address for Senate and House members. The website is coming back as a string. Right now it is just simply being passed into the text field of paSenateURLLabel. I need to change it somehow to a hyperlink so it's clickable. This is being done in Flex 3.5. Not entirely sure how I would go about doing this.
Flex 3 has a LinkButton component that will do this. (Note, if you were using Flex 4 you would just make text based skin for a Button or use TLF text which has hyperlink functionality.)
<mx:LinkButton label="I'm a link" click="linkClickhandler()" />
Related
I have an implementation for a drop-down list. All the values are there, however it doesn't allow the user to select an item with the mouse instead of just with the arrow keys.
<s:FormItem label="Food:">
<s:DropDownList id="dropDownList"
dataProvider="{foodList.lastResult.Food_Display_Table.Food_Display_Row}"
labelField="Display_Name"
/>
<s:DropDownList id="TEST">
<s:dataProvider>
<mx:ArrayList>
<fx:String>Red</fx:String>
<fx:String>Orange</fx:String>
<fx:String>Yellow</fx:String>
<fx:String>Blue</fx:String>
<fx:String>Green</fx:String>
</mx:ArrayList>
</s:dataProvider>
</s:DropDownList>
</s:FormItem>
</s:Form>
The first drop-down list is my actual implementation. The second one is a test. I have the same problem with both drop-down lists.
The DropdownList is not supported in the mobile device profile. There are some opensource implementations that add support for this, and they're quite good : https://www.flextras.com/index.cfm?event=ProductHome&productID=21
I created an Item Renderer for the Flex Spark List Component.
The problem is that this code will not work:
<s:Label left="10" right="10" top="10" bottom="10" fontSize="13" text="{data.getItemAt(1).toString()}"
textAlign="left" verticalAlign="middle"/>
While this code will:
<s:Label left="10" right="10" top="10" bottom="10" fontSize="13" text="{data[1].toString}"
textAlign="left" verticalAlign="middle"/>
I can't use the later code because of binding issues.
Does anyone have any idea on what I'm doing wrong?
As #J_A_X' comment stated, these are two completely different things.
{data.getItemAt(1)...
Refers to an ArrayCollection, or possibly some other collection.
{data[1]...
Refers to an Array.
Attempting to treat an array as an array collection will not get you very far. I would recommend ensuring that the each item in your list is actually an ArrayCollection. Alternatively, I would more strongly support replacing them with value objects, and binding to a 'title','text', or whatever property more correctly defines the text you wish to display.
{data.title}
I'm binding an array of items to a data grid using ItemRenderer. I use the data variable to control the bindable data. I also have someComponentVariable that need be inserted into every row but its declared at the component scope, so the data grid doesn't seem to reconize it (compile error).
How can I use this variable (someComponentVariable) inside the ItemRenderer?
Code Example
<mx:DataGrid id="userBonusesGrid" width="100" height="248" showHeaders="false" wordWrap="true">
<mx:columns>
<mx:DataGridColumn headerText="" width="36">
<mx:itemRenderer>
<mx:Component>
<mx:VBox verticalAlign="middle" horizontalAlign="center">
<ns1:SidePanelBonus
bonusName="{data.name}" description="{data.description}"
arrow="{someComponentVariable}">
</ns1:SidePanelBonus>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
If someComponentVariable is a public property of the class enclosing DataGrid, you can use outerDocument to access it from a component.
<ns1:SidePanelBonus bonusName="{data.name}" description="{data.description}"
arrow="{outerDocument.someComponentVariable}">
</ns1:SidePanelBonus>
See the "using the Component tag" section in Creating inline item renderers and editors for more info about outerDocument
No you can not use it at all. Each itemRenderer in data grid can only access the item for which the renderer was created. And this is done purposely because itemRendrers change dynamically, they are not bound for data forever, when you scroll, the items get scrolled not the renderers, they remain in same position or they might change, but corresponding item renderer's data always changes when you scroll. They dont share one to one relationship.
The only solution is to pass the data in the item in the form of some parent child relationship.
I am new to FLEX and I am planning to display video on web page.My mxml code is below
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
<mx:Array id="movieList">
<mx:String>http://localhost/Flex/Butterfly.flv</mx:String>
</mx:Array>
<mx:VBox>
<mx:List id="cntlMovie" dataProvider="{movieList}" width="300" />
<mx:Button label="Pause" click="cntlDisp.pause();" />
<mx:Button label="Play" click="cntlDisp.play();" />
</mx:VBox>
<mx:VideoDisplay id="cntlDisp" source="{cntlMovie.selectedItem.valueOf()}"
width="400" height="300" />
</mx:Application>
I am running Apache2.2.11 server.
When I run the above code, the browser just hangs(does not respond).
When the video url(http://localhost/Flex/Butterfly.flv) is directly accessed, it prompts to download the video file.
Could someone provide some help on this.
Install Charles and monitor the request (you might need to use your computer name instead of localhost). Is the request coming through to the server? What's the response status code?
Our resident Flex expert is out for the day and I thought this would be a good chance to test this site out. I have a dropdown with a dataProvider that is working fine:
<ep:ComboBox id="dead_reason" selectedValue="{_data.dead_reason}"
dataProvider="{_data.staticData.dead_reason}"
labelField="#label" width="300"/>
The ComboBox is custom but I'm not sure if that matters for the question. I need to change the combo box to radios (all in one group) but maintain the dynamic options. In other words, what is the best way to generate dynamic RadioButtons?
Try using an <mx:Repeater> Something like:
<mx:Repeater dataProvider="{_data.staticData.dead_reason}">
<mx:RadioButton groupName="reasons" ...>
</mx:Repeater>
<mx:RadioButtonGroup id="RDO_Group"/>
<mx:Repeater id="myRepeater" dataProvider="{_data.staticData.dead_reason}">
<mx:RadioButton id="rdo" label="{myRepeater.currentItem}" value="{myRepeater.currentItem}" groupName="RDO_Group"/>
</mx:Repeater>
is the best way.