Can’t figure out where the away3d.js bits should be for the examples?

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 13 March 2015 08:19 PM   Total Posts: 344

I previously had the examples working, by following the tutorial here:

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?

   

GrokDD, Newbie
Posted: 14 March 2015 06:46 AM   Total Posts: 28   [ # 1 ]

The tutorial you listed is a year out of date.

There has been some serious revamping since that was posted, and the library has changed dramatically.

Try this link for a sample of the most recent build.
https://github.com/awayjs/awayjs-examples/blob/master/bin/js/Basic_View.js

As you’ll notice, the script now calls individual library elements.

Also, take note that the HTML file calls for a required distribution along with your javascript file.

as you can see here.
https://github.com/awayjs/awayjs-examples/blob/master/bin/Basic_View.html

Hope that helps some, and post any examples you create for all of us to enjoy.

-GrokDD

   

Mr Margaret Scratcher, Sr. Member
Posted: 14 March 2015 09:59 PM   Total Posts: 344   [ # 2 ]

Okay, so I’m back to where I was the other night, which is that I though that the awayjs-core folder needed to be in the src folder, but if I put that in there I get the error:

src/awayjs-core/lib/base/BitmapData.ts(78,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

Both if I do it from the command line and from flashdevelop.

I did see something about passing an argument in order to fix that, but I tried without success..

   

Mr Margaret Scratcher, Sr. Member
Posted: 15 March 2015 01:07 AM   Total Posts: 344   [ # 3 ]

Sooo… I figured it out, but it seems that there’s components missing in the repos

src/Basic_View.ts(51,34): error TS2307: Cannot find external module ‘awayjs-display/lib/display/ContextMode’.

There isn’t a /display folder in awayjs-display/lib…

Keen to get back up and running on this, just had a quick play with unity 5’s export to webGL - 30mb for a basic static cube in a procedurally generated skybox.. So still a place for Away3D to rule the 3D on the web landscape smile

   

Mr Margaret Scratcher, Sr. Member
Posted: 15 March 2015 02:48 AM   Total Posts: 344   [ # 4 ]

Okay just gone through via windows cmd and git cloned the parts it was moaning about missing and got it to compile the .js…. Didn’t work when switched out for the precompiled versions but at least I got it to output something..

   

GrokDD, Newbie
Posted: 16 March 2015 07:16 AM   Total Posts: 28   [ # 5 ]

Thanks for update on how to go about it.
Might be another month before I can get back to doing some Away3d.js
myself.

Good luck!

   

Mr Margaret Scratcher, Sr. Member
Posted: 16 March 2015 12:20 PM   Total Posts: 344   [ # 6 ]
GrokDD - 16 March 2015 07:16 AM

Thanks for update on how to go about it.
Might be another month before I can get back to doing some Away3d.js
myself.

Good luck!

Okay, so finally solved it - the -out argument for tsc does not do what I would have expected.

It writes out a .js to the specified destination and with the specified filename, but it’s pretty much empty inside…

Buuut in the src folder it also compiles the .js file as expected, with the same name as the .ts source.

So, slightly annoyingly you have to remember to copy this out from here and into the bin folder.

Got it working in Flashdevelop too, so going to put together a quick quide to getting started using that as the IDE, for those of us who prefer to work that way.

I’ll keep you posted.


So I assume from you’re post that you are heavily involved in the development of away.js?

   

GrokDD, Newbie
Posted: 16 March 2015 09:58 PM   Total Posts: 28   [ # 7 ]

Oh no, I’m just learning it as it is being developed and placed on github.

I meant, I’m doing a series of home repairs and will not have time to tinker with the new library(s) for a while.

I hope your info helps others as well. Thank you!

   

EFFalcon, Jr. Member
Posted: 21 March 2015 02:08 AM   Total Posts: 44   [ # 8 ]

Keen to hear progress with this.
I’m not having any luck.

Having put all the required awayjs sources in the same folder, it’d attempt to compile.

then i had to add -target ES5 to the compiler options
now i’m back at it requesting the—module flag, seeming to be related to the event class.

   

EFFalcon, Jr. Member
Posted: 21 March 2015 02:26 AM   Total Posts: 44   [ # 9 ]

ok, adding—module “commonjs” to the build string seems to have sorted that.

   

Mr Margaret Scratcher, Sr. Member
Posted: 21 March 2015 03:16 PM   Total Posts: 344   [ # 10 ]

Yep that’s it smile

   

EFFalcon, Jr. Member
Posted: 21 March 2015 09:32 PM   Total Posts: 44   [ # 11 ]

Did you make any progress with the way the .js was being generated in the wrong folder?

   

Mr Margaret Scratcher, Sr. Member
Posted: 21 March 2015 11:55 PM   Total Posts: 344   [ # 12 ]

No, I did have a quick google, but only found other people moaning about it or trying to figure it out.

Think it’s a bug - as it is I can’t see any reason it works the way it does.

Oh, and the .js it compiles in the same folder as the src is named the same as the .ts file, only the weird useless mostly blank .js file it generates takes the name and location you specify..

Slightly annoying having to copy/paste that after every compile, hopefully there’s a fix somewhere soon..

   

Mr Margaret Scratcher, Sr. Member
Posted: 23 March 2015 12:25 AM   Total Posts: 344   [ # 13 ]

Hmmm….

Weirdly if I start a new typescript project in flashdevelop and hit compile, it outputs the .js where the -out attribute in the project settings tells it to..

   

Mr Margaret Scratcher, Sr. Member
Posted: 23 March 2015 12:37 AM   Total Posts: 344   [ # 14 ]

Sooo… I was expecting the arguments I supplied to the project settings to be the cause of it (most likely the sourcemap argument, as the mostly empty .js file has nothing but something referring to mapping), but it seems to be wokring as expected.

I’ve specified a different name, too, in case that was what was causing it but it’s outputting to the location specified..

Weird..

   

EFFalcon, Jr. Member
Posted: 23 March 2015 12:39 AM   Total Posts: 44   [ # 15 ]

Yeah i have the same result.

although if i try to compile to away project, i get a .js file thats actually typescript, a blank .js file in target location.

don’t think its compiling well.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X