1 Reply Latest reply on Nov 16, 2006 4:16 AM by parallaxed

    Import bug?

    pwp69 Level 1
      I used the Coldfusion/Flex wizard to create a simple app from a single database table

      It created a master view mxml (Users.mxml), a detail view mxml (User.mxml) and a model .as file (Useruser_tbl.as).

      I didn't like the name of the .as file so I changed it to 'User.as' and modified references to it in User.mxml accordingly.

      When the app is compiled I get an error:
      1067: Implicit coercion of a value of type com.myapp.views.detail:User to an unrelated type com.myapp.models:User. myapp/src/com/myapp/views/detail User.mxml /myapp/src/com/myapp/views/detail/User.mxml

      One of the detail view's mxml import statements is:
      import com.myapp.models.*;

      Experimenting I determined I had to use the fully qualifed package name when creating objects:

      private function initComponent():void
      this.detailObject = new com.myapp.models.User();

      Can someone explain why I have use the class's full path name when I have an import statement? Is this a bug?
        • 1. Re: Import bug?
          parallaxed Level 1
          Sounds like your compiler is getting User.as and User.mxml mixed up, which would explain why you'd need to use the fully qualified name. What namespace is initComponent() in? If its the same as com.myapp.views.detail, then the one in that namespace will take precedence. Since you're then trying to assign com.myapp.views.detail.User to "this.detailObject" (assumedly of type com.myapp.models.User), you get a coercion error.