This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 428
TypeScript
akimgacem edited this page Jul 4, 2016
·
6 revisions
Getting started with LayaAir TypeScript
TypeScript is a free and open source programming language developed and maintained by Microsoft. Designed for development of large applications and transcompiles to JavaScript. More info at: typescriptlang
Software requirement:
-
Visual Studio 2015 or LayaFlash IDE : click on
立即下载
button to download -
LayaAir for TS : click on
TS版
button to download
Installation Guide:
-
Integrated development environment * Visual Studio 2015 :
- Go to
Macros > Edit Macros...
in tab menu - Click on
Add
Button, and choose a name (cf. LayaAir_AS3) - Go to
Entries
and enter the folowing command:
SaveAllModified
RunProcessCaptured|F:\LAYABOX\dev\tools\Laya.Flash\laya.js.exe;"$(ProjectPath);iflash=false"
- Open a sample project from our git :
layaair/samples/as/LayaAirSamples.as3proj
- Run it with
Alt+F5
shortcut or go toMacro > LayaAir_AS3
- Go to
* LayaFlash IDE :
- Go to `Macros > Edit Macros...` in tab menu
- create sample `*.laya` project
- Sample code:
- Hello Laya :
/// <reference path="../../libs/LayaAir.d.ts" />
class Sprite_DisplayImage{
constructor(){
Laya.init(550, 400);
Laya.stage.scaleMode = "showall";
var ape = new Laya.Sprite();
//Loading our monkey
ape.loadImage("res/apes/monkey2.png", 220, 128);
Laya.stage.addChild(ape);
}
}
new Sprite_DisplayImage();
- Display 2D image :
/// <reference path="../../libs/LayaAir.d.ts" />
class Sprite_DisplayImage{
constructor(){
Laya.init(550, 400);
Laya.stage.scaleMode = "showall";
var ape = new Laya.Sprite();
//Loading our monkey
ape.loadImage("res/apes/monkey2.png", 220, 128);
Laya.stage.addChild(ape);
}
}
new Sprite_DisplayImage();
- 3D display :
/// <reference path="../../libs/LayaAir.d.ts" />
class Sprite_DisplayImage{
constructor(){
Laya.init(550, 400);
Laya.stage.scaleMode = "showall";
var ape = new Laya.Sprite();
//Loading our monkey
ape.loadImage("res/apes/monkey2.png", 220, 128);
Laya.stage.addChild(ape);
}
}
new Sprite_DisplayImage();
Further more: