title: Passing strongly typed object to method expecting an interface
body: <p>I'm running into difficulty passing a strongly typed object, <code>AttractView</code>, to another method, <code>addView()</code> which expects an <code>IWizardView</code> interface that <code>AttractView</code> does implement.</p>
  
  <p>When I pass it as-is (as shown below), I get the compile error <code>CaptureApplication.as, Line 120 1067: Implicit coercion of a value of type AttractView to an unrelated type IWizardView.</code> </p>
  
  <p>Casting to either <code>IWizardView</code> or <code>BaseView</code> before passing yields a similar error at run time.</p>
  
  <p>Application class:</p>
  
  <pre><code>public class CaptureApplication extends MovieClip
  {
      public var attractView : AttractView;
      public var captureView : CaptureView;
      public var reviewView : ReviewView;
      public var completeView : CompleteView;
      protected var wizard : Wizard;
  
      public function CaptureApplication()
      {
          // Create views
          attractView = new AttractView();
          captureView = new CaptureView();
          reviewView = new ReviewView();
          completeView = new CompleteView();
  
          // Create wizard and add views to sequence
          wizard = new Wizard( this );
          wizard.addView( attractView );
          wizard.addView( captureView );
          wizard.addView( reviewView );
          wizard.addView( completeView );
      }
  
      // ...
  }
  </code></pre>
  
  <p>Wizard:</p>
  
  <pre><code>public class Wizard extends EventDispatcher
  {
      // ...
  
      public function addView ( pView : IWizardView ) : void
      {
          // ...
      }
  
      //...
  }
  </code></pre>
  
  <p>And an example view:</p>
  
  <pre><code>public class AttractView extends BaseView implements IWizardView
  {
      // ...
  }
  </code></pre>
  
  <p>Architecture I'm hoping for (simplified for clarity):</p>
  
  <pre><code>CAPTURE LIBRARY (AS3 SWC)
  / classes
      / wizard
          / IWizardView
          / Wizard
      / capture
          / IView
          / BaseView
          / AttractView
          / CaptureView
          / (etc.)
  
  CAPTURE APPLICATION (Flash)
  / classes
      / CaptureApplication
  </code></pre>
  
  <p>The idea here is that I am building multiple "capture" applications with similar UIs, so I'd like to extract common elements into a library and extend as necessary for each unique capture app.</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p><code>IWizardView</code> and <code>Wizard</code> actually live in a separate library SWC that is included in the <code>CaptureApplication</code> project. It's also worth noting that both the FLA <em>and</em> the FB project are including the SWC. Perhaps there's a conflict? As soon as I moved all classes from the library to the project and removed the SWC from the project and FLA, it worked. </p>
  
  <p>I will have some more time to play and investigate tomorrow. Update to follow.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>I've found where my architecture is breaking. I can keep my interfaces and <code>BaseView</code> class in my library SWC just fine. The problem occurs as soon as I try to move my views (<code>AttractView</code>, etc.) from my application project into the library SWC. My libs folder is merged into code, not real-time shared. Any ideas?</p>