How change gallery TextFormat in code? - FlashDevelop, AS3

Posted by user830441 
How change gallery TextFormat in code? - FlashDevelop, AS3
September 21, 2011 03:07PM
Hello.

How to set flash.text.TextFormat object into a slideshow gallery?

I use FlashDevelop so "Applying new fonts.pdf" is useless for me :(

I managed to set a TextFormat to a TextField, so that also display characters with accents, but I can not find an equivalent for the slideshow.

thanks
Re: How change gallery TextFormat in code? - FlashDevelop, AS3
September 22, 2011 10:57AM
You want to change the text format of the title and description texts? If yes, I'm afraid that is not possible. You cannot have access to the textfields that contains title and description texts.
Re: How change gallery TextFormat in code? - FlashDevelop, AS3
September 22, 2011 12:12PM
maybe i wrote my question wrong ...

Actualy i want to know, how to show czech characters (áčďéěíňóřšťúůýž) ...

[edit] i manage what i want to do in CS5 - now do the same in FlashDevelop ...



Edited 1 time(s). Last edit at 09/22/2011 03:32PM by user830441.
Re: How change gallery TextFormat in code? - FlashDevelop, AS3
September 23, 2011 10:19AM
FlashDevelop acts as an action script editor. If the code worked in flash cs it should work as well in flashDevelop. Anyway, you will need to use the fontName (the property needs to be added on the template that you are using and not directly on the component) property in your code .
Re: How change gallery TextFormat in code? - FlashDevelop, AS3
September 23, 2011 12:10PM
Finnaly i manage to get this work ...
for somebody else, who has same issue:

import com.jumpeye.events.SlideshowBoxEvent;
import flash.display.MovieClip;
import flash.text.Font;

public class Main extends MovieClip
{
[Embed(source = "../lib/Font.TTF", fontName = "FONT_NAME", mimeType='application/x-font', embedAsCFF='false')]
public static var FONT_CLASS:Class;

private myAlbum:SlideshowBox;

public function Main() {
Font.registerFont(FONT_CLASS);

myAlbum = new SlideshowBox();
myAlbum.addEventListener(SlideshowBoxEvent.TEMPLATE_CREATION_DONE, onTemplateCreated);
myAlbum.template = GetTemplate();

addChild(myAlbum);
}

function onTemplateCreated(e:SlideshowBoxEvent):void {
myAlbum.template.fontName = "FONT_NAME";
}
}
Re: How change gallery TextFormat in code? - FlashDevelop, AS3
September 26, 2011 08:57AM
Thank you for sharing the solution here.
Sorry, only registered users may post in this forum.

Click here to login