在Flex移動應用程序(或任何Flex 4應用程序)中 - 如何根據其他兩個字段的內容啓用/禁用按鈕?僅當2個TextInput字段不爲空時啓用按鈕 - 附帶代碼和屏幕截圖
我貼我的下面很簡單的測試代碼和它存在的問題是在Flash Builder 4.7的語法錯誤:The entity name must immediately follow the '&' in the entity reference.
- 這可能意味着符號是一個特殊字符,但如何解決這個問題(大概頻繁)問題?
TestApp.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView="views.Home"
applicationDPI="160">
</s:ViewNavigatorApplication>
的意見/ Home.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="How to enable Login button?">
<s:layout>
<s:VerticalLayout paddingTop="8"
horizontalAlign="center" gap="8" />
</s:layout>
<s:Label text="Username:" />
<s:TextInput id="_username" />
<s:Label text="Password:" />
<s:TextInput id="_password" />
<s:Button id="_login"
label="Login"
enabled="{_username.text.length > 0 && _password.text.length > 0}" />
</s:View>