IPv4AddressInput is a user interface component for Flex that allows the user to input an Internet Protocol version 4 address. This control includes a field for each separate byte and full keyboard navigation.
Using IPv4AddressInput in Flex 3
In Getting Started, we looked at the usage of IPv4AddressInput with simple String values. Now, let's look more closely at the
com.yahoo.astra.net.IPv4Address class. We'll start by adding a series of controls to our application in MXML.
This displays an IPv4AddressInput in a Panel container. Under the input is a form containing several labels that will present a readable view of the IPv4Address object.
You'll notice that on the
valueCommit event, we call a function named
updateRawView(). Let's add this function to our application in a
toString() method on the IPv4Address instance gives us the familiar
###.###.###.### IP address format as a String. Additionally, the IPv4Address class exposes a property named
bytes which is a ByteArray instance of length 4 that holds that raw numeric bytes for the IP address. We display each byte individually in the form.
To see a live example, please install Adobe Flash Player version 9 or higher.
Download the MXML example file.
For additional information, please take a look at the Examples section for functional demonstrations and the ActionScript 3.0 Class Reference for full details on every property, method, and style available to the IPv4AddressInput component.