3 Replies Latest reply on Sep 22, 2006 6:56 AM by inlineblue

    Code Behind Error

      I'm getting an error when trying to use a custom compnent with a MXML/.as code behind.

      Here is the Error:

      Unable to locate specified base class 'components.StatisticClass' for component class 'Statistic'

      I have the StatisticClass.as file with the following contents:

      package components
      import mx.events.FlexEvent;
      import flash.events.MouseEvent;
      import mx.containers.Form;
      import mx.controls.Text;

      public class StatisticClass extends Form

      I have the Statistic.MXML file with the following code:


      <custom:StatisticClass xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:custom="components.*"/>

      So.. to recap, I have a package {} around my .as class component, AND I am referencing the components.* package in my MXML. How come I still get the compilation error?

      -Ned Kost
        • 1. Re: Code Behind Error
          inlineblue Level 1
          Is the file StatisticClass.as inside a directory called "components"? If so, is the parent directory of "components" in your class path?
          • 2. Re: Code Behind Error
            NedKost Level 1
            Ah, ok. I did not have the parent folder in my ActionScript classpath.

            As an aside, do I need to put the full path (down to the component directory) in the classpath? or just the path to the parent folder? I put the parent in the classpath (i.e. Temp/Reports) and it then was looking for the component folder in (C:/Temp/Reports/bin/components/StatisticClass.as). This seemed a bit odd to me..

            • 3. Re: Code Behind Error
              inlineblue Level 1
              You need only put the top-level directory in your classpath. The package name tells the compiler which subdirectories to look inside. I'm not sure at all why the "bin" directory got involved in your case.