Compiling AS3 program issue with .ttf file in library - actionscript-3

I am getting an error trying to compile an AS3 project:
Error: Unable to transcode ../lib/Arial.ttf.
Original Code:
[ Embed(source= "../lib/Arial.ttf", fontName = "ArialFont", advancedAntiAliasing="true", embedAsCFF="false", fontWeight = "bold", mimeType="application/x-font")]
private var ArialFontClass:Class;
I know very little AS3 so was hoping this was any easy fix with respect to font types or that someone could at least point in a direction to investigate.
Do I need to find a particular folder and look for a file? If I don't have it where do I get it? Any guidance greatly appreciated.

Some things to check:
is your source path correct?
does that Arial font actually contain bold glyphs? It may help to remove the fontWeight attribute or switch the source to an actual bold version of the font.

Related

How to load .dae object with texture, and material

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

JWPlayer in Drupal has container ID starting with Numeric Character

Following up this question on SO, I am looking to change the default DIV container name that JWplayer provides to JWPlayer Div. The problem is that it starts with a numeric and that creates loading problems.
Is there a way, I can customize this JWPlayer ID ?
This is how it looks btw,
jwplayer('141ef7fe77391234fc105767808cc0a5').setup({"file":"my_video.mp4",
"width":"838","height":"383","controlbar":"none",
"modes":[{"type":"html5"},{"type":"flash","src":"http://path/jwplayer/player.swf"}]});
While you're at it, here is a quick solution to it.
Since this is a fix for Drupal JWPlayer Module, do the following:-
Go to jw_player module folder and open theme folder.
Open jw_player.tpl.php and add the following line on top (probably where PHP declaration starts).
$html_id = "myvideo". $html_id;
It kinda does the job but I am sure you guys have better solutions than this. Please feel free to comment.
Found a better solution
Don't do upper suggestion. Paste the following code in jw_player.module instead.
Find this line $variables['html_id'] = md5(rand()); (I guess line 308) and uncomment it before pasting the following code instead.
while(1) {
$variables['html_id'] = md5(rand());
if (ctype_alpha(substr($variables['html_id'], 0, 1))) {
//echo "First Digit is Alphabet";
break;
}
}
Thanks.

How to embed a font using FDT (AIR SDK 3.9) embedAsCFF="false" not recognised

I'm attempting to embed a font using FDT. I notice that FDT doesn't recognise the embedAsCFF="false" parameter.
(see: http://bugs.powerflasher.com/jira/browse/FDT-1853?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aworklog-tabpanel )
I'm doing something like this:-
[Embed(source="fonts/RobotoCondensed-Light.ttf", fontFamily="RobotoCondensedLight", embedAsCFF="false")]
tf.embedFonts = true;
tf.htmlText = '<font face="RobotoCondensedLight">Hello</font>';
Without embedAsCFF, no text appears. But RobotoCondensedLight is listed in Font.enumerateFonts()
With embedAsCFF - I get a compile errors: exception during transcoding, unable to build font 'RobotoCondensedLight', and Unable to transcode fonts/RobotoCondensed-Light.ttf.
I assume the problem is the embedAsCFF parameter - or is it something else?
How are people embedding fonts with FDT?
«I notice that FDT doesn't recognise the embedAsCFF="false" parameter.»
Well, I think that's the issue.
As of Flex 4, you do need to set embedAsCFF to false for embedded fonts to work.
If FDT doesn't allow you to use it, you may want to give a try to a different IDE.
It turns out that the solution is to use the ASC 2.0 compiler. While it doesn't work with the old compiler (and apparently, it doesn't work from the command line either) - but the new compiler fixes the problem.

AS3 font embedding - Error message

I would like to embedd a font with AS3 using the "swf method".
The error I get is:
Font "myFont" could not be created
../assets/swf/myFont.swf cannot be transcoded.
As per Google this problem is because of a path-error.
But I think I set the right path, didn't I?
My folder structure
main.fla
../com
..../subfolder
....../testButton
......../testButton.as
....../assets
......../swf
........../myFont.swf
in my testButton.as I'm trying to embedd the myFont.swf:
public class testButton extends Sprite {
[Embed(source="../assets/swf/myFont.swf", fontName="myFont",
fontWeight='bold', mimeType="application/x-font")]
private var myEmbeddedFont:Class;
In the main.fla I'm creating an object of the class.
Just convert the original font file into a .otf and install it. Flash will detect it and you'll be able to use it like a normal font without the embedding.

Embedding fonts: "Font with plain weight and style was not found at..."

I am trying to embed a font in my Flash Builder 4.6 project, so far unsuccessful.
I searched around and found this fix, adding "-managers flash.fonts.AFEFontManager" to the Compiler, doesn't work. I've embedded tons of images to the same project, but I'm not sure what's going on with the embedding of fonts.
I get this error:
Multiple markers at this line:
-unable to build font 'Chinese Rocks Rg'
-exception during transcoding: Font for alias 'Chinese Rocks Rg' with plain weight and style was not found at: file:/E:/StarlingIntro - >Finished/src/../assets/textures/chinese_rocks_rg.otf
-Unable to transcode ../assets/textures/chinese_rocks_rg.otf.
For the following code:
[Embed(source="../assets/textures/chinese_rocks_rg.otf", fontName="Chinese Rocks Rg", fontWeight="normal", advancedAntiAliasing="true", embedAsCFF=false, mimeType = "application/x-font")]
public var ChineseRocks_FontClass:Class;
public var chineseRocks_textFromat:TextFormat = new TextFormat("Chinese Rocks Rg");
What do they mean was not found? It's the same path as everything else I've embedded. Does it mean that it's expecting a certain "style" from the .otf file? Wut?
Thanks for any info on this!
PS: it gives the same error for other fonts as well, for example MyriadWebPro.ttf.
[EDIT]
Okay, here's what's going on. I am using this embed code right now:
[Embed(source="chinese_rocks_rg.otf", //yes, it's in my src folder because I'm paranoid
fontName = "myChineseRocks",
mimeType = "application/x-font",
fontWeight="normal",
fontStyle="normal",
unicodeRange="englishRange",
advancedAntiAliasing="true"
)]//embedAsCFF="false"
I have commented out the embedAsCFF, because I tried it with the -managers=flash.fonts.AFEFontManager compiler parameter. None of the two work.
This is in Flash Builder 4.6, using Flex SDK 4.6.0. Now, if I switch to Flex SDK 3.6.0, the error seems to go away, but I can't use 3.6.0 since I'm using the Starling Stage3D framework.
Is it possible that stuff changed from 4.0 to 4.6, and now your article, Divillysausages, (which really illuminated me btw) doesn't apply to it?
[EDIT2]
I solved it! With the help of Divillysausages and his patience :).
Basically, I was completely stupid. I had a "#" and 2x" ` "s in the actual path to my project. I KNEW having those dumb folder names would screw my stuff up some day! And sure enough it did -with Java, but I moved Eclipse out of there a long time ago and forgot about it.
Anyway, I moved the flash project to a more friendly directory and included the embedAsCFF="false" and it worked.
Also, having -managers=flash.fonts.AFEFontManager in your compiler arguments or not, seems to not matter.
fontWeight="regular", doesn't exist. You're probably looking for fontWeight="normal" (or "bold", or "heavy")
Basically what your error is telling you that in the font you're trying to load, it couldn't find the weight "regular", so it can't be embedded.
I wrote this a while ago to explain font embedding, it might help: http://divillysausages.com/blog/as3_font_embedding_masterclass
Be sure you are not overwriting the default flex config file. If you need some config property append them in Additionnal compiler arguments : -load-config+=configFile.xml rather than -load-config configFile.xml It solve our trouble
I had the same issue embeding .otf font to starling project.
Resolved it by converting the otf file to ttf
Good luck