As3里面有import,js里据说有require.js可以模拟,但我觉得最简单莫过于直接在html文件里贴script标签了
[code]










[/code]
~~~~~~~~~~~~~~~~~~~~~~
[code]
/**
* ...Person.js
* @author amyflash.com
*/

(function(window) {
function Person(name,address){
this.name=name;
this.address = address;
}

Person.prototype.sayHello = function()
{
console.log(this.name+" says hello "+Person.BUDONG);
};

Person.BUDONG="static var";

window.Person = Person;
})(window);
[/code]
~~~~~~~~~~~~~~~~~~~~~~~~~~
[code]
/**
* ...demo.js
* @author amyflash.com
*/

(function() {

/*function Person(name,address){
this.name=name;
this.address = address;
}

Person.prototype.sayHello = function()
{
console.log(this.name+" says hello "+Person.BUDONG);
};

Person.BUDONG="static var";*/
var lee = new Person("amyflash","shanghai");
lee.sayHello();
})();
[/code]
注意window.Person = Person;自执行匿名函数里加上了window变量,是为了让外面的js文件可以找到这个Person类