getting selectedIndex for SkinnableDataContainer / List - apache-flex

Is there something like selectedIndex for SkinnableDataContainer? It doesn't seem to be one of the available properties.

Nick
Look at the following link to Adobe's site... this will describe how to add the functionality to the SkinnableDataContainer class by extending it.
SkinnableDataContainer Link
Z

I needed just this, a few days ago and found some components that should work. If you look at spark.components.List which is a subclass of spark.components.SkinnableDataContainer you will see the selectedIndex property aswell as the selectedIndices property (for selecting multipleItems). If you dont need all of the List functionality spark.components.supportClasses.ListBase can be used.

Related

Changing the field appearance after making enable = "false" to that field?

I am trying to make enabled="false" to one form field in my flex application. But the appearance of the field after disabling it
is looking furious. I want to change the look of the field after disabling it in my way. So can i change the look and feel of a field after disabling it ?
Thanks in advance...
I think you have to write a skin for your component.
Every skin has different states for skinning. In your case, you have to write skin for disabled state.
To get started, this tutorial might be useful - http://www.adobe.com/devnet/flex/articles/flex4_skinning.html
For detailed information on skinning, please visit http://help.adobe.com/en_US/flex/using/WSC8DB0C28-F7A6-48ff-9899-7957415A0A49.html
Yes.
Concept: -
Use constraint based layout concept.
If you are using actionscript use move()
Ex: -
button.move(100,100);
if(button.visible)
{
button1.move(button.x + button.height + 5,button.y);
}
so on....
Please add some code so that we can suggest what exactly you are looking for.

How to bind property of View to property of class using Flex MATE

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?
Thanks in advance
For future use:
fiction has answered the question correctly.
Actually it should have been formulated this way!
<Injectors target="{Target}">
<PropertyInjector targetKey="targertProp"
source="{SourceClass}"
sourceKey="SourceProp"/>
</Injectors>
Of course SourceProp must be [Bindable]
Read my article below
http://vinothbabu.com/2010/03/21/introduction-to-mate-framework/
on how you use the Injectors Tag to play with. Its a very simple example. Let me if you were looking for something else.

AdvancedDataGrid problem with programmatically adding a column

I have a Problem with adding columns programmatically to a AdvancedDataGrid. The code:
var cols:Array = thisDataGrid.columns;
cols.push(dgc);
thisDataGrid.columns = cols;
does create a column, adds it to the cols array, bot the last code line has no effect. The cols wont be found in the thisDataGrid.columns property...
What could be the problem? I'm working with a test license, and on the advanceddatagrid the watermark shows up. Could this be a problem?
Thanks for help!
Markus
I had the same issue and resolved it by making sure that I add my ADG object into an active visual component. In my case, I just made a call to this.addElement( adg ) (or this.addChild() ) after updating the adg.column property.
It seems like the adg properties will only update when the adg is "attached" to an active visual component. I havn't taken the time to really look into the cause of this behaviour though.
try doing invalidateProperties() and invalidateDisplayList() on grid

Actionscript 3 Bind variables

I am trying to set one bindable variable to be bound to another. Essentially I want to create an alias. I would give up, but this seems like something that would be good to know.
essentially, I want changes in model.configView to be reflected in view, so that things bound to view.... behave the same as things bound to model.configView... in this example [Bindable]
var view = model.configView;
...
<mx:Label text="{view.lblThisLabel.name}" />
at the moment it does not, and I am getting errors that say "unable to bind to property 'lblThisLabel' on class 'Object' (class is not an IEventDispatcher)"
Not quite enough code here to really say what's going on, however you have made view bindable and that does not automatically mean that all of view's children are bindable. You'll have to go into view and make lblThisLabel bindable too.
Also it is hard for the rest of us to know how it works in your head. Perhaps you should describe that too.
Moreover, I think that even if, with your actual code, view changes should be detected, view won't be updated if assigned model.configView property is not bindable as well...

Flex component access other component

I have 2 components for example (editor.mxml using mx:windows), when I click an edit button, I want to get the current value from the other component's datafield? (datagrid.mxml using mx:window)
I do know how to access the main MXML's datagrid by parentDocument or Application.application method, but stumped block if I want to access other way as mentioned above. Keep the code as simple as possible.
You could either do dependency injection, that is, give component A a reference to component B so that they can communicate directly (example of tighter coupling,) or have both components communicate through a common mediator using events (example of more loose coupling.)
Both of those options would be implemented wherever it is that you're creating those components (A and B in this example) and adding them to the display list.
This might be more complicated than it deserves, and it smacks of Pattern-Fever, but you could use a mediator class that listens for the CLICK event from the button and knows enough about the other component to query its property. It could even transmit that data using a custom event, which the button listens for.
While this involves three classes instead of two, it often turns out to be easier to have two components that focus on looking good and one that worries about coordination.
Cheers
Try this:
FlexGlobals.topLevelApplication
This points Your root. From the root You can grab every element You want.
You can also add an id to the custom component like this,
<custom:Editor id="myCustomComponent">
</Editor:AddressForm>
and
access your datagrid's value like this,
var data:ArrayCollection = myCustomComponent.DatagridID.dataProvider;

Resources