src/awayjs-full/lib/view.ts(15,65): error TS2307: Cannot find module '@awayjs/view'.
...and this:
src/Basic_View.ts(42,9): error TS2305: Module '"/awayjs-examples/src/awayjs-full/lib/view"' has no exported member 'View'.
Not sure what I’m doing wrong.
- Is there any tutorial that explains how to build a basic AwayJS example using FlashDevelop?
- Is FlashDevelp ok or should I change to Visual Studio Code or similar?
- npm install awayjs-full—save-dev
- npm install awayjs-full—save
Then I can import library in typescript source code:
import * as awayjs from “awayjs-full”;
And Typescript see all classes, but the problem is when I try to bundle compiled .js the bundle gulp task through error ‘can not find module “awayjs-full’ ‘. Javascript compiled file could not require awayjs-full. What I miss to finally let everything works together?
Sorry for my bad knowledges of javascript workflow, I understand that my question is not about awayjs usage, but I can not find any answer on google and stackoferlow. As far as I understand awayjs is extremely new for nowaday practice, that why there is no any articles with simple start. Maybe I should add a DefinitelyTyped for typimgs reposirory, or something like that?
]]>Any idea why would that be? I am attaching some snippets of code here:
Both programs initiate the .obj asset loading in that way:
this.token = AssetLibrary.load(new URLRequest('_assets/tile.obj'));
this.token.addEventListener(LoaderEvent.RESOURCE_COMPLETE, (event:LoaderEvent) => this.onResourceComplete(event));
onResourceComplete() function of broken program:
private onResourceComplete(event:LoaderEvent)
{
var loader:AssetLoader = <AssetLoader> event.target;
var l:number = loader.baseDependency.assets.length;
console.log( 'away.events.LoaderEvent.RESOURCE_COMPLETE' , event , l, loader );
for (var i:number = 0; i < l; i++) {
var asset:IAsset = loader.baseDependency.assets[i];
console.log("assetType:", asset.assetType, "name:", asset.name, "url:", event.url);
console.log("Mesh.assetType is ", Mesh.assetType);
switch (asset.assetType) {
case Mesh.assetType:
//That case never gets triggered? but it does in the other program that works?
if (event.url =='_assets/tile.obj') {
this._tileMesh = <Mesh> asset;
//some code removed for brievety sake here
}
break;
case TextureBase.assetType :
//unrelated and properly working code here has been removed for brievety sake
break;
}
}
}
onResourceComplete() function of working program:
public onResourceComplete(event:LoaderEvent) { //that is taken from one the example program that I simplified a bit
var loader:AssetLoader = <AssetLoader> event.target;
var l:number = loader.baseDependency.assets.length;
console.log('away.events.LoaderEvent.RESOURCE_COMPLETE', event, l, loader);
for (var c:number = 0; c < l; c++) {
var asset:IAsset = loader.baseDependency.assets[c];
console.log("assetType:", asset.assetType, "name:", asset.name, "url:", event.url);
switch (asset.assetType) {
case Mesh.assetType:
//That case gets triggered in that program
if (event.url == '_assets/tile.obj') {
var mesh:Mesh = <Mesh> asset;
//some code removed for brievety sake here
}
break;
case TextureBase.assetType :
//unrelated and properly working code here has been removed for brievety sake
break;
}
}
if (this.mat && this.spartanFlag)
for (var c:number = 0; c < this.meshes.length; c++)
this.meshes[c].material = this.mat;
this.view.scene.addChild(this.doc);
}
really impressed with everything so far, working my way through converting an old project.
I’ve come up against a problem though, in that previously I used .extra attributes to store a load of extra information on a generated cube, and I’m wondering how to do this in typescript..
p.extra = {
index:number,
target:number,
origX: number,
origY: number,
origZ: number,
actualX:number,
actualY:number,
actualZ:number,
parentRot: number,
imgQual:number
}
(‘p’ is a cube.)
But from that I get
error TS2304: Cannot find name ‘number’.
How would I go about this? Or would I have to make a new class which has the attributes I need? (Possibly the ‘correct’ way to go about it anyway…)
]]>Carrying on experimenting, trying to convert my old projects etc, and I’m up against a bit of a stumbling block in that I can’t export any AWD that I export from prefab3D.
Obj’s straight out of blender are fine, as are objs exported from prefab, but for some reason AWDs never load.
The supplied suzanne from the examples works fine in what I’m doing, and I assume that the rest of the awds form the examples do too.
Can’t figure it out, I’ve tried various combinations of exporting the whole scene, exporting just the selected, no materials etc but still nothing..
]]>http://away3d.com/tutorials/Away3D_TypeScript_-_Getting_Started
But now I can’t seem to do it.
I get:
Cannot compile external modules unless the ‘—module’ flag is provided.
Which makes sense to me, as I can’t see that the awayjs bits are included anywhere…
What am I missing?
]]>Are there any steps which should we follow to compile successfully typescripts to javascripts with new typescript compilers? I mean for example those examples that are in github? The newest.
https://github.com/awayjs/awayjs-examples
I tried little bit by myself but first there where some errors in Bitmap Data classes : Uint8Array , number. Second merging files with gulp doesn’t work for me good.
Thanks for any information.
]]>