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

QkyGames

  • Posts: 125
great, now works perfect.
thank you very much :)


RedEvo

  • Posts: 325
Any idea about not functioning Asset.getFont()?
I use this code to trying to write something but Font do not want to be displayed:

Code: [Select]
var at:ActorType = getActorTypeByName("ErrorPanel");
var font = Assets.getFont ("path/to/myfont.ttf");
var textFormat = new TextFormat (font.fontName, 24, 0x000000);
textFormat.underline = true;
var tf:TextField = new TextField();
tf.defaultTextFormat = textFormat;
tf.text = "Hello World!";
var actor = script.createRecycledActor(at, 100, 100, Script.FRONT);
actor.addChild(tf);

TextField works properly but using default font.
Thanks, David.
Launching RedemptionTCG Android Alpha. If you are interested contact us at info@redevogames.com

Jon

  • *
  • Posts: 17524
Are you sure that font.fontName has a valid value?

RedEvo

  • Posts: 325
Here you can find log line:
Code: [Select]
[LOG] [Flash] RedCcgExtension#createErrorPopup(41): Assets/data/Boopee-BoldThat is the trace of font.fontName.

I've applied the suggestions by singmajesty founded here, in the last part of the topic.

David.

Edit:
And this is the log of Font Embedding:
Code: [Select]
[LOG] - Embedding asset: [FONT] Assets/data/Boopee-Bold.ttf
[LOG] - Embedding asset: [FONT] Assets/data/calibri.ttf

Edit2:
You must add to tf:TextField this code line to permit the code embedding in TextField
Code: [Select]
tf.embedFonts = true;

« Last Edit: December 20, 2013, 07:37:38 am by RedEvo »
Launching RedemptionTCG Android Alpha. If you are interested contact us at info@redevogames.com

Jon

  • *
  • Posts: 17524
My gut instinct is that when you pass in something to TextFormat, you just want the name of the font, not the path. So if the font's name were Arial, you'd just pass in "Arial", not "/path/to/Arial.ttf".

RedEvo

  • Posts: 325
Adding edit2 of my last post to code permit to TextField to use font correctly. In other words is possible to embed Fonts and use them adding child to an actor. The only issue you must face to have the right look is about position of attached TextField: indipendently from Origin point selected in Animation attached child start from center of actor multiplied with Display multiply. Assuming (cax,cay) the coordinates of the center father actor, added child has top left coordinates in (cax,cay) x ScaleMultiplier.

To avoid this lack you can use something like that for your tf:Textfield
Code: [Select]
tf.x = -((actor.width/2) * Engine.SCALE);
tf.y = -((actor.height/2) * Engine.SCALE);


Launching RedemptionTCG Android Alpha. If you are interested contact us at info@redevogames.com

Jon

  • *
  • Posts: 17524
Per Timmy's and Max's suggestions, I'll be providing a way to overload the Preloader (and the CPMStar, Mochi, etc preloaders) using this method, so that these aspects can be customized to meet sponsors' needs without us trying to support every last use case.

Although this will be handled at the code level, ideally, a lot of this can be just handled by editing constants at the top of the source. It's adding each value to the GUI that's really "expensive", not trying to add the functionality at the code level

This will only be available to paid customers of course.


frankstein

  • *
  • Posts: 11
Im only getting sound but no animation, can you help me?

Justin

  • *
  • Posts: 4716
Subdirectories are now supported.

If a file is placed in "extras/subdir/filename.ext", you can access it using "assets/data/subdir/filename.ext".
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

champy

  • Posts: 36
Where is destination to create extras folder ?
I try to create in   C:\Users\ART\AppData\Roaming\Stencyl\stencylworks\games\pl2    (pl2 is my game) ,I  not sure that is  right place because I can't  get string from txt file.Please advise me.  :'( 

champy

  • Posts: 36
That's work,I got it.

kinglir

  • Posts: 93
Hi all,

When i call getText("pathToFile.txt") the returned data is only the first  line.
Any suggestions how to get the rest of the lines ?

thanks
zach

« Last Edit: May 02, 2014, 11:32:26 am by kinglir »

playtheHnote

  • Posts: 395
I have added a behavior to the forge to help with this. In the screen shot below it shows the custom block in action. (image 2 is the block's function)

Quote~Jon " I invite any motivated user out there to take this and wrap it up in a more usable fashion."

Is this what you were looking for Jon?

I plan to build another version that can include all major image formats, mp4 videos and maybe another thing or 2 if we're lucky. Like sounds for instance! (mp3 and ogg formats)

« Last Edit: October 01, 2014, 04:14:19 am by playtheHnote »
Check out my instrumental rock album "Hail to the Chosen One" at: https://soundcloud.com/play-the-h-note

Visit my facebook page @ https://www.facebook.com/justin.shellhorn.1
"Sound King"  now available at the forge see http://community.stencyl.com/index.php/topic,35672.0.html
for more info!

megagewinnspiel

  • Posts: 396
Hello,

I have a little problem with this method, that is pretty much the same as the code discussed here. I use these blocks:


Well the only problem is that the GIF's aren't playing at all, it just showes them as a PNG pretty much. So just the 1. frame and nothing more.

Do you know how to fix that?

Thanks alot in advance :) :) 

yoplalala

  • *
  • Posts: 1632
Soory, what's the name of the behaviour ? I am not finding it :)

I have added a behavior to the forge to help with this. In the screen shot below it shows the custom block in action. (image 2 is the block's function)

Quote~Jon " I invite any motivated user out there to take this and wrap it up in a more usable fashion."

Is this what you were looking for Jon?

I plan to build another version that can include all major image formats, mp4 videos and maybe another thing or 2 if we're lucky. Like sounds for instance! (mp3 and ogg formats)