Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-14-2007, 10:11 PM   #1
davekaplan
Member
 
Join Date: May 2005
Location: chicago
Posts: 89
Default dynamic text, html, css and embeded fonts

Hi.

This is what I'd like to do:
Use an embedded font in my dynamic text box.
Load the content for this text box from an html file.
Use a stylesheet to control the styling of that text box -- for underlines and bolds.. ect.

Now that I've said -- it doesn't sound like it's possible. Or is there another approach for styling content that uses an embedded font?

Thanks very much.
Dave
davekaplan is offline   Reply With Quote
Old 03-14-2007, 11:13 PM   #2
kyuukisan
CBFrank
 
Join Date: Aug 2005
Location: Balt., MD
Posts: 18
Smile this might help

I've leaned to do this with xml data but not with html. I figure this should work for what you are trying to accomplish

in youf flash file
1) take a textArea component and drop it on the stage and then convert it to a mc.

2) go into that movie add a layer label it actions. and give the textArea an instance like mytext_mc or something like that.

3) on your action layer paste this code.

Code:
stop();
//int Textarea commponent
mytext_mc.html= true;
mytext_mc.wordWrap = true;
mytext_mc.multiline = true;
mytext_mc.label.condenseWhite = true;
mytext_mc.depthChild0._alpha=0;
//load css
inspire = new TextField.StyleSheet();
inspire.load("CSSolution_text.css");
mytext_mc.styleSheet = inspire;

//load in XML
inspireContent = new XML();
inspireContent.ignoreWhite = true;
inspireContent.load("Home_text.xml");
inspireContent.onLoad = function(success)
{
	if(success)
	{
		mytext_mc.text = inspireContent;
	}
}
in your xml file


<tag1>
<info>
<p>
put all of your HTML data here, however there are some html tags that dont function in flash.
</p>
</info>
</tag1>


hopefully this helps
kyuukisan is offline   Reply With Quote
Old 03-17-2007, 08:55 PM   #3
davekaplan
Member
 
Join Date: May 2005
Location: chicago
Posts: 89
Default cheers!

Thanks kyuukisan! A combo of me, you and the Flash 8 Bible has delivered.
I've got a dynamic text box on the stage with multiline wrap and html set in the properties panel. The font is embeded in the library so I just need to set embedFonts for the content_txt.

Code:
//------------------------------------------//
// preload for the css file
var tStyle:TextField.StyleSheet = new TextField.StyleSheet();
tStyle.onLoad = function(aSuccess:Boolean):Void  {
	if (aSuccess) {
		trace("loaded external CSS file");
		content_txt.styleSheet = tStyle;
		with (content_txt) {
			content_txt.embedFonts = true;
		}
	} else {
		trace("CSS file did not load.");
	}
};

tStyle.load("sample.css");


//------------------------------------------//
// preload html text file and set properties
var tStory:XML = new XML();
tStory.ignoreWhite = true;
tStory.onLoad = function(bSuccess:Boolean):Void  {
	if (bSuccess) {
		trace("loaded external HTML file");
		content_txt.htmlText = tStory;
	} else {
		trace("HTML file did not load.");
	}
};

tStory.load("sample.html");
I'm pretty excited about this one. I've got a nice ui scroller with mac scrollwheel awareness too.

Last edited by davekaplan; 03-17-2007 at 09:51 PM. Reason: changed story to tStory
davekaplan is offline   Reply With Quote
Old 03-18-2007, 05:27 PM   #4
davekaplan
Member
 
Join Date: May 2005
Location: chicago
Posts: 89
Default dynamic text with embedded font, css and html

I've put a bunch of stuff together. This example uses a font embedded in the dynamic text box with that same 'font name' spec'd in the css file. You could embed in the font in the library too.
See the working example.

act now for a special bonus!! macwheel scrolling included with no additional agony!

zeh, pixelbreaker and chakra media rule!

ps.. apologies if this example is a little wonky on the whitespace - ignore whitespace stuff. i'm still wrestling with using <p> tags and <br/>. Flash has a very limited CSS1 set of properties it can handle... no margin or line-spacing... so it's hard to control space before and after a paragraph... whoo party like it's 1999!

UPDATE: Go here for a more recent AS2 version of the scrolling.
http://www.actionscript.org/forums/s....php3?t=178407
Attached Files
File Type: zip dynamicHTML.zip (82.6 KB, 1119 views)

Last edited by davekaplan; 01-25-2011 at 10:42 PM.
davekaplan is offline   Reply With Quote
Old 07-29-2007, 05:19 PM   #5
the binary
Senior Member
 
the binary's Avatar
 
Join Date: May 2003
Location: berlin | germany
Posts: 960
Default

does the example work for anybody ?
changing the missing 'R Frutiger' font to an existing one, but except the image,
theres no text showing up.. ?!

html and css files were loaded correctly..

any ideas ?
__________________
8bm
the binary is offline   Reply With Quote
Old 08-30-2007, 02:21 AM   #6
davekaplan
Member
 
Join Date: May 2005
Location: chicago
Posts: 89
Default

Did you figure it out? I've been away from the Flash and as.org.
Check the font on that text box and make sure you click the "embed" button.
davekaplan is offline   Reply With Quote
Old 08-31-2007, 07:38 AM   #7
digitalnik
Registered User
 
Join Date: Aug 2007
Posts: 1
Default XML+css

Hi everyone,

I will need your help.
Im trying to load XML+css in flash - but I cant get it to work.

Here is my AS :
/////////////////////////
var my_xml = new XML();
my_xml.onLoad = function(success){
if (success){
content_txt=this.my_xml;

}
}
/////////////////////////

and here is my XML :

<?xml version="1.0" encoding="ISO-8859-1"?>
<MAIN>
<pagetitle>adsadscdasc</pagetitle>
<longtitle></longtitle>
<introtext>adscsdcdascdc</introtext>
<content><p>
aasd
f
dasf
adf asdf dasf as
</p>
<p>
f<img height="150" src="assets/images/news_8155.jpg" width="200" />
</p>
</content>
</MAIN>


thanks in advance !
digitalnik is offline   Reply With Quote
Old 06-06-2008, 11:16 PM   #8
wishin4gucci
Registered User
 
Join Date: Aug 2007
Posts: 11
Default Dynamic Text, Masking, Scrollbar, CSS, - OH MY!!!

Okay ... so I spent quite a bit of time trying to get this all to work.

Overview:

Dynamic Text box - externally load
Dynamic Text box - masked
Dynamic Text box - with CSS applied
Custom Scroll bar - for masked Dynamic Text box

Once i get it all to work (after numerous fails) I publish and try to load into another flash file.

Now the scrollbar is wonky and doesn't work ... any ideas?

I'm attaching all the project files to see if anyone else can figure out where I went wrong.

Michael
Attached Files
File Type: zip Help.zip (27.6 KB, 390 views)
wishin4gucci is offline   Reply With Quote
Old 06-18-2008, 11:41 AM   #9
leena
Registered User
 
Join Date: Jun 2008
Posts: 1
Default CSS Tools

Hi
every body
Style sheets are very popular among web developers due to their powerful features. They give you all the chance to be consistent with the look and feel of your pages. At the same time, you will have much more control over the layout and design than HTML ever did. But the necessity of CSS tools increases with the code getting complicated or for advance level of programming. There are so many CSS tools which save a lot of time and effort. Web designers want to have these tools with them always.

Css-faq.com has a large collection of CSS tools and online generators. You can us them to test font size, produce online forms, format and optimize your CSS code or generate a slide-show. It keeps adding new tools to its repertoire. Other websites can also list their popular tools here. Css-faq has also included its own CSS generators and tools.

http://www.css-faq.com/
leena is offline   Reply With Quote
Old 04-03-2012, 10:39 AM   #10
sylviu21
Registered User
 
Join Date: Apr 2012
Posts: 1
Default

It doesn't work until you change this line:
content_txt.embedFonts = true; to false.
Cheers!
sylviu21 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
dyanmic text from html, css and embeded fonts davekaplan Flash 8 General Questions 1 03-22-2007 11:12 AM


All times are GMT. The time now is 03:34 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.