Flex :: Binding To An Specific Property Of Objects In An Array?
Jul 22, 2009
I am using Flex to create a small form. All I have at the moment is a List component, that I want to populate with a list of font names.I am getting the fonts using Font.enumerateFonts(true);. This returns an array of flash.text.Font objects.
The Font objects have a fontName property that is a String of that fonts name.My problem is that I can't figure out how to bind the List's dataProvider to the fontName property of each of the Font objects in the Array.Is there a way to do this just with binding? and not creating a new array of Strings by looping through the Font objects?
View 1 Replies
Similar Posts:
Jan 9, 2011
Lately i discovered MATE (for Flex development) and was wondering: how do i bind a property in a view (actually a navigatorcontent component) to another property in a class so that they stay in synchronization (meaning that whenever the property in the class changes the property in the view also changes).
So if we have a view called Target.mxml and a property targertProp how do we bind it to the class called SourceClass with property SourceProp?
View 3 Replies
May 22, 2010
i would like to update the numbers i've added to an array from variables, when thosevariables change. is it possible change these variables and have the array update utomatically?
var first:Number = 1;
var second:Number = 2;
var myArray:Array = new Array(first, second);
[code].....
View 1 Replies
Dec 13, 2011
i have in my main application:
private var vm:VideoManager;
protected function init():void{
vm = new VideoManager();//create a video manager instance
}
and i want to pass the vm instance to another component so i do:
[Code]...
View 2 Replies
May 5, 2010
I am trying to:
1) create a dynamic property
2) bind that property to a label
This works great for "sealed properties", but for dynamic properties there doesn't appear to be any event triggered. Are dynamic properties implicityly not bindable?
var myObj:MyType = new MyType(); // MyType is dynamic
myObj["myDynamicPropertyName"] = "initialized";
BindingUtils.bindProperty(myLabel, "data", myObj, repeatedLabel.name);
// myLabel now displays "initialized"
myObj["myDynamicPropertyName"] = "changed";
// myLabel still displays "initialized", it should say "changed" !!!
View 3 Replies
Jun 2, 2010
Is it possible to set a percentage value for the width property of an UIComponent defined in MXML using data binding?
What I try to achieve is something like this (which doesn't work):
<s:Button width="{buttonWidth}%"/>
I know that using percentage for width or height properties in MXML is kind of a hack in the Flex SDK, since they're supposed to accept numerical values only, but since percentWidth and percentHeight aren't available in MXML, I'm pretty stuck =/
I would really like to avoid using code to do such a simple thing, in order to keep my code as clear and readable as posible.
View 4 Replies
Jun 8, 2011
class A: with a property "data:ArrayCollection". It's my data source (data provider) and has bitmaps.
class B: has an instance of A (called "Ainst") and calls the following method: C.init( Ainst.data). To pass the data provider to Object C.
class C: has a reference of the data provider "data" (because of "init" method). It shows the arrayCollection into Images as: Image.source = data.getItemAt(0).
But C never updates its images, that is, data binding doesn't work with this scheme. I've put [Bindable] meta-tag in all properties and even classes.
[Code]...
View 2 Replies
Apr 20, 2011
I have a situation where I need to update a DropDownList's dataProvider and selectedItem in a specific order. See the following code ...
<s:DropDownList id="dropDownList"
dataProvider="{someDataProvider}"
selectedItem="{someSelectedItem}" />
In my case, some user interaction produces new values for the bindable variables "someDataProvider", and "someSelectedItem". However, when flex renders the DropDownList, the control's selected value is empty.
The reason for this is that the DropDownList's "selectedItem" property gets bound before the "dataProvider" property. The "dataProvider" needs to be bound first for "selectedItem" to be valid, this is because the new "selectedItem" points into the new "dataProvider".
what is the best practice for updating bindable properties in a specific order? I've come up with a few ways (e.g. using a valueCommit handler), but I wanted to see what the community had to say.
View 2 Replies
Apr 1, 2012
I have the following code:
<fx:Script>
<![CDATA[
import shared.GlobalsManager;
[code].....
View 1 Replies
Oct 12, 2010
I have a label inside a repeater (rptInfos), and I have an arraycollection (Texts) that has the translations. The "Texts" content is changing when I change the language, and normally I use {Texts.getItemAt(219}} for example when I need a translated text. But in the repeater I have a translateable column, so I want to use it like this:
<s:Label text="{Texts.getItemAt(rptInfos.currentItem.DictID as int)}" />
but it says "Syntax error: expected a definition keyword (such as function) after attribute , not target".I wanted to translate it in the labels creationComplete event, but than I can forget about binding, so only when reloaded can I have the content to update.
View 2 Replies
Feb 6, 2010
How could I get a number of all same objects in array (lets say I have five "Grass" objects and ten "Wood" objects. Now I want to get the number of Wood objects.
View 6 Replies
Nov 15, 2010
I am trying display values in a datagrid in my application. I have all the values as an xml file. I had only one set of record n the XML file, to fill only one row of the data grid. While trying to store the values from the XML file to an Array Collection in the application File using the code, i.e.,
<mx:Model id="reviewList" source="assets/reviewList.xml"/>
<mx:ArrayCollection id="reviewlist" source="{reviewList.Item}"/>
I get an error, saying Error No# 1034: Type coercion failed cannot convert mx.utils::ObjectProxy to Array.But If I have two record sets in the XML file, it works fine. If there is only one set, I gHere is my xml file:
<ReviewList>
<Item>
<ReviewId>1123</ReviewId>
[code]....
View 6 Replies
Feb 9, 2010
say that i have a base class called Base, that is Bindable and has a String property like this:
[Bindable]
public class Base
{
public var msg:String;
[Code]......
where msg is some textInput field. I am getting a message from the compiler that....
Data binding will not be able to detect assignments to "msg"
is there a limitation with data binding to a base class?
View 1 Replies
Jun 10, 2011
I have a service which returns an Array of ObjectProxy objects. I would like to cast this to a custom object (a value object) and create an ArrayCollection. How can I do this?ited:I am using Django and PyAMF for the backend. I had to write a custom SQL query and I am wrapping the resulting records in ObjectProxy and sending the whole result as an ArrayCollection.Here is my client side code:
[ArrayElementType("SessionVO")]
[Bindable]
private var _list:ArrayCollection;
[code]....
View 2 Replies
Oct 14, 2009
I have some XML structures like this:
var struct:XML = <mh>
<mi id="1" stuff="whatever"/>
[Code]....
I wonder if items can be accessed in a similar way, like this:
var stuff:Object = cmenu['id == 2'].stuff;
View 8 Replies
Oct 5, 2011
Im using Oracle, BlazeDS, Java and Flex. I have a list of objects displayed in a datagrid(Lets call them Main-objects. Each of these objects have a set of UserComment-objects associated with them(One-to-Many relation in the DB). These comments may come from two different "types" of users, distuingished with either a 1 or 0 in the UserComment-object's "userType" field. Each time the user selects a Main-object in the datagrid, the UserComment's related to this object is displayed in a separate datagrid below.Based on the introduction, i want to separate the UserComment's into two separate datagrids (one for each user-type), instead of the one i have now. So my question is: What is the best approach for performing this task? What is the best way of separating the UserComment's into two separate data grids based on the value of the "userType" field?
View 3 Replies
Nov 17, 2009
I have no success binding mxml control to AC3 object property. I'm new to AC3/Flex and assume my aproach is kinda "Javascript like" and might be completely wrong. Here's mxml (don't pay attention to mistypes/syntax errors):
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="[URL]" .... >
<mx:Script>
<![CDATA[
[Code] .....
View 0 Replies
Oct 13, 2009
Is it possible to specify MXML-esque "binding strings" in ActionScript?For example, I want to be able to do something like:
MXMLBinding(this, "first_item",
this, "{myArrayCollection.getItemAt(0)");
MXMLBinding(this, ["nameLbl", "text"],
[code].....
View 6 Replies
Oct 10, 2011
In my flex application im using two datagridfirst datgrid is for items collectionssecond is for bank details.if i click one row in first datagrid (which has the items collections)...a unique code is taken from the grid(which is primary key).then, i have to select two or more banks using itemrenderer checkboxes in second datagrid(which has the bank details)ow, have to bind the bank details(one or more banks) with that one primary key in first datagrid. to an single array collection... and have to show it in another new datagrid(thirdone)
View 1 Replies
Jan 16, 2010
I'm trying to create a class that contains an array. However i want to require that the items in the array are themselves of a specific class. Im told there is some sort of tag you can add to do this, but for the life of me i cannot find what it is.What i hope for is something like:
public class myClass{
public var foo:String;
[ArrayType(class="BarClass")]
[code]........
View 1 Replies
Jun 22, 2010
I'm trying to make a variation on Array for a very specific purpose. When I have the following:
public class TileArray extends Array {
// Intentionally empty - I get the error regardless
}
Why can't I do this?
var tl:TileArray = [1,2,3];
despite the fact that I can do this
var ar:Array = [1,2,3];
The error I receive is this: Implicit coercion of a value with static type Array to a possibly unrelated type
View 3 Replies
Apr 21, 2010
I have a dynamic ArrayCollection that will contain a unknown number of objects of type MyObj:
class MyObj
{
type:String
[code]........
View 1 Replies
Aug 19, 2011
If I have a list of items in an array that represent the names of modules:
[Code]...
View 1 Replies
Dec 29, 2009
While developing with Adobe Flex, I'm working on my first application - and use pretty much actionscript.
In my mxml application, I include as3 file via <mx:Script source="as/myas3file.as></mx:Script>.
In myas3file.as, I include (thru include "variables.as";) file variables.as, which contains following code:
var timer:Object = new Object();
timer.t = 60;
or (in other test case)
var timer:Object = {t:60, j:"80"};
timer.t = 80;
Neither case works! Even if I rewrite example code from official documentation, it throws an 1020 error.
View 1 Replies
Dec 29, 2011
I'm trying to sort an array of "tile" objects in as3 by the value of its "realY" property.
This is my code:
[Code]....
As you can see, there are some random small numbers at the end.
View 1 Replies
Aug 24, 2009
When the dataProvider for an DataGrid is an array of objects, how do I set each column's dataField to a property of the object.I have an ArrayCollection (say a) where each item is an objectFor example a[i] = data:ObjectWhere the object data has some subproperties - data.name, data.title, data.content etc.I have a DataGrid in which I want to display this data.So I put:
<mx:DataGrid id="entries" dataProvider="{resultRSS}">
<mx:columns>
<mx:Array>
[code]......
View 1 Replies
Mar 29, 2010
Example:
var arr_1:Array = new Array();
arr_1.push({sdate:"2010-02-02",status:"New"});
arr_1.push({sdate:"2010-02-03",status:"New"});
arr_1.push({sdate:"2010-02-04",status:"New"});
arr_1.push({sdate:"2010-02-05",status:"New"});
How can I change element number 3 status to: "Old", without removing it. Just update the status value??
View 1 Replies
Feb 14, 2011
I have a chart and am trying to display the "volume" in a line chart as the primary series & the "temp" as a column chart as the secondary series...(the "compound" will be shown in the datatip):
[{date=Tue Feb 08 19:00:00 EST 2011, volume=1200, 1={temp=-50, compound=helium}, 0={temp=-45, compound=oxygen}}]
I can get the "volume" series to display fine, but cannot get the "temp" series to display...how do I access them? Right now I have:
<mx:ColumnSeries id="secondSeries" xField="date" yField="temp">
View 1 Replies
Jan 2, 2010
I am trying to add some Sprite objects as the contents of an array, and I would like to be able to "clear" them from the stage. I would assume that if there are loaders involved, I need to do
_imgArray[i].close();
_imgArray[i].unload();
And if I am using a sprite, I can do:
removeChild(_imgArray[i]);
None of the above work.
Currently I try:
for(i = 0; i < _localXML.length(); i++) {
var tmp:BMLink = new BMLink(_localXML[i], _bw, _bh, i);
_imgArray[i] = tmp;
_imgArray[i].x = (_bw + _mainpad) * i;
_base.addChild(_imgArray[i]);
But this doesn't work.
The class instances that are populating the array are all extending sprite, but they have their own individual loaders inside w/ progress events etc.
View 2 Replies
Mar 12, 2010
I have a datagrid that uses an array of objects as the data provider. The objects are essentially key/value pairs:
{ foo:"something"}
{ bar:"hello"}
{ caca:"lorem"}
The datagrid has 2 columns. The first column is the key and the second column is the value. Right now my grid looks like:
My dataFormatter function makes sure that depending on the column (i.e. the dataField value) the correct key or value gets printed out. This works fine for displaying. However, as soon as I try and edit the value field it essentially adds a new value into the object with a key of '1'. For example, if I edit the {caca:"lorem"} object it will then contain the value {caca:"lorem",1:"new value"}.
Is there any possible way I can set the DataGridColumn so that when I edit a value it will update the value associated with the key rather than inserting a new value? I've tried using a custom item editor but it still does the insert. It seems like I need to be able to update the 'dataField' with the actual key value but I'm not sure how to do that.
View 1 Replies