title: Flex 4 two-way data binding on properties of non-matching types
body: <p>Is there really no simple way to perform two-way data binding on properties of non-matching types? In the example below I was trying to bind two properties to each other: one of type <code>String</code> (<code>text</code> property from <code>s:TextInput</code>) and the other of type <code>Number</code> (<code>bar</code> property from <code>Foo</code>)</p>
  
  <pre><code>package com.example
  {
      public class Foo
      {
          [Bindable] public var bar:Number;
      }
  }
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application
      xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
  
      xmlns:ex="com.example.*"
  &gt;
      &lt;fx:Declarations&gt;
          &lt;ex:Foo id="foo" /&gt;
      &lt;/fx:Declarations&gt;
      &lt;s:TextInput text="@{foo.bar}" /&gt;&lt;!-- error at this line --&gt;
  &lt;/s:Application&gt;
  </code></pre>
  
  <p>Attempting to compile this code results in the following error:</p>
  
  <blockquote>
    <p>1067: Implicit coercion of a value of type String to an unrelated type Number.</p>
  </blockquote>
  
  <p>I understand why the error happens, but I was wondering if I'm simply ignorant of something (perhaps some sort of Flex 4 metadata) that would allow for an attempt at conversion between the two types and throwing a run-time error if such a conversion fails...</p>