Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Css And Flash; I can't figure out what's wrong
Topic Started: Jun 25 2005, 01:52 PM (119 Views)
Markham Carroll
Member Avatar
Custom member title
For some reason I can't use custom tags or even <span class=""> tags in Flash and have them actually work. :angry:

Code:
 

var dataFmt:TextFormat = new TextFormat();
dataFmt.align = "left";
dataFmt.color = 0xFFFFFF;
dataFmt.font = "Arial";

var newsStyle = new TextField.StyleSheet();
newsStyle.setStyle("p",
 {fontFamily: 'Arial,Helvetica,sans-serif',
 textIndent: '24'}
);
newsStyle.setStyle("a:link",
 {color: '#0000FF'}
);
newsStyle.setStyle("a:hover",
 {color: '#4080FF'}
);
newsStyle.setStyle("note", {color: '#808080', fontSize: '-2', fontStyle: 'italic'});

// skipping a bunch of irrevelant code
 b_mP.newsHolder["news"].htmlText = "File not <span class='note'>found</span>.";
 b_mP.newsHolder["news"].setTextFormat(dataFmt);
 b_mP.newsHolder["news"].styleSheet = newsStyle;


I've tried many different combitnations of ways that the "Help" files and multiple websites say will work, but none of them actually do. :yfok:

Can anyone find what the heck I'm doing wrong here?
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
have you tried using <p> tags to set the style instead? I think I used that once and it worked, I don't know if flash supports div or span tags...
Offline Profile Quote Post Goto Top
 
Markham Carroll
Member Avatar
Custom member title
<p class=""> tags didn't work, either.
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Well... aside from the fact that I assume you've checked the "Render Text As HTML" button for the text box options, I can't see or think of anything wrong there...

All I can say is that flash is very picky when it comes to using styles... It is possible to get them going though, it just depends.
Offline Profile Quote Post Goto Top
 
BonzaiRob
Member Avatar
The Demon Plasterer
How about <P STYLE=""> and put all the code in there... it's bulky and annoying, but at least you'd get your CSS.
Offline Profile Quote Post Goto Top
 
Squidclops
Member Avatar
Guy with a hat.
I can't see anywhere that you've attached the style objects to a textField like in this way: textObj_txt.styleSheet = styleSheetObj;

I assume you've done that somewhere though.

You can get a good run down on the basics of CSS here:

click here

You shouldn't have a problem using span tags in Flash text fields.
Here is a link which lists the HTML tags supported in Flash:

click here
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Ah I see what he's done:

You've used setStyle as the very last piece of code. You need to set it before you start entering text or htmltext. :lol: problem solvered :) :P
Offline Profile Quote Post Goto Top
 
Markham Carroll
Member Avatar
Custom member title
It works now, thanks for the help! :D

I hate it when a line of code needs to be placed a certain way for something to work, and Macromedia doesn't even bother to tell you in the "help" files. :yfok:
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply