PDA

View Full Version : How to import other class in Flex Builder2?


EdwardKing
05-27-2008, 08:24 AM
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(Uni t.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 directory 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

Why raise above error?

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 directory,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!

saravanan
05-27-2008, 02:36 PM
hi paste the folder ascb near the file.mxml and try