11:00

Flex - State ler ile çalışma

Flash daki Scene (sahne) kavramına benzer State kavramı flex içinde çok işime yaradı.
Swf dosyası




Kod Bölümü:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="372" height="274">
<mx:states>
<mx:State name="Kayit">
<mx:SetProperty target="{button1}" name="x" value="205"/>
<mx:SetProperty target="{button1}" name="y" value="138"/>
<mx:SetProperty target="{panel1}" name="width" value="320"/>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:Label x="43" y="80" text="Adınız"/>
</mx:AddChild>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:TextInput x="94" y="78"/>
</mx:AddChild>
<mx:SetProperty target="{button1}" name="label" value="Kayıt Ol"/>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:TextInput x="94" y="108"/>
</mx:AddChild>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:Label x="23" y="110" text="Soyadınız"/>
</mx:AddChild>
<mx:SetProperty target="{panel1}" name="title" value="Kayıt Ol"/>
<mx:SetProperty target="{button2}" name="x" value="64"/>
<mx:SetProperty target="{button2}" name="label" value="Kayıtlı Kullanıcıyım"/>
<mx:SetProperty target="{button2}" name="y" value="138"/>
<mx:SetEventHandler target="{button2}" name="click" handler="currentState=''"/>
<mx:SetProperty target="{panel1}" name="height" value="220"/>
<mx:SetProperty name="width" value="382"/>
<mx:SetProperty name="height" value="288"/>
</mx:State>
</mx:states>
<mx:Panel width="304" height="200" layout="absolute" title="Giriş" id="panel1">
<mx:Label x="10" y="10" text="Kullanıcı Adı:"/>
<mx:TextInput x="94" y="8"/>
<mx:Label x="51" y="45" text="Şifre"/>
<mx:TextInput x="94" y="45"/>
<mx:Button x="94" y="98" label="Giriş" id="button1"/>
<mx:Button x="173" y="98" label="Yeni Kullanıcı" click="currentState='Kayit'" id="button2"/>
</mx:Panel>
</mx:Application>



Bu Makaleyi Tweet'le

0 yorum:

Yorum Gönder