これは私が持っているコードの例です。モバイル アプリケーションが開いたら、希望の色 (たとえば、紫がかった色の場合は #811fb4) を入力できます。ボタンをクリックすると、ラベルの色が変更されます。ただし、 lbl1.color は機能しません。何か案は?
<?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="Custom Colour">
<fx:Script>
<![CDATA[
public var customColourChosen:String;
protected function button1_clickHandler(event:MouseEvent):void{
customColourChosen = txtInput1.text;
lbl1.color = customColourChosen; // <------ //
}
]]>
</fx:Script>
<s:Label id="lbl1" x="144" y="104" fontSize="36" text="Label"/>
<s:TextInput id="txtInput1" x="50" y="138"/>
<s:Button x="124" y="212" label="Button" click="button1_clickHandler(event)"/>
</s:View>