Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

How to share fonts in between more SWF with flash CS3

This is a discussion on How to share fonts in between more SWF with flash CS3 within the Tutorials forums, part of the Flash English category; No, I've not tried to create the textfield at runtime... But I don't want to do it... Here ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #21 (permalink)  
Old 05-11-07, 22:35
Junior Member
 
Join Date: Sep 2007
Posts: 24
Rep Power: 0
lfdesign is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

No, I've not tried to create the textfield at runtime... But I don't want to do it...

Here in the second part of this tutorial I think there is the answer to my problem... But I have to pay to access that tutorial!

Flash tutorials - Sharing Fonts in ActionScript 3.0 - Part 2: Displaying a Loaded Font in a TextField Instance - Intermediate tutorials for Flash

The first part is the same as your tutorial...

I'm starting to get crazy with this!! Why there isn't a simple solution to share a font between all swf's??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #22 (permalink)  
Old 06-11-07, 06:29
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

What's the problem ?
You can' t turn the TextField ?
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 06-11-07, 22:59
Junior Member
 
Join Date: Sep 2007
Posts: 24
Rep Power: 0
lfdesign is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

The problem is that I can only use the loaded fonts on the main SWF! If I load another swf into the main SWF (for example home.swf) I can't use the fonts on it!!

Your tutorial only works for loading a font into a single movie!! You don't say how to share that font to all the childs of that movie...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #24 (permalink)  
Old 07-11-07, 06:49
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

Ok, i think you are misunderstanding me.
I got that font from home.swf with the last commands i said.
The home_txt ( into home.swf ) has the font i loaded into main.swf !

Now, this is pure fonts sharing.
I'm not understanding what are you trying to say now...

Replay:
main.swf loads fonts.swf
main.swf loads home.swf
from home.swf i got a textformat of main.swf and i assigned it to home_txt located in home.swf.
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #25 (permalink)  
Old 10-11-07, 11:14
Junior Member
 
Join Date: Sep 2007
Posts: 24
Rep Power: 0
lfdesign is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

I'm sorry Flep... But I think i'm really misunderstanding you...

Can you make a very quick example of what you said here:

Quote:
main.swf loads fonts.swf
main.swf loads home.swf
from home.swf i got a textformat of main.swf and i assigned it to home_txt located in home.swf.
I will not annoy you anymore... Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #26 (permalink)  
Old 10-11-07, 12:55
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

no prob man, it's not annoying
Here is the sample:
Attached Files
File Type: zip ifdesign.zip (55.6 KB, 32 views)

__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !

Last edited by Flep; 13-05-08 at 20:09..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #27 (permalink)  
Old 26-03-08, 14:58
davidjmcclelland.com's Avatar
Junior Member
 
Join Date: Mar 2008
Location: Finger Lakes Area, NY, USA
Posts: 6
Rep Power: 0
davidjmcclelland.com is on a distinguished road
Send a message via Yahoo to davidjmcclelland.com
Thumbs up Re: How to share fonts in between more SWF with flash CS3

Hi Flep - thanks for this tutorial - it works for me! Much more straightforward than the convoluted AS2 hack I used.

One question that remains for me: can this solution work with a CSS approach to font selection? I would like to use exteranl CSS rather than consume it or convert it to another format in order to apply textFormat.

When I applied my external CSS (using same font names as those registered/working with adaptation of you example) the fonts no longer displayed.

Thanks again!
__________________
http://davidjmcclelland.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #28 (permalink)  
Old 26-03-08, 16:54
davidjmcclelland.com's Avatar
Junior Member
 
Join Date: Mar 2008
Location: Finger Lakes Area, NY, USA
Posts: 6
Rep Power: 0
davidjmcclelland.com is on a distinguished road
Send a message via Yahoo to davidjmcclelland.com
Re: How to share fonts in between more SWF with flash CS3

I found the answer to my question: When using CSS refer to the fonts by their regular name, not the Font.registerFont(FONT_NAME) name. When I put Perpetua in as my font in CSS it worked like a champ!
__________________
http://davidjmcclelland.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #29 (permalink)  
Old 27-03-08, 10:10
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

thx for the tip !
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #30 (permalink)  
Old 25-04-08, 22:30
Junior Member
 
Join Date: Apr 2008
Posts: 3
Rep Power: 0
James is on a distinguished road
Re: How to share fonts in between more SWF with flash CS3

Hello Flep,

First I would like to thank you for the great tutorial! I now have my font swf working!

Before I created my font swf, I had my stylesheet loaded in and textfield set to render html. However, once I loaded in the font swf, the correct font now appears, but all my bold and italic text is just normal looking text now. Is there a way to have the by font swf and have my html tags rendered? Here is my code:

public function configUI():void
{
fontLoad();
}

public function createTextField():void
{
field = new TextField();
field.wordWrap = true;
field.width = 600;
field.height = 400;
field.border = false;
field.multiline = true;
field.x = 60;
field.y = 120;
field.embedFonts = true;
field.defaultTextFormat = getTextFormat(0);

addChild(field);


var req:URLRequest = new URLRequest("css/np.css");

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onCSSFileLoaded);
loader.load(req);
}

public function onCSSFileLoaded(event:Event):void
{
var loader:URLLoader = URLLoader(event.target);
var sheet:StyleSheet = new StyleSheet();
sheet.parseCSS(loader.data);
field.styleSheet = sheet;
field.htmlText = IText(assets.commitment_txt).text;
}

public function fontLoad():void
{
var fontLoader:Loader = new Loader();
fontLoader.contentLoaderInfo.addEventListener(Even t.COMPLETE, onFontLoaded);
fontLoader.load(new URLRequest("HelveticaNeue.swf"));
}

public function onFontLoaded(event:Event):void
{
embeddedFonts = Font.enumerateFonts(false);
embeddedFonts.sort();
for(var i:Number = 0; i < embeddedFonts.length; i++){
var item:Font = embeddedFonts[i];
trace("[" + i + "] name:" + item.fontName + ", style: " + item.fontStyle + ", type: " + item.fontType);
}

createTextField();

}

public function getTextFormat(n:int):TextFormat
{
var textFormat:TextFormat = new TextFormat();
var font:Font = embeddedFonts[n];
textFormat.font = font.fontName;
//textFormat.color = 0x000000;
textFormat.size = 12;
return textFormat;
}

My stylesheet:

html {
height: 100%;
overflow: auto;
}

#flashcontent {
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
margin: 25px;
font-family: Helvetica, Arial, sans-serif;
font-size:12px;
}

h1 {font-size:20px; font-weight:bold;}
h2 {font-size:16px; font-weight:bold;}

/* end hide */
body {
height: 100%;
margin: 0;
padding: 0;
background-color: #FFFFFF;
font-family: Helvetica, Arial, sans-serif;
}



Any help would be greatly appreciated! Thank you!

James
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Flash CS3 Embedd Fonts - aiuto! Fox+ Actionscript 3.0 avanzato 3 29-08-08 21:59
Come condividere le fonts tra più SWF con Flash CS3 Flep Articoli e tutorials 1 08-06-08 15:25
Incorporare fonts nell' SWF con Flash CS3 Flep Articoli e tutorials 4 21-04-08 00:15
Emded fonts into SWF Flep Tutorials 0 03-10-07 19:41


All times are GMT. The time now is 13:27.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap