Monday, 26 January 2009

Flash: Embedded Fonts in Subsets and Submovies

Ok, this entry lines up in the endless queue of Blogs, Stories and Forum-entries about the most annoying issue in Flash: Embedding fonts and dealing with external Assets/Flashfiles.

Hell, I was almost cracking. Using Gaia and trying to do it this way led me to nowhere. (more about it here and here). Despite being able to SEE the font in all submovies, applying text and a textformat-object just made all text either completely or partially disappear. No clue what and why and...

It seemed as if only one particular range of characters makes it into the Submovie. My special problem was to get the "®"-Character into the text which was added to all embedded Textfields as suggested.

Only, it wouldn't work. But then: just out of randomness I created a MovieClip-class for the elements which had the textfields in it, made all text-assignments via this class and BAM! All there suddenly, special chars, normal chars, everything nicely showing up!

To sum it up: applying text and formats in Submovies directly via the Document class: Meeeep - Njet work. Instead: Always create proxy classes by hand, make a function to apply text (i.e.: "setText") and deal with the formatting in there.

Here such a proxy class:

package com.example.views
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
* ...
* @author Me
public class CurrentItem extends MovieClip

public var titleTXT:TextField;
public var data:Object;
private var textFormat:TextFormat;

public function CurrentItem()
titleTXT.autoSize = TextFieldAutoSize.RIGHT;
titleTXT.mouseEnabled = false;
buttonMode = true;
public function setTitle( str:String ):void
setText( titleTXT, str );
private function setText( tf:TextField, str:String ):void
textFormat = tf.getTextFormat();
textFormat.letterSpacing = 0;
tf.embedFonts = true;
tf.text = str;
tf.setTextFormat( textFormat );

then use it like this in your Document class:

subItem.setTitle( "HELLO!®" );

And all your miseries about embedded Fonts are history.

Obviously there needs to be a Font.swf being loaded somewhere, sitting in the memory, having called

"Font.registerFont( _Helvetica );"

for instance. See the above link for this matter.

Thursday, 22 January 2009

Technotaliarism or "How machines could enslave us one day"

You gotta read this one (in german, make an effort!)

Wie Maschinen uns eines Tages versklaven könnten
(How machines could enslave us one day)

["...Früher streuten wir nur Gene - dann begannen menschliche Gehirne, Meme zu verbreiten: Ideen, Gedanken, Wörter. Die Evolutionstheoretikerin Susan Blackmore glaubt, dass wir mit Computern und Internet eine neue Evolution in Gang gesetzt haben, die wir eines Tages bereuen könnten. ..."]

This article really made me think. What if we face the same fate that animals are doing which we are extincting worldwide or (ab)using for our own purposes? The farmer and his cows = the Machine and us? Ok, Matrix or Terminator will remain Science fiction but I kind of have a really strange feeling about this perspective on "Evolution".

Technotaliarism is what possibly could come out on the other end of our current race towards "f*ck knows". Keep your eyes open. Those who are for total freedom of information can sooner rule us in a nastier way than anyone of us could dream of.