ActionScript 3.0 :: Textformat Error And Style Sheets
Aug 31, 2010I get this error when I call a function.Error: Error #2009: This method cannot be used on a text field with a style sheet. at [code]I'm using styles, not textFormat.
View 1 RepliesI get this error when I call a function.Error: Error #2009: This method cannot be used on a text field with a style sheet. at [code]I'm using styles, not textFormat.
View 1 RepliesI have an external style sheet, and it looks great, but it "flashes" the unstyled content prior to applying the style.
PHP Code:
[code]...
I am working developing a big project and I have a question regarding the formatting of the text, project wide. Is it a good idea to format all of the text using style sheets ? Including here, buttons labels, headers, and so on.
Or is it a better idea to use a combination of style sheets and the TextFormat class depending on the situation ?
Using style sheets project wide seems like a good idea but there might be things that I am missing and I would like some advices from people with more experience.
I am working developing a big project and I have a question regarding the formatting of the text, project wide. Is it a good idea to format all of the text using style sheets ? Including here, buttons labels, headers, and so on. Or is it a better idea to use a combination of style sheets and the TextFormat class depending on the situation? Using style sheets project wide seems like a good idea but there might be things that I am missing and I would like some advices from people with more experience.
View 6 RepliesSite loads two flash files at the same time with multiple dynamic text fields that load .html files with external css style sheets. The site works almost perfectly when viewed offline, but when you upload it the text boxes sometimes load and sometimes do not. I'm a graphic designer so I really don't know actionscript 3.0 (or any version) very well... so I'm attaching the footer .fla file which by itself suffers from the same problem, and the other files are too big to upload so here is the link to the other .fla file used on the homepage
View 3 RepliesI'm trying to autosize my combobox, according to the textWidth of its biggest items. I've got the right textWidth without setting the textFormat, but by setting textFormat, with a bigger font size (like 30), the textWidth stays the same !
Code:
var myFormat : TextFormat = new TextFormat("Trebuchet MS", 30, 0x0000FF);var myCbx
myCbx= new ComboBox ;
myCbx.x = 0;
[code]...
I've been struggling with this problem for a while:I have a string containing HTML and I'm using a regular expression to get the characters between the tags. I'm then attempting to apply a TextFormat to those characters.The problem is that I'm using the TextField's "htmlText" property instead of it's "text" property (because I don't want the HTML tags to be visible). So, the character index that's returned from the regular expression is incorrect, when I apply the TextFormat.Here is some sample code which illustrates the problem:
var txt:String = "<b>Sample</b> string with bold text";
var tf:TextField = new TextField();
addChild(tf);
[code].....
Because I want to avoid repetive code, and I'm using a lot of text formats, I created a CustomTextFormat class in Flex Builder.
Another class, called CustomInputBox.as is using this object to create a format:
package
{
import flash.display.Sprite;
[Code].....
I am facing an animation error while i applying tint style on component.when i am passing paramenter values in second component by refrencing first component name and then applyng tint style on it but when i compile it, the first component tint syle is working fine but as it comes on second component it get stuck & the second component appears 80% transparent.
View 1 RepliesI keep getting this errors when i put the style in (texts in red)
for (var i:int = 0; i < 49; i++)
{
txtSong.appendText(sname(_xmlList[i]["songTitle"] + " "));
txtSong.appendText(sartist(_xmlList[i]["songArtist"] + "
"));
}
why is it not working?
I'm developing a flash game and I hired a graphic designer to make it look more professional. The problem is that I don't know if I should use timelime animations or sprite sheets.Here is an example of his graphics:[url]...
How should I proceed for better performance? Also, if I just split the sprite sheets in many images, put them on an array and keep using add/removeChild() on them will it work properly when talking about performance?
Im trying to create animations for use in sprite sheets for xna but am having some problems with exporting png seqeunces from flash with alpha.I know that if everything is on the main timeline then using the export as png seqeunce with alpha works fine, but when there are movieclip symbols on the main timeline, which themselves are animations, the movie symbols simply remain at their first frames on export.
View 2 RepliesI have an AIR application with two DataGrids that I would like to export to Excel. I've found the as3xls library, but it can only handle one sheet (as per the comments). Ideally, I'd like to export both DataGrids into separate sheets in the same workbook.
The AIR application is running entirely on the user's desktop and doesn't have a connection to any server, so the solution would need to be Flex/AIR only.
My client wants spec sheets to be downloaded from his website... is there a tutorial what will give me the low-down?
View 14 RepliesI would like to use Bitmaps in my Actionscript games.For me this represents a large change in my workflow as I have always used Vector but Bitmaps are really so much faster to render in certain circumstances. As far as I can see, 90% of all my game assets can be bitmaps.Firstly, are there any good tools for working with Vector to BitmapData? Libraries or OpenSource utilities?I know you can just draw to a BitmapData, and I do that, but what about Animations? What about a MovieClip of a laughing cow? How can I render that MovieClip at runtime to some kind of Bitmap version?But more complex than that What about situations where you do not have the MovieClip in a raw form?Imagine 10000 cogs turning at the same rate which is generated with code. This is hard work for the processor, so drawing it to a Bitmap for the duration of 1 revolution, would replace 10000 cogs with a SpriteSheet. I could destroy the cogs, and keep the SpriteSheet. Can anyone offer me any resources or google keywords I can search for, not sure of the technique but it seems to make sense? Especially with Starling..
View 2 RepliesOn my Mac OS X it didn't matter, the setStyle Worked Fine,However I've transfered my files over to PC and working with the exact same things all the styles work EXCEPT for the setStyle("themeColor", "color");On this PC it's always turning it from the default "Greens" to a solid gray shade of borders, this is very weird.
For Example
Code:
// Have a button component on stage
import mx.controls.Button
_global.styles.setStyle("themeColor", "haloOrange");
[code]....
It works just fine, do I need to edit the core class files for something? I'm extremely confused, I inport the class files in the first place so I can do public vars and strict data type them to that component.
I've got a comboBox component on the stage, instance name 'combo'. I want to style the text. I followed the adobe instructions, but they seem not work, and I get no errors.
Code:
import fl.data.DataProvider;
import flash.text.TextFormat;
var tf:TextFormat = new TextFormat();
[code].....
I have a menu and i need to replace the style of the menu to another menu but everything out of the style will be the same...
View 1 RepliesI 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,
my code is correct, but anyhow, anyway my textformat does not work, examine follow codeDidnt see what i did wrong.
//SCROLLING SPEED
var scrolling_speed:int = 2;
//TEXT TO SCROLL
[code]......
Im new to As3 and theres an issue thats driving me crazy. I need to know the name (or reference) of a TextFormat and I cant seem to do it.
Heres some of the code
ActionScript Code:
var f:TextFormat=tf.getTextFormat();
trace ("f.size"+f.size)
trace("****** "+f as String);
Basically I need to find the name of the textformat, which when I created i named like this:
ActionScript Code:
// for example "menuTextSmall"...
var nombreFormato:String = formatosXML.estilo[i].@nombre;
global.formatos[nombreFormato]=new TextFormat();
I have my formats in an xml file with name, attributes, etc. I can get the properties of the TextFormat but I dont know which TextFormat it actually is!!
I'm setting the style of a textfield selection like [code]...
I tried searching, but Google ignores brackets, so I can't search the output shown
I have an text field set as HTML and Im pulling in some text from XML and I can't figure out how to use textformat HTML tag with tabstops, here is XML:
ActionScript Code:
<![CDATA[<textformat>Name Surname Nickname</textformat>]]>
I want all to be separated like so(100px between Name & Surname and 150px between Surname & Nickname):
Name 100px Surname 150px Nickname.
How to do this? I guess I would have to do something like:
ActionScript Code:
<![CDATA[<textformat tabstops="100,150">Name Surname Nickname</textformat>]]>
I've created a price updater project to retreive the foreign exchange rate and reload for every 2sec. However, the exported swf only working under firefox and Chrome, but not IE. I had also tried to embedded teh font inside, but still not be able to work out
[Code]...
Forgive me if this is an obvious one but it has me a bit confused. I have the following sample:
Code:
import flash.display.Sprite;
import flash.text.TextField;
[code].....
This is a bit of code that lets the user click somewhere and type in some text. Everything in my code works except I can't seem to set the text format. It defaults to Times New Roman. Do I need to embed the fonts or something?
Code:
i = 0;
mcDraw.onPress = function() {
i++
[Code].....
...when i set the textField with new text eg:
var tf = new TextField();
var myFormat = new TextFormat();
//set textField format
[code].....
I have created a new textFormat for some dynamic text that is loaded into a textfield. Is there a way to change the style of the text when hovering over it?
View 2 RepliesI've recently started to learn/use AS 3.0 and am now exploring the use of external custom classes.I have an fla with a text field in place. I want to write an AS 3.0 class in an external .as file which sets a text format, and apply that format to the text field in the fla file - how do i so this?
View 2 RepliesI want the font size of a dynamic text box to change according to the number of characters of the input text. The user types in whatever (up to 50 characters long), then hits an update button to see it in the dynamic text box. But since the dynamic text can only be a single line within a defined area with no horizontal scrolling.
Here's the code I'm having a problem with:
Code:
updateBtn.addEventListener(MouseEvent.CLICK, updateIt);
inputText.maxChars = 50;
function updateIt(event:MouseEvent):void{
[Code]......