Use CreditCardValidator : CreditCardValidator « Data Model « Flex






Use CreditCardValidator

Use CreditCardValidator
    


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

  <mx:VBox>
    <mx:ComboBox id="cardType">
      <mx:dataProvider>
        <mx:ArrayCollection>
          <mx:Array>
            <mx:String>American Express</mx:String>
            <mx:String>MasterCard</mx:String>
            <mx:String>Visa</mx:String>
          </mx:Array>
        </mx:ArrayCollection>
      </mx:dataProvider>
    </mx:ComboBox>
    <mx:TextInput id="cardNumber" />
    <mx:Button click="trace(validator.validate( ))" />
  </mx:VBox>
  <mx:CreditCardValidator id="validator" 
                          cardNumberSource="{cardNumber}" 
                          cardNumberProperty="text" 
                          cardTypeSource="{cardType}" 
                          cardTypeProperty="value" />

</mx:Application>

   
    
    
    
  








Related examples in the same category

1.Data binding and credit cardData binding and credit card
2.CreditCardValidator demoCreditCardValidator demo