フラッシュでフォルダ階層を作成しようとしています。私が持っているフォルダは
C:\ uk \ ac \ uwe \ webgames \ math
mathフォルダーには、GameMath.asという次のファイルがあります。
package uk.ac.uwe.webgames.math{
public class GameMath {
// ------- Constructor -------
public function GameMath() {
}
// ------- Properties -------
const PI:Number = Math.PI;
// ------- Methods -------
public function areaOfCircle(radius:Number):Number {
var area:Number;
area = PI * radius * radius;
return area;
}
}
}
webgamesフォルダーにwebgames_driver.flaというファイルがあります
import uk.ac.uwe.webgames.math.GameMath;
import flash.text.TextField;
// Create a GameMath instance
var output:TextField = new TextField();
var aGameMathInstance:GameMath = new GameMath();
// you will need to create a dynamic textfield called
// output on the stage to display method return value
output.text=aGameMathInstance.areaOfCircle(5).toString();
addChild(output);
//trace(aGameMathInstance.areaOfCircle(1))
ただし、次のエラーが発生します
シーン1、レイヤー'レイヤー1'、フレーム1、行1 1172:定義uk.ac.uwe.webgames.math:GameMathが見つかりませんでした。
シーン1、レイヤー'レイヤー1'、フレーム1、行1 1172:定義uk.ac.uwe.webgames.math:GameMathが見つかりませんでした。
シーン1、レイヤー'レイヤー1'、フレーム1、行5 1046:タイプが見つからなかったか、コンパイル時定数ではありませんでした:GameMath。
シーン1、レイヤー'レイヤー1'、フレーム1、5行目1180:未定義の可能性があるメソッドGameMathを呼び出します。
誰かが私が立ち往生しているcozを助けることができます、そして私は本当にフラッシュするのが初めてです