How to include arbitrary data in projects (text, images, SWF)

ajgutierrex

  • Posts: 71
Quote
Would there be any ideas on how to get this working with the different 1x, 1.5x, 2x and 4x scales?

Make an image for each of the 4 scales and then choose the correct one based on the value of Engine.SCALE.

Engine.SCALE - That's just what I was looking for!, Thanks Rob!.... one more quick quesiton... does loading swf's work on iOS as well?


ajgutierrex

  • Posts: 71
oh ok, thanks for your help anyways Rob!.

If someone by any chance know whether or not this is possible, please let me know, it would be a nice to know :), Thanks!

Jon

  • *
  • Posts: 17524
SWF's only work for Flash.

It's true that NME has rudimentary SWF support for other platforms, but it's extremely limited (no ActionScript - pure animations) and wasn't even able to render a plain animation correctly.

ajgutierrex

  • Posts: 71
hmmm... I wouldn't mind the -no AS- part, but it's too bad it doesn't render animations properly, I just tried this on my current on-going  project and works really good in flash... hasn't been able to test in on Android  or anything else yet though.

QkyGames

  • Posts: 125
where I have to create the extras folder?

debug->view->view games folder?

I can not find the right place.

Justin

  • *
  • Posts: 4716
It goes in your game's folder, along with these other folders: behavior-hx, linked, resources, scenes, snippets.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

QkyGames

  • Posts: 125
Thank you.
I am now getting an error "access denied", I'm using windows 7.

Justin

  • *
  • Posts: 4716
Weird. Is your workspace in a protected directory? Try running explorer as admin. Or better yet, move your workspace directory somewhere where you have the rights to access and modify the files anyway.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

QkyGames

  • Posts: 125
like I can change the working folder? for example to "J:\stencylworks"

Justin

  • *
  • Posts: 4716
Yeah. File > Preferences > Workspace > Workspace Folder to change it.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

QkyGames

  • Posts: 125
[ERR] java.io.FileNotFoundException: J:\StencylWorks\stencylworks\games\Mummies Escape GameMazing\extras\data (access denied)

not working :(

Justin

  • *
  • Posts: 4716
What are you trying to do when that error shows up?
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

QkyGames

  • Posts: 125
when I create the folder "data" I get this error.

I want to do is:
Code: [Select]
var bytes = nme.Assets.getBytes("data/splash.swf");
var loader:nme.display.Loader = new nme.display.Loader();
loader.loadBytes(bytes);
loader.contentLoaderInfo.addEventListener(nme.events.Event.COMPLETE, function(_) {
    com.stencyl.Engine.engine.root.addChild(loader.content);
});

I get the same error if I do not put the code.
works perfect when I delete the folder "data"

Justin

  • *
  • Posts: 4716
Oh. You actually don't want to create any subdirectories within extras. All of your arbitrary files should be placed directly into extras, and then the remapping to "assets/data/" happens when you build the game.

So /[game dir]/extras/splash.swf is called with nme.Assets.getBytes("assets/data/splash.swf").
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)