skip to main
|
skip to sidebar
Flash-разработка. Код
Здесь публикуются фрагменты программного кода.
среда, 3 июня 2009 г.
Data Binding
<mx:Binding source="source.text" destination="destination.text" />
<mx:TextInput id="source" />
<mx:TextInput id="destination" />
OR
<mx:TextInput id="source" />
<mx:TextInput id="destination" text="{source.text}" />
* * *
<mx:Binding source="source.text" destination="destination.text"/>
<mx:Binding source="source2.text" destination="destination.text"/>
<mx:TextInput id="source"/>
<mx:TextInput id="source2"/>
<mx:TextInput id="destination"/>
Simple data binding:
<mx:ComboBox id="c" dataProvider="{myArray}" />
<mx:ViewStack id="v" selectedIndex="{c.selectedIndex}">
<mx:Canvas>
<mx:Label text="1"/>
</mx:Canvas>
<mx:Canvas>
<mx:Label text="2"/>
</mx:Canvas>
</mx:ViewStack>
OR
<mx:ComboBox id="c" dataProvider="{myArray}" />
<mx:Binding source="c.selectedIndex" destination="v2.selectedIndex" />
<mx:ViewStack id="v2">
<mx:Canvas>
<mx:Label text="1"/>
</mx:Canvas>
<mx:Canvas>
<mx:Label text="2"/>
</mx:Canvas>
</mx:ViewStack>
String concatenation:
<mx:TextInput id="fname" />
<mx:TextInput id="lname" />
<mx:Label text="{'First Name: ' + fname.text}" />
<mx:Label text="{'Full Name: ' + fname.text + ' ' + lname.text}" />
OR
<mx:TextInput id="fname" />
<mx:Binding source="{'First Name: ' + fname.text}" destination="destination.text" />
<mx:Label id="destination"/>
Calculations:
<mx:NumericStepper id="quantity" />
<mx:TextInput id="price" />
<mx:Label text="{'Total: ' + quantity.value * Number(price.text)}" />
OR
<mx:NumericStepper id="quantity" />
<mx:TextInput id="price" />
<mx:Binding source="{'Total: ' + quantity.value * Number(price.text)}" destination="destination.text" />
<mx:Label id="destination"/>
Conditional:
<mx:NumericStepper id="quantity" />
<mx:Label text="{(quantity.value % 2) ? 'Odd' : 'Even'}" />
OR
<mx:NumericStepper id="quantity" />
<mx:Binding source="{(quantity.value % 2) ? 'Odd' : 'Even'}" destination="destination.text" />
<mx:Label id="destination"/>
Следующие
Предыдущие
Главная страница
Подписаться на:
Сообщения (Atom)
Обо мне
Просмотреть профиль
Мои блоги
Flash-разработка
Ярлыки
Загрузка
(4)
Математика
(2)
Паттерны проектирования
(1)
Приёмы
(14)
Приложения
(1)
Справка
(4)
Actionscript 2.0
(8)
Actionscript 3.0
(11)
Binding
(1)
Bitmap
(5)
Filters
(1)
Flex
(4)
MXML
(4)
SmartFoxServer
(1)
Архив блога
▼
2009
(2)
▼
июня
(1)
Data Binding
►
апреля
(1)
►
2008
(14)
►
августа
(1)
►
июля
(1)
►
мая
(4)
►
апреля
(1)
►
февраля
(3)
►
января
(4)
►
2007
(10)
►
декабря
(1)
►
ноября
(8)
►
сентября
(1)