Flex Reset Button

FingerSkill

Erfahrenes Mitglied
Hoi,

hab hier nen kleines Teil welches ich nicht so zu laufen bekomm wie ich will. Problem wird im Code mit Komentaren auf Zeile 19 erläutert:

XML:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#000000, #000000]">
	<mx:Script>
        <![CDATA[
        
        	import mx.collections.ArrayCollection;

            [Bindable]
            public var subjects:ArrayCollection = new ArrayCollection(
                [ {label:"Bitte auswählen...", data:0}, 
                  {label:"Subject_01", data:1}, 
                  {label:"Subject_02", data:2} ]);

            import flash.events.Event;

            // Event handler function to Reset the Panel
            private function resetPanel(event:Event):void  {
            	emailAdress.text = "";
		Subject.data:0; //Ich weis hier nicht wie ich die ComboBox auf "Bitte auswählen..." also auf data:0 setzen soll
		Disclaimer.selected = false;
            }

      ]]>
    </mx:Script>
	<mx:Panel width="600" height="177" layout="absolute" horizontalCenter="0" title="MailAdressDumper V 0.1_predev" color="#E9C638" fontSize="12" cornerRadius="11" alpha="1.0" verticalCenter="0" backgroundColor="#939393">
		<mx:TextInput y="8" right="10" width="462" id="emailAdress" color="#000000"/>
		<mx:ComboBox y="40" right="10" width="462" id="Subject" color="#000000" dataProvider="{subjects}"></mx:ComboBox>
		<mx:CheckBox x="108" y="72" id="Disclaimer" color="#000000"/>
		<mx:Label y="10" text="eMail-Adress:" left="10" color="#000000"/>
		<mx:Label x="10" y="43" text="Subject:" color="#000000"/>
		<mx:LinkButton x="130" y="70" label="Disclaimer" textAlign="left" color="#000000"/>
		<mx:Button x="498" y="102" label="Submit" color="#000000"/>
		<mx:Button x="108" y="102" label="Reset" color="#000000" click="resetPanel(event);"/>
	</mx:Panel>
	
</mx:Application>

Hoffe ihr könnt mir helfen.

Gruss Finga
 
Zuletzt bearbeitet von einem Moderator:
Hoi,
hab den Fehler gefunden poste nochmal den funktionierenden Code:

XML:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#000000, #000000]">
	<mx:Script>
        <![CDATA[
        
        	import mx.collections.ArrayCollection;
            import flash.events.Event;
            import mx.controls.Alert;
            
            [Bindable]
            // Array which contains the subjects
            public var subjects:ArrayCollection = new ArrayCollection(
                [ {label:"Bitte auswählen...", data:0}, 
                  {label:"Subject_01", data:1}, 
                  {label:"Subject_02", data:2} ]);

            // Event handler function to Reset the Panel
            private function resetPanel(event:Event):void  {
            	emailAdress.text = "";
				Subject.selectedIndex = 0;
				Disclaimer.selected = false;
            }

      ]]>
    </mx:Script>
	<mx:Panel width="600" height="177" layout="absolute" horizontalCenter="0" title="MailAdressDumper V 0.1_predev" color="#E9C638" fontSize="12" cornerRadius="11" alpha="1.0" verticalCenter="0" backgroundColor="#939393">
		<mx:TextInput y="8" right="10" width="462" id="emailAdress" color="#000000"/>
		<mx:ComboBox y="40" right="10" width="462" id="Subject" color="#000000" dataProvider="{subjects}"></mx:ComboBox>
		<mx:CheckBox x="108" y="72" id="Disclaimer" color="#000000"/>
		<mx:Label y="10" text="eMail-Adress:" left="10" color="#000000"/>
		<mx:Label x="10" y="43" text="Subject:" color="#000000"/>
		<mx:LinkButton x="130" y="70" label="Disclaimer" textAlign="left" color="#000000"/>
		<mx:Button x="498" y="102" label="Submit" color="#000000" click="Alert.show('Test!');"/>
		<mx:Button x="108" y="102" label="Reset" color="#000000" click="resetPanel(event);"/>
	</mx:Panel>
	
</mx:Application>
 
Zuletzt bearbeitet von einem Moderator:

Neue Beiträge

Zurück