XTDStudios / DMT

Dynamically Mapping Textures
101 stars 13 forks source link

regular webplayer non-air support #8

Closed asaia closed 10 years ago

asaia commented 10 years ago

From what I understand this library can only be used with Adobe Air due to the File API dependency. Even if caching is turned off it still seems to make references to it and throw errors.

Is there any way to get this to work without Air?

gilamran commented 10 years ago

Now, when using DMT with cache off it will not use the File API, so now you can use DMT on the browser. In the Samples I also added a global const that mark if it's a native app.

In the future we can save the cache to the browsers local storage... If that's needed, it will be implemented.

asaia commented 10 years ago

Thanks for the quick reply.... I still can't get it to work though. As soon as I add the line: var assetConverter:DMTBasic;

I get several compiler errors in ByteArrayToFilePersistencyManager -- "Type was not found or was not a compile-time constants: File."

Seems that even if you aren't making a direct call to the File API just the inclusion of the classes creates a compiler error.

Using a conditional compilation flag (CONFIG::air) should prevent those files from ever compiling and stop throwing errors. Not sure if there's a smarter way of doing it.

gilamran commented 10 years ago

That shouldn't happend, only static reference to File can cause that, and that was fixed. Are you sure that you updated from the latest version of DMT? re-compiled it? If you can, send me a file to test.

asaia commented 10 years ago

Yes, I've downloaded the latest DMT lib.

Here's a super simple project that replicates the error. http://andysaia.com/test/DMTProblem.zip

asaia commented 10 years ago

Any update on this? I'm gonna start ripping things out :)

gilamran commented 10 years ago

I've found your problem... you included the source-code in your project... you should include it as external swc, so it wont compile all the classes. once you include the swc AND don't use any File reference everything will be fine. In FB we have separate project for each open source library that we use, and we reference this project in our project. It's a bad practice to include full source-code in your project, it's hard to update it once the developer made an update.

asaia commented 10 years ago

Uggh I should have realized that, thanks for the response.

I have to think about this though -- I ended up modifying DMT a bit, I'm attempting to add TextField conversion support, and I don't really want to re-export a swc every time a make a change to the library.

Maybe I'll continue my blindly ripping things out approach a bit longer. I'll let you know how it goes.

gilamran commented 10 years ago

You can fork DMT and merge with the main branch every time that you want to sync with the original... and you can offer your changes to DMT (contribute it) by doing pull request. read about this stuff... it's the open-source world.