I creadet a class that has more ResourceBundles in it. My app is multilanguage so I will need many ".properties" files.
here is a sample code
[ResourceBundle("LocalizedStrings_en_US")]
[ResourceBundle("LocalizedStrings_fr_FR")]
...
public class LocaleLoader
{
...
}
My question is if I add many ResourceBunlde lines in this class, will the file size of the main swf increase drastically or not?
Should use separata class files to load separate ResourceBundles for each language?
The [ResourceBundle] annotation itself won't have any effect on the file size. It's the -locale compile option of the mxmlc that matters.
-locale=en_US means to embed only the US-locale in the SWF
-locale=en_US, ja_JP means to embed both the US-locale and the Japan-locale
If you don't embed the Japan-locale you can load it at runtime with resourceManager.loadResourceModule(...).
To address completely the topic of Flex Localization Support please refer to the Slides & Samples in the Flex Localization Support article I wrote in the Obecto Training Portal.
Related
I have made an animation with Adobe Animate CC as HTML 5 canvas item. I can publish the animation in several ways:
as html: 1 file html, 1 file js, several directory with included file. Pages are all inclusive (head, body, including libraries) and including it in a Ionic page means unpack the html (right?). I'm trying but it seems a bit complex.
as movie .mov, but it's a bit expensive in terms of file size
In both cases, i'm not sure how to include the published result in a Ionic page and I think I'm missing something.
So, how do I include a Adobe Animate CC animation in a Ionic 2 Framework page?
UPDATE: I tried to unpack the html. Tried publishing the animation as HTML5 animation, with the publish setting "Included javascript in HTML". This way all the necessary js is put inside the html file that the publish procedure outputs. Then I took that js (the one contained in
<script> some js here </script>
immediately after the import of the library createjs) and put it in a mylibrary.js file in /assets/js/mylibrary.js. This way, I was able to import it in the ts file of one ionic page like
import mylibrary from '../../assets/js/mylibrary'
and then try to initialize the animation like
ionViewDidLoad(){
mylibrary.init()
}
In the original file the init() function was called on body like
<body onload="init()">
Unfortunately it doesn't work. The error thrown is
cjs.Bitmap is not a constructor
that is not really important as error, if not to state that clearly the library createjs is not imported in the right way for it cannot associate its cjs variable of mylibrary.js that contains a function like
(function (lib, img, **cjs**, ss, an) {
… (all code here)
})(lib = lib||{}, images = images||{}, **createjs = createjs||{}**, ss = ss||{}, AdobeAn = AdobeAn||{});
to createjs variable of the library. I mean, commenting the cjs.Bitmap line, it starts complaining about the subsequent cjs.Rectangle that does not exixts.
So I tried to include the library, first taking the include from the Animate generated html
<script src="libs/createjs-2015.11.26.min.js"></script>
and put it in my main 'index.html' app file (copying in asset/js the directory lib containing the file). Did not work. Tried with the live version of the library
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
Did not work.
Tried even to add all the other (unecessary library linked to createjs like easejs etc https://code.createjs.com/). Did not work.
Then I tried adding the library in the ts file adding before the import of mylibrary
import createjs from '../../assets/js/createjs'
Did not work.
Even tried to npm install createjs, createjs-module and createjs-easeljs and import them.
import easeljs from 'createjs-easeljs';
import createjs-module from 'createjs-module';
import createjs from 'createjs';
Guess what? Did not work.
Any time I said "did not work" the problem was ever the same error "cjs.Bitmap is not a constructor". Presently I couldn't find a way to import an animation generate via Adobe Animate CC into Ionic.
Just for people passing by, not an elegant solution, but at least one.
You can save in Adobe Animate your animation as video ('mov' file) and optimize its size and format with Adobe Media Converter or whatever other program you like. I've converted it in mp4 in this case.
NB: When you publish the video, if there is an audio track, it will be included in the video only if beginning at the second frame of the animation. It is a little tricky to discover, so worthy to be said.
As soon as you have an 'mp4' file, add it to your app assets, and you could include it to a Ionic page in the classical html way. In my case, it was a video to play fullscreen so here it is my code:
<ion-content padding>
<div id="videocontainer">
<video fullscreen="fullscreen" autoplay="true" (ended)="onVideoEnded()">
<source src="assets/video/your_video_name.mp4" type="video/mp4">
</video>
</div>
</ion-content>
With the launch of SolidWorks 2016, Dassault Systèmes has promoted a new web portal that enables the embedding of Edrawings models into web pages: 3dcontentcentral.com.
Their web 3D viewer uses WebGL to show model inside a browser window (here you can find a live example). Moreover, there is the possibility to embed an iframe with the viewer to embed it onto another web page, like the following:
<iframe scrolling='no' frameborder='0' allowfullscreen='true'
src='http://www.3dcontentcentral.com/external-site-embed.aspx?format=3D&catalogid=364&modelid=1254&width=250&height=250&edraw=true'
name='PreviewFrame3D' id='PreviewFrame3D' width='400' height='355'>
</iframe>
<br/>
<a href='http://www.3dcontentcentral.com/download-model.aspx?catalogid=364&id=1217'>
Download</a>
The final result is something like the following:
Full screen example
So, is there any chance to export a 3D model (part) in the same way and embed as a WebGL without uploading into 3D Content Central website? I have also access to the Edrawings/SolidWorks SDK (2015), if it could be helpful in any way.
How to convert a SolidWorks file into a WebGL JSON file
The best solution I came across is simply to use SolidWorks Visualize (formerly Bunkspeed) to export the geometry and the materials using a combination of OBJ and MTL files.
Then, you'll be able to import it into a WebGL scene using the Three.js/OBJLoader. A big problem that can arise is the dimension and the memory required to load the exported file. To solve this latency/memory problem you can then convert the exported OBJ files into Three.js JSON format using the three-obj and minifying them using the minify() method. After that you'll have to load the minified files using the Three.js/BinaryLoader.
Hope this can help someone else.
Have a look at the WebGL 3D model viewer using three.js guide at http://www.radiatedpixel.com/wordpress/2013/03/27/webgl-3d-model-viewer-using-three-js/
Export the obj file from SolidWorks.
It should be straight forward to add your own controls via JavaScript.
I just started with Minko and trying to undestand this https://github.com/aerys/minko/blob/master/doc/tutorial/06-Loading_3D_files.md tutorial. I did some steps:
sceneManager->assets()->loader()
->queue(FIREAXE_D)
->queue(FIREAXE_N)
->queue(FIREAXE_S)
->queue(TEXTURE_FILENAME)
->queue("effect/Basic.effect")
->queue(OBJ_MODEL_FILENAME);
and now I am trying to use these three textures with my object and file .mtl -> material.
auto _ = sceneManager->assets()->loader()->complete()->connect([=](file::Loader::Ptr loader)
{
auto objModel = sceneManager->assets()->symbol(OBJ_MODEL_FILENAME);
objModel->component<Transform>()->matrix()->appendScale(0.01f);
objModel->component<Transform>()->matrix()->translation(-1.f, -1.f, 0.f);
objModel->component<Texture>()->set(sceneManager->assets()->texture(FIREAXE_D));
//objModel->addComponent(sceneManager->assets()->texture(FIREAXE_N));
//objModel->addComponent(sceneManager->assets()->texture(FIREAXE_S));
root->addChild(objModel);
});
This won't work and what about .mtl file? How to attach it to my object?
However tutorials are still to tiny and buggy it is better to look for examples but I cann't find any with texture loading for object right now.
This won't work and what about .mtl file? How to attach it to my object?
Your question is about loading a Collada (*.dae) file. Collada files don't have *.mtl files, *.obj files do.
Still, it works the same for any dependency of any file: they are automatically loaded if they can actually be found at the provided path/URI.
You can add include/search paths using the file::Options::includePaths() property, or customize how URI are resolved by using the file::Options::uriFunction(). Many other properties of the file::Options class will help you customizing how assets are loaded.
However tutorials are still to tiny and buggy
If you find bugs please open an issue on github.
it is better to look for examples but I cann't find any with texture loading for object right now.
The following example loads a Collada file along with animations and textures:
https://github.com/aerys/minko/tree/master/example/assimp
I want to implement a help system for my tiny SWT desktop application.
I've thought about a SWT browser widget containing a single html markup page and a set of anchors to navigate (there are only very few things to explain).
Everything works fine, but how do I load the html file from a jar?
I know aboutgetClass().getClassLoader().getResourceAsStream("foo");, but what is the best practice when reading from the input stream? The answer to Load a resource contained in a jar dissuades using a FileInputStream.
Thanks in advance
Well, I found a rather simple solution that obviously just works:
InputStream in = getClass().getClassLoader().getResourceAsStream("html/index.html");
Scanner scanner = new Scanner(in);
StringBuffer buffer = new StringBuffer();
while(scanner.hasNextLine()) {
buffer.append(scanner.nextLine());
}
browser.setText(buffer.toString());
i tend to use commons-io for such a task giving me simple abstraction methods like IOUtils.toString(InputStream in); and leaving the choice of best implementations to the able people at apache ;)
commons-io: http://commons.apache.org/io/
apidocs: http://commons.apache.org/io/api-release/index.html
In the past, there was a simple trick, to include the flex mxmlc module by adding the following line to the flash-cs4 makefile:
-include-libraries “/absolute/path/to/my/assets/assets.swc”
This gave you the ability to use getDefinitionByName, an helper function to access the embedded swc asset-library (instead of creating hand-written classes all assets).
Unfortunately, this has stopped working since flash-cs4. Does anybody know another solution?
Unfortunately, the only workaround I have found is to explicitly refer each of asset classes somewhere in the code. You may create dummy class like this:
public class AssetsExporter extends Sprite
{
public static function export()
{
AssetClass1;
AssetClass2;
//etc
trace( "DEBUG AssetsExporter.export()" );
}
}
Specify this class as Document class in Flash IDE, so it will be compiled into the resulting swc. Then in the main code of your application call
AssetsExporter.export();
After doing this you will be able to use getDefinitionByName().
You can add them to the libraries in the publish settings.
(Image from http://wiki.gigya.com/ via Google Images)
By the way, if you use SWC files, you can also do
new somepackage.SomeClass();
instead of
new getDefinitionByName("somepackage.SomeClass")
where applicable. This is because SWC files are included at compile time, not runtime.
Even though you can change a compiler setting manually, its easy if you are using FlashDevelop as this is very simple to fix.
Right click your included swc from the Project list. Choose options then "include library (complete library)".
..you can now use getDefinitionByName to get an unreferenced class from your swc file.