ActionScript 3.0 :: Attributes For TextFormat Variables?

Apr 21, 2011

I create a TextFormat variable like so:

ActionScript Code:
textBox1_fmt = new TextFormat();
textBox1_fmt.color = 0xFFFFFF;
textBox1_fmt.size = 22;

What I would also like to change though is the font family to Lithos Pro and set the alignment to the right. Do you need to embed the fonts? If so, then how?

I then draw a TextField onto the screen like so:

ActionScript Code:
textBox1_txt = new TextField();
textBox1_txt.text = "example";

[Code]....

otherwise it reverts to some default setting. How can I change this default setting?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Using XML Attributes With TextFormat Properties?

Jul 22, 2011

So I'm experimenting with using XML in Flash, but I'm confused as to how to use the properties in an XML tag and assign it to a TextFormat property.

My XML:

Code:
<mytitle fontsize="100" fontface="Tw Cen MT">Embracing the Zeroes</mytitle>

I know how to access the fontsize property's contents, like so:

ActionScript Code:
var myTitleSize = myXML.mytitle.@fontsize;

And I'd like to use it this way:

ActionScript Code:
var myFormat:TextFormat = new TextFormat();
myFormat.size = myTitleSize;

But it doesn't change the property in my output SWF...

View 4 Replies

ActionScript 3.0 :: Adding Variables To A XML Object's Attributes?

Sep 22, 2009

I've created and XML object that's working fine and I want the user to be able to add to the XML dynamically, using an input text field and appendChild() So, what is the syntax to use so that I can put in the text they enter as an attribute of a node of my current XML object? Here's what I've got for adding to the XML (stripped down obviously):

ActionScript Code:
var xmlData:XML = new XML();
var clientToAdd:String = userInput.text;
xmlData.appendChild(<project name=clientToAdd></project>);

How can I take the variable clientToAdd and make it the attribute "name" of the "project" node?

View 5 Replies

ActionScript 3.0 :: Object Attributes From XML / Sub-attributes

Jun 29, 2009

I am dynamically creating a number of objects (movieclips) which all have a number of attributes.[code]and so on. i.e sub attributes. I don't think this is possible? Only sprite and movieclips can have dynamic attributes so unless atrbY is a movieclip (which it isn't, it's a string) it isn't allowed?Each object can have suboptions with further attributes associated with the chosen suboption.Later in the program I will manipulate, read and interact with the objects and they have text display behaviours dependent on the suboption chosen. That part (should) be straightforward! heh. One the object has the attributes attached in a usable format, accessing them should be simple.This will be for a store. i.e t-shirt1 has size small, price 10, size medium, price 12, size large, price 14. t-shirt2 has size medium, price 35, size large, price 40 and so on.[code]

This format of the XML can be adjusted if it would make the parsing easier.I am currently reading the XML in, stepping through, grabbing the individual parameter such as category and then adding it as an attribute of the object and it works fine. i.e. I end up with obj.category = 'catname'. However, on suboptions I am having a problem.Should I put all the suboptions in a multidimensional array and use nested loops to apply them to the object?I would still have the problem of objX.suboptionarray[Y].suboptionprice which isn't allowed? In the above XML case Y would be 0,1 and 2 giving 3 suboptions to objX and each suboptions would hold attributes such as pvid associated with that suboption.I could go down the horrible route, obj1.suboption1subptionprice ; obj1.suboption1suboptionpname; obj1.suboption1suboptionvalue; obj1.suboption2suboptionprice; obj1.suboption2suboptionpname and so on and so on for each suboption which could be five options (small,medium,large,x-large, xx-large) and which would "work" but would be bad programming and involve splicing names to get say, the "third" suboptions' price and pvid e.t.c

Going down the route of mutidimensional arrays sounds good except that on say 50 objects I would have stacks of arrays which I'm guessing isn't great in terms of resources?.Just to add, the number of suboptions varies between object, every object has a minimum of one suboption (default option) but can have as many as needed (unlikely to be more than 5 but should be scalable). i.e some t-shirts only come in medium whereas some have many sizes.I have a fair amount of leeway on the format of the XML which I generate from the database so the formatting of that could change to make the parsing easier.

View 0 Replies

ActionScript 2.0 :: Return A.attributes.first > B.attributes.first Will Return What Value?

Jun 8, 2006

i was mugging on this tutorial :

[Code]...

The return a.attributes.first > b.attributes.first will return what value?

View 1 Replies

ActionScript 3.0 :: TextFormat Vs StyleSheet?

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

Flash :: TextFormat Doesn't Do Anything?

Jun 9, 2011

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]......

View 1 Replies

ActionScript 3.0 :: Get TextFormat Name (or Reference)?

Jan 15, 2009

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!!

View 4 Replies

ActionScript 2.0 :: Get TextFormat Name String?

Jan 20, 2009

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

View 1 Replies

ActionScript 3.0 :: How To Use Textformat And Tabstops

Oct 6, 2009

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>]]>

View 2 Replies

ActionScript 2.0 :: TextFormat No Display Under IE?

Aug 21, 2010

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]...

View 1 Replies

ActionScript 3.0 :: TextFormat Changes With Text?

Jun 29, 2011

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].....

View 2 Replies

ActionScript 2.0 :: Can't Get TextFormat Working

May 16, 2007

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].....

View 2 Replies

ActionScript 3.0 :: TextFormat Disappears?

Apr 24, 2009

...when i set the textField with new text eg:

var tf = new TextField();
var myFormat = new TextFormat();
//set textField format

[code].....

View 1 Replies

ActionScript 2.0 :: TextFormat & Hover

Apr 13, 2005

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 Replies

ActionScript 3.0 :: Using Textformat Class Dynamically?

Nov 18, 2009

I'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 Replies

ActionScript 3.0 :: TextFormat Changes With Text.length

Aug 27, 2011

I 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]......

View 1 Replies

ActionScript 3.0 :: Use TextFormat On Multiple Frames?

Feb 19, 2009

I must be missing something, but how on earth do I make it sothat I can set TextFormats for the whole movie and not just theframe the actionscript is on.My movie is basically a video with cuepoints that triggerdifferent keyframes that display text appropriate to what theperson featured in the video is talking about. In other words it'slike a powerpoint presentation that's run by an FLV file. Almostall of the blocks of text I'll be displaying are bulleted lists andsince, for some odd reason, bulleted lists aren't available usingthe standard Flash GUI text formating tools I need to apply themvia ActionScript. All the ActionScript is in its own keyframe atthe beginning of the movie timeline. I've setup my text formatingcode like this:

var bulletlist:TextFormat = new TextFormat();
bulletlist.bullet = true;
bulletlist_field.setTextFormat(bulletlist);

While I have successfully applied this to a box of text onthe first frame of the movie, I haven't be able to apply it to texton any other keyframe. So from what I can tell, I have to referencethe above TextFormat actionscript for every frame I need to use iton, and since I can't have duplicate TextFormat values, that meansI'd have to create a new instance with a new name for each frame.This seems rather inefficient and frankly ridiculous consider thatthe other ActionScript that I wrote seems to apply to the wholemovie. And what's the point of using ActionScript to format text ifyou have to redo it for every *******' keyframe? Is there somefunction that I'm missing somewhere to allow me to use one set ofTextFormat code on multiple frames or is this simply a dysfunctionof Flash and/or ActionScript 3.

View 11 Replies

ActionScript 3.0 :: Set TextFormat For TextFeild Dose Not Appear

Jan 26, 2009

I have issue with TextFormat; when I set TextFormat for TextFeild .. dose not appear !! look at my class:) at the end line ...

View 6 Replies

ActionScript 3.0 :: Retrieve Textformat Parameters?

Feb 20, 2009

I am using the setStyle to set the text label on some buttons in flash. AS3.Set font to bold and color to red. myButton.setStyle ("textFormat", redBoldFormat);I do this on as part of a function when the button is clicked.Is there a way to retreive the textformat settings (like bold, etc) so I can un-set the format? I have 5 buttons, when one is clicked, it goes bold and red.When a different button is clicked, I would like the previously clicked button to go back to "not bold" and "not red" and so on,

View 1 Replies

TextFormat - Change The Font Size

Jan 14, 2011

In my movie, I have a dynamic textfield on the timeline starting the first frame and going to the end. At various points during the movie, I change the text in the textfield (and that works just fine), but I also want to change the font-size when I do that. I've tried using setTextFormat to a different TextFormat object, but that doesn't seem to work. Maybe someone has a better idea?

[Code]....

View 2 Replies

Actionscript 3 :: Why Is TextFormat.size An Object

Mar 22, 2010

According to the ActionScript 3.0 documentation, the TextFormat classes size property is an Object. Why is this? Clearly this is a number! When I check its type (using typeOf()), it returns Number. So whats the deal?

View 3 Replies

ActionScript 3.0 :: TextFormat: Top And Bottom Margins?

Apr 10, 2008

I'm using TextFormat to format a text field and I've noticed that, while there are properties for leftMargin and rightMargin, there are non for top and bottom margins. Is there any way to add some padding to the top and bottom of a text field? My text field has a background color, and right now the text is flush with the top and bottom edges of the box, which looks ugly

View 4 Replies

ActionScript 3.0 :: TextFormat Changes With Text.length?

Aug 27, 2011

I 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:

ActionScript Code:
updateBtn.addEventListener(MouseEvent.CLICK, updateIt);
inputText.maxChars = 50;
function updateIt(event:MouseEvent):void{

[Code].....

View 6 Replies

ActionScript 2.0 :: Retaining Alignment + TextFormat?

Jun 19, 2007

I have a movie where the user is able to type text into an input text field. The textfield itself is set to be left-aligned, but I provide the users with 2 buttons for alignment... left-align and center-align buttons. I have it so that if they click on one of the buttons, it sets a variable that stores the alignment with the one desired, and then calls a function that contains all of the textFormat code to display the text with this latest change. That works fine, to an extent....

When the movie is first started, the text is left aligned (as it shoudl be since the text field is set that way)... and then if I type in some text and then hit the 'center' button, it centers it like it should. Now here is where the problem is: If I go to add in more text before what is already there, or select some of the text and begin typing, it immediately left-aligns the text again. It would be annoying for the user to have to hit re-center the text again..and to make things worse, I have it so that when each button is pushed, it shows an 'on-state' ... so when it automatically left-aligns the text, the 'center' button is still active.

View 4 Replies

IDE :: Textformat Tabstops And Bullets In Xml File?

Jan 4, 2008

According to the search there's never been a post that contains the word "tabstops" in the history of . I am honored to be the FIRST!Anyway, I am converting an application so that text content that was once trapped in the authoring environment will now reside in an external XML file.The problem i'm running into is that my "textformat tabstops" tags and bullets no longer work.In the content I had:

Code:
<textformat tabstops='[10]'><br><br><b><u>Blah blah blah</u></b><br> Blah blah blah<br> lah blah blah etc.</textformat>

[code]....

View 2 Replies

ActionScript 2.0 :: Using Embedded Fonts With TextFormat?

Mar 2, 2008

It works great, but I can't figure out how to change the font in the textbox using an embedded font.I imported a new font into the library and named it "marriage". I also selected the export options. But the following doesn't work as expected:

format = new TextFormat();
format.font = "marriage";
tfield.setTextFormat(format);

Is there something else I need to do to use an embedded font? My eventual goal with this is to create a drop down menu with several fonts in it that people can use to change the font face in the text field.

View 4 Replies

ActionScript 2.0 :: TextFormat Not Formating Text?

Apr 17, 2008

This is not styling my text. What am I doing wrong?

this.textScroll.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 255, 200);
textScroll.my_txt.multiline = true;
textScroll.my_txt.html = true;

[code].....

View 5 Replies

ActionScript 2.0 :: TextFormat.size Maximum?

Jun 8, 2008

It seem that the textFormat.size property has a maximum - attempting to set it to something like 160 doesn't work correctly..

View 2 Replies

ActionScript 3.0 :: Set The TextFormat's Font Property?

Feb 22, 2009

i have a mc with a IDE created text field that has embedded fonts. can I use the same embedded fornt in a actionscript created textield without embedding it as a font in the library? if so what string do i set the TextFormat's font property as?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved