ActionScript 3.0 :: Odd Behavior With HtmlText, StyleSheet, And <a>?
Sep 26, 2008
I have a programmatically-generated text field that looks like this:
Code:
var tf:TextField=new TextField();
tf.styleSheet=styles;
tf.embedFonts=true;
tf.antiAliasType="advanced";
tf.selectable=false;
[Code]...
Has anyone else noticed this odd behavior? It's too distracting and unprofessional-looking to leave the way it is, but I'm not sure what my alternatives are if I want to include links in the text (which is imported from an XML file).
this is in Flash CS3. EDIT: If I don't embed the fonts, the "problem" goes away; however, I'm left with non-embedded fonts.
View 14 Replies
Similar Posts:
Dec 8, 2009
This bug is hard to describe, but easily reproduced with the bottom code. Just copy, paste, and compile+run in Flex 3 and you'll see the problem.
Edit: Here is a link to a running demo: [URL] In the demo, the default color of TextArea is set to red.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" applicationComplete="applicationComplete(event);">
[Code].....
View 3 Replies
Feb 21, 2011
I'm having this problem of adding an image to the textArea in RichTextEditor (RTE) on the fly and this image seems to "reset" the html properties of the textArea.
Better explained:
The user starts writing something in the TextArea (with Verdana in size:12 font settings). When he adds an image to the text area, the cursor right after the image gets very small and the font settings are reset to HUM777B in size:2.
How could I avoid this behavior?
It seems Flex adds additional HTML code before the image tag. If there was any way to avoid this I would be able to add my own settings to the tags.
View 1 Replies
Jun 13, 2011
I am working on a large project that displays a fair amount of text.how to best handle the formatting of the text globally? what is the best way to handle the text formatting on a global level ? Through the TextFormat class, through style sheets, a combination of these two depending on the specific situation ?
Is it a best practice for large projects to use style sheets for all of the texts ? Implying that all texts must be written with tags.Using only style sheets seems like the best approach at this time to me but before going into coding this approach on a large scale in my project,
View 1 Replies
Dec 6, 2009
i have set htmltext property to my textarea and need to have stylesheet on textarea. How can I do it
View 1 Replies
Feb 20, 2009
how to add a style sheet to this:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
[code]....
View 0 Replies
Aug 17, 2010
I don't know how to test this and I think I'm over thinking it, but here is the situation:Let's say I have a styleSheet that is assigned as a public static var of a Class.Then, in various other Classes, I'm dynamically creating TextFields and assigning their styleSheet property to the static styleSheet varI eventually remove those said TextFields from the DisplayObject they're on and delete all references. Even though they've been removed/cleared, are they retained in memory because they still contain reference to the static var styleSheet? i.e. should I be setting textField.styleSheet=null; before removing?
View 1 Replies
Aug 18, 2009
When I add a style to some text it seems to changed the textHeight even though there is not any extra characters in my text. When I do a test before adding the style its 16.9 height then after the style is added it goes to 31.9. why this is happening and if there is a way to stop this from happening.
Code:
label.fld.styleSheet = setCSS();
private function setCSS():StyleSheet {
var bold:Object = new Object();
[Code].....
View 1 Replies
Jun 22, 2010
I have a TextField which styleSheet i want to change at runtime.For testing I created a new .FLA put a Textfield on stage, set it to dynamic, named it mytxt and added some AS3:[code]Well nothing changed I still have a default black text when I publish the swf.My goals:
- Set a TextField in Flash IDE
- set the font, weight, color, size etc.
- apply a styleSheet containing colors for links
View 7 Replies
Sep 17, 2009
I was wondering if this can be done? I want to format my content that's in an XML file, being loaded to a dynamic text box using AS3? I've been trying to do this and find any information on the this task. When I put everything together the XML file shows up in the dynamic text box without any styles being applied to it. (As if its ignoring it.)
Code:
var cssLoader:URLLoader = new URLLoader();
var cssRequest:URLRequest = new URLRequest("content.css");
[code]....
View 3 Replies
Oct 29, 2009
I have some text fields which have to be displayed with a style I have previously loaded from a CSS document. There are two choices to choose from, but both have some hitch I cannot resolve by myself:
- If I decide to embed a font and use it along with the other CSS properties, I don't know how to associate this font to the text field, because if I do this: myTextField.embedFonts = true, no text is displayed.
- If I decide not to embed fonts, so that I use the CSS font-family property, I've checked that the text is not displayed the same way in different monitors: while in my PC it is displayed smooth and sharp, in another appears kind of jagged. Moreover the animations of non-embedded fonts are not the best option (the text must have an animation which includes a mix of fading and scale).
View 2 Replies
Dec 2, 2009
i have problem in my flash styleSheet. i add this script,
import TextField.StyleSheet;
var myStylesheet:TextField.StyleSheet = new TextField.StyleSheet();
myStylesheet.setStyle("a:link",{color:"#990000", fontSize:"12px", textDecoration:"underline"});[code]....
but its not display(output).
View 1 Replies
Jul 28, 2006
The tutorials for using CSS in Flash seem pretty straightforward, but for some reason they just don't work for me. I'm using this code:
Code:
this.createTextField("myText", 1, 100, 100, 300, 100);
myText.multiline = true;
myText.wordWrap = true;
myText.html = true;
[code]....
When I Debug>Variables, there is one line in particular that seems to be the key:
Variable _level0.myFormat = undefined
View 1 Replies
Nov 16, 2007
I am trying to attach a styleSheet to a textField. If I have a tag defined in the css file it will not show in the textField. all the other text is there just not the link (a {font-weight: bold;} is the only thing in my css file).
I tried adding a <p> tag to the text and the css - then all my text disappeared.I deleted everything out of the css file (while still attaching it to the textField in flash). and all my text showed including the link, which worked. But it naturally had no style.
View 3 Replies
Mar 13, 2008
I have a text area, content_txt, that I load html with a stylesheet into using this code:
Code:
//code for loading CSS and text into swf;
function getRotatorStyles() {[code]....
The problem is that content_txt.maxscroll always returns 1, but I know from testing that the actual value is 121. content_txt.htmlText .maxscroll, content_txt.text.maxscroll, content_txt._text.maxscroll, all return undefined. How can I get an accurate value of maxscroll for this text area? I need it to get a custom scroll bar to work correctly.
View 3 Replies
Jun 24, 2009
Is there a way of changing the styles of parts of a text using stylesheets, but without giving each part its own class? (Like you can do with setTextFormat by supplying the start and end character indexes). Or is there just another way of achieving the same result without using setTextFormat because you can't use it on a textfield that has a stylesheet applied to it?
View 2 Replies
Jan 11, 2010
How can I refresh the textfield to effect stylesheet on it. My problem is, I have to assign a StyleSheet after assigned a htmlText assignment. I mean, if you set a stylesheet after htmlText assignment it is work, but if you assign stylesheet before assignment a html text it is not effect.
HTML Code:
import flash.text.TextField;
import flash.text.StyleSheet;
var myLabel:TextField = new TextField();
var labelText:String="<span class='defStyle'>Hello world.</span>";
var newStyle:StyleSheet = new StyleSheet();
[Code] .....
View 1 Replies
Oct 19, 2010
I just created an AS3 stylesheet and applied it to a textfield, but now my <br> tags don't seem to work anymore.I tried this, but no luck:
Code:
style = new StyleSheet();
var breakspace:Object = new Object();
[code].....
View 1 Replies
Apr 4, 2011
I can't find out how to apply a stylesheet to a text field. It just does not work.This is the css:
Code:
p {
font-size: 24;
font-family: Verdana, Geneva, sans-serif;
font-style: italic;
[code]....
View 3 Replies
Dec 2, 2009
i have problem in my flash styleSheet. i add this script,
[Code]...
field1.htmlText = "<a href=[URL]>This is a link with a hover state!</a> This is some more text, just to see how it looks."; but its not display(output). what can i do for solve this problem.....
View 1 Replies
Mar 30, 2009
I found this tutorial online to load a external stylesheet to then load some text content in your box. [URL]. I applied it to my site but its not working! My settings are as follows:
stylesheet = saved under styles/flashStyles.css
text = saved under text/aboutus.txt
Dynamic box = named aboutUs_text
Here is my code. The only thing I keep seeing is 'Could not load CSS stylesheet' when I preview my .swf or when I upload it to my server.
function getNewsStyles() {
aboutUs_text.text = "Getting news...";
// load stylesheet first, then get content (separate function)
var flash_css = new TextField.StyleSheet();
flash_css.onLoad = function(success:Boolean) {
if (success) {
[Code] .....
View 3 Replies
Oct 6, 2009
i can able to create StyleSheet object , i need to save that StyleSheet object to css file(in the css format).
how can i do in flex3 Air application , is there any build in library ? Or links available to save as *.css file
View 1 Replies
Feb 26, 2010
Here is a portion of my code:
var styles:String = ".keyword{color: #ff0000;} .comment{color: #00ff00;}";
var myStyleSheet:StyleSheet = new StyleSheet();
myStyleSheet.parseCSS(styles);
myTextArea.htmlText = '<span class = "keyword"> red </span> uncolored <span class = "comment"> green text</span>';
Everything is fine till this point, i can edit my text, of course everything is showed in black, and the html-tags are ignored. But when I put this code in myTextArea.styleSheet = myStyleSheet; my text will be colored as i want it to be, but the textArea will become uneditable (no blinking pointer, no reaction on keyboard press).
After each keyboard-press (or if the time between two key-presses is bigger than x milliseconds ) i will re-render the textArea.text and append the <span class = "keyword"> where needed </span> tags and put it into the textArea.htmlText, but can't seem to figure it out how to do it when style is applied.
View 1 Replies
Jun 15, 2010
I have a few styles that I want to apply to a slider. I'm aware of the MXML method of defining a mx:Style tag
<mx:Style>
HSlider{
} .SliderHighlightTrackSkin{
} .SliderTrackSkin{
} .SliderThumbSkin{
}
</mx:Style>
Instead of doing it this way I want to define all the styles in a style sheet. I then want to define my slider in a .as file (not an mxml file) and apply the stylesheet to it. Something like the following is what I'm after
levelSlider= new VSlider()
levelSlider.minimum=0;
levelSlider.maximum=1;
levelSlider.value=1;
levelSlider.y=150
levelSlider.styleName="sliderStyle.css"
this.addChild(levelSlider)
View 1 Replies
Dec 14, 2010
I want to customize the images on increment and decrement buttons in spark numericstepper and I trying the following in my css file. But it doesnot work for spark numericstepper.
s|NumericStepper
{
downArrowDisabledSkin: Embed(source="assets/componentImages/downArrowDisabledSkin.png");
[Code].....
View 1 Replies
May 19, 2011
This works:
<mx:Image styleName="image" source="done.png">
</mx:Image>
This doesn't:
<fx:Style>
@namespace mx "library://ns.adobe.com/flex/mx";
[Code]...
View 1 Replies
Jun 5, 2007
I'm trying to put some leading on a body of text, however it doesn't seem to work after a stylesheet has been applied. Without the stylesheet it works..
Here's what im doing:
ActionScript Code:
//CSS
cssStyle = function(my_txt){
[code]...
View 1 Replies
Oct 16, 2009
I'm trying to implement way so that stylesheets can be loaded on demand: Either the default stylesheet is used, which is compiled into the application file, or a remote stylesheet (.swf) is loaded if the default styles should not be used. (each stylesheet has embedded images)
So what I would like to do is:
1) Embed the stylesheet but not load it right away. Instead, store a reference to it inside a variable. (or simply a path string?)
2) Load the requested stylesheet, for example using StyleManager
My way of tackling the problem was like this:
1) Embed the default stylesheet as
Code:
[Embed(source="assets/themes/default.theme.swf")]
_defaultThemeClass:Class;
and turn it into a StyleSheet object
2) Have a separate class decide which stylesheet to use and call StyleManager.loadStyleDeclaration(myStyle), where myStyle can either be the remote or local stylesheet.
As it seems, the StyleManager cannot load a local stylesheet. So I'm looking for a way to "activate" the style I have embedded.
View 1 Replies
Sep 11, 2010
When I add a stylesheet to a textfield, the text breaks at the endtags.Example:
Code:
var dik:Object = new Object();
dik.fontWeight = "bold";[code].....
View 6 Replies
Nov 30, 2006
I've just discovered that using a stylesheet on an input textfield renders it uneditable. Does anyone one know of a work-around? Trying to build a text editor for a backend project, but it seems to have crashed before takeoff.
View 1 Replies