0 Replies Latest reply on May 27, 2008 1:31 AM by Edward2009

    How to import other class in Flex Builder2?

    Edward2009 Level 1
      I use Flex Builder2,I want to import the other class,such as ascb,like follows:
      package {
      import flash.display.Sprite;
      import ascb.units.Converter;
      import ascb.units.Unit;
      import flash.events.Event;
      public class ApplicationExample extends Sprite {
      private var _square:Sprite;
      private var _angle:uint;

      public function ApplicationExample() {
      _square=new Sprite();
      _square.graphics.lineStyle(0);
      _square.graphics.drawCircle(0,0,2);
      addChild(_square);
      _angle=0;
      addEventListener(Event.ENTER_FRAME,move);
      }
      private function move(event:Event):void{
      var converter:Converter=Unit.DEGREE.getConverterTo(Unit.DADIAN);
      var angleRadians:Number=converter.convert(_angle);
      _square.x=Math.cos(angleRadians)*100+200;
      _square.y=Math.sin(angleRadians)*100+200;
      _angle++;
      }
      }
      }

      ApplicationExample.as is locate in direcotry C:\workspace,and I put package ascb into directory C:\workspace too,then I run ApplicationExample.as ,it raise following error:
      Description:A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.
      Resource:Converter.as
      In Folder:ApplicationExample/ascb/units
      Location:line -1

      By the way,when I write import ascb.,it should show units,but it only show util, I guess I may put package ascb into wrong director,or the ascb don't put the route of Flex Builder2. I don't know how to do it!

      Please give me detail steps to solve above error!

      Thanks in advance!