Created
June 6, 2012 07:05
-
-
Save louisbl/2880362 to your computer and use it in GitHub Desktop.
Nested dataprovider - binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BasicScoreModule implements IScoreModule | |
{ | |
[Bindable] | |
public var score : int; | |
private var _nom : String; | |
private var _viewClass : Class; | |
public function BasicScoreModule() | |
{ | |
_nom = 'basic score'; | |
score = 4; | |
} | |
public function calcul() : void | |
{ | |
} | |
public function get nom() : String | |
{ | |
return _nom; | |
} | |
public function set nom(s : String) : void | |
{ | |
_nom = s; | |
} | |
public function set viewClass(c : Class) : void | |
{ | |
_viewClass = c; | |
} | |
public function get viewClass() : Class | |
{ | |
return _viewClass; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx"> | |
<s:layout> | |
<s:HorizontalLayout/> | |
</s:layout> | |
<s:Label id="nom"/> | |
<s:Button label="-"/> | |
<s:TextInput id="valeur" text="{data.score}"/> | |
<s:Button label="+"/> | |
</s:ItemRenderer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:components="spark.components.*"> | |
<fx:Script> | |
<![CDATA[ | |
private function scoresViewRendererFunction( item : Object ) : ClassFactory | |
{ | |
return new ClassFactory(item.viewClass); | |
} | |
]]> | |
</fx:Script> | |
<s:layout> | |
<s:HorizontalLayout/> | |
</s:layout> | |
<s:Label text="{data.pseudo}"/> | |
<s:List id="joueurModules" itemRendererFunction="scoresViewRendererFunction" dataProvider="{data.scoreModules}" /> | |
</s:ItemRenderer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ItemJoueurModulesVO | |
{ | |
[Bindable] | |
public var pseudo : String; | |
[Bindable] | |
public var scoreModules : ArrayCollection; | |
public function ItemJoueurModulesVO() | |
{ | |
pseudo = ""; | |
scoreModules = new ArrayCollection(); // collection de BasicScoreModule | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment