Setting color and font

I need a way to set the properties of a text box--color and
font of the text inside it--upon an event, wether it's in the
timeline or off a button release or even LoadMovie would work. Is
this possible?
woodbury

Hi Firstodd,
1. Try re-assigning the text after you set the format:
blackjack.onPress = function() {
var oldText=this._parent.field.text;
var myFormat = new TextFormat();
myFormat.font = "BlackJack";
this._parent.field.setTextFormat(myFormat);
this._parent.field.text=oldText;
I haven't played around with the AS3.0 enough yet but I know
that the
2.0 one applies changes to new text so you need to add "new"
text to the
field by recopying the existing text. Basically...rewrite the
text with
the new format.
2. Your formats are stored in the text field's format
property. You can
either keep a reference to the original format you created
('myFormat'
above), or use:
var myFormat=this._parent.field.getTextFormat();
The text format has a variety of properties you can read such
as font,
size, color, and so on. Have a look at the TextFormat class
reference in
the Flash help. Most of these are completely optional so you
can
set/read whatever you want.
About the text, you simply read or write to the field's text
property
like we did in example 1:
this._parent.field.text="This is new text";
var fieldText=this._parent.field.text;
If you want the user to be able to input text into the field,
make it an
input field:
this._parent.field.type='input';
Otherwise, it's just dynamic:
this._parent.field.type='dynamic';
Do you want it selectable?
this._parent.field.selectable=true;
If it's tall enough to support multiple lines, do you want
multiline
support?
this._parent.field.multiline=true;
Automatic line wrapping on lines?
this._parent.field.wordWrap=true;
You can get even lower-level if you want. You can monitor
what the user
types character by character (assuming this is AS2.0):
function onFieldChanged(fieldRef:TextField) {
trace ('Field now has text: '+fieldRef.text);
this._parent.field.onChanged=this.onFieldChanged;
A field can also cut off if you exceed the available area.
You can set
auto-sizing so that the field adjusts itself to what you
type:
this._parent.field.autoSize='left';
//Use 'center' to keep the text aligned to the center of the
field, and
'right' for right alignment.
Dimensions of the typed text, in pixels, can be obtained
through:
this._parent.field.textWidth;
and
this._parent.field.textHeight;
(You can get the dimensions of the field using _width and
_height but
this is the field size, including borders).
Speaking of borders:
this._parent.field.border=true;
And background...
this._parent.field.backgroundColor=0x00FF00; //green
backrgound
this._parent.field.background=true; //turn it on
I could go on for pages...have a look at the TextField class
to see
everything else you can grab.
The TextField class is the actual field...TextFormat is the
optional
format that's applied to the text.
Hope that helps,
patrick
Firstodd wrote:
> Actually, I did this to embed the fonts I wanted (they
are all non-standard):
>
> The buttons to pick the fonts are broken down, so
graphic and not text. Off
> the the side, out of the canvas, I made a text box for
each font I wanted, and
> put a letter in each, anything would work. I applied the
font to each of these
> letters/text boxes, and then on the properties, I
clicked the "Embed..."
> button, and ctrl-selected "uppercase" "lowercase"
"numerals" & "punctuation",
> for each font on each text box.
>
> Works great, the dynamic text that lets the user types
in changes fonts and
> colors correctly using the script you gave me, even on
computers that don't
> have those ornamental fonts installed.
>
> --
>
> However, I do have a couple questions that any advice
would be appreciated...
>
> 1. When the playing the .swf (which is just 1 frame
stopped), the buttons that
> change the font and color of the named dynamic box--they
have to be pressed
> twice the first time to apply it to the text. But after
it's been applied, and
> you change it, one click will do to get it back to that
color again. I can't
> figure out what would be causing this. My scripts are
all clones of this:
>
on (release) {
> blackjack.onPress = function() {
> var myFormat = new TextFormat();
> myFormat.font = "BlackJack";
> this._parent.field.setTextFormat(myFormat);
> };
> }
>
> changed accordingly for the color buttons.
>
> 2. My next step on this is to, upon the push of a
button, extract the
> information of the instanced text box. As you can see, I
named it "field". I
> don't know where to start with the script for these
kinds of things.
> Properties... I mean what the user has typed, it's
color, and it's font.
> Actually, this needs to go to some sort of check out
system, which I'm not
> familiar with at all, so I'm not expecting a walk
through setting it up, just
> some direction if you could =).
>
> Thanks again
>
> Woodbury
>
http://www.baynewmedia.com
Faster, easier, better...ActionScript development taken to
new heights.
Download the BNMAPI today. You'll wonder how you ever did
without it!
Available for ActionScript 2.0/3.0.

Similar Messages

  • Custom colors and fonts in in-context editor?

    I have added some custom colors and font families in our partner portal > online editor settings for a client site. When editing a page or web app item in the Manage tab of the admin console, I can see these colors and fonts in the editor. However, when going to the Edit tab (in context editing), and clicking on a block with ice:editable='html' I only see the standard fonts and colors.
    Does anyone know if this is a known issue? Or is there some workaround to get the custom colors and fonts into the in context editor?

    It's all type, and afew 3D shapes I created, but I noticed when they were printed out by the printer at work, everything was quite fuzzy. However this occured when I saw that 24 MB was way too much to e-mail through my works server. So at that point I decided to make everything into a .gif and place them into Indesign and PDF them, by doing that i completey reduced the quality and the size, so after it printed it was very pixailized on the edges, and the colors were a few tones off....
    I guess I just want to have the best of both worlds a small pdf and good quality...

  • Excel Set Color and Border VI: no fill?

    If i use Excel Set Color and Border VI to modify the format of a cell, i will get white as my default color for my cell.  However, I am looking for no fill.  I don't want any color, since the color will hide the gird line.  What do I get the no fill option for cell color in LabVIEW?
    Kudos and Accepted as Solution are welcome!
    Solved!
    Go to Solution.

    I have to say I was waiting for this question (I have tried it and observed the same thing). The only solution I see is to use a combination of the RGT vis and ActiveX.
    Ben64
    note, I have connected Cell1 and Cell2 of the _Worksheet Range method but it is probably sufficient to connect only Cell1 here.
    edit: Good, your solution seems a lot more simple!

  • How to set default color and font?

    Where do I set a default font and color for my outgoing mail? I looked in the preferences but when you change it there, it changes it for all emails, incoming and out going. Isn't there a way to have different fonts for the outgoing than for the incoming??
    thanks for your time,
    Michelle

    I'm glad that other people have had this problem too. I've spent hours on the web trying to find how to select the default composing font colour. I find it incredible that with all the options available in Mail and other mail applications that Apple haven't included this most basic of requirements. It would be lovely if someone from Apple would let us know why this has been left out and if they are going to put it in VERY soon, perhaps as a software update? Mac's still rule though :o)

  • Font color and font style

    Can i know how can i change the color ,size and the style of the font in a text area?
    and also how can i get the font style and font size currently use in the text area?

    No, a Font doesn't have a colour. But you can set the colour of the text in a text area with setColor().

  • JText Area( mixing colors and fonts)

    Hi,
    I`m trying to implement a JTextArea that allows the user to type away quite happilly in a default font and color, but if needed they can click a button, and then when they resume typing it will display the new text in a different font and color. Is this possible? If so, how?
    At the moment when they click the button, all the previous text as well as the new text changes to the new font.
    Basically I was wondering if it was possible for a JTextArea to display text of vaying fonts and colors.
    Thanx in advance.

    Try using a textPane instead. Combine this with a RTFTextEditor and you can use every available font,color and other attributes on every part of your text. There are lots of examples about this subject (even some of mine as well) so just search the forum archive.
    Hope this will get you in the right way...
    Korque.

  • Change color and font in two button dialog box

    The two button dialog is boring.
    I need to change the font (larger), the background color, the button color, and hilite the important part of the message.
    Ex: is this color RED ? I'd like to see RED is red.
    Attachments:
    DIALOGBOX.vi ‏16 KB

    Hi trout00;
    I think it will be better if you create your own dialog window. Create a vi with all the features you want the dialog window to perform. Edit the connectors of the vi so they return what you want to retrieve (Right-click the upper right icon in the fron panel of the vi and select "Show Connectors"). Then, edit the configuration of your vi so it behave like a dialog box (Right-click the upper right icon again and select "VI Setup..."). Finally, add your vi to your main application vi.
    Regards;
    Enrique
    www.vartortech.com

  • Color and Fonts, JOptionPane

    Can someone tell me how to color and change the font of a JOptionPane???

    G'Day,
    Have you checked out the API on JOptionPane? [http://java.sun.com/javase/6/docs/api/javax/swing/JOptionPane.htm] in particular the methods setFont and setForeground/setBackground....
    Cheers

  • Subtitle color and font

    Hello,
    Is there a way to change the color and the font of subtitles of movies when they play in itunes? And if the movie in itunes have no subtitle, is there a way to add subtitle to it? I am able to put lyrics in music files in my itunes. I wish the ability to add subtitles to movies in itunes works the simple same way.
    Thanks.

    Thanks, i didn't see the 3D method
              g.setColor(Color.orange);
              g.fillRect(10,20,100,50);
              g.draw3DRect(120,20,100,50, true);
              g.fillRect(120,20,100,50);
              g.draw3DRect(240,20,100,50, false);
              g.fillRect(240,20,100,50);

  • Font color  and font effects in sap scripts

    Hi,
    I want to change the color of font(usually it is black).I want in some other color other than black.
    Thanks in advance,
    Priya.

    Hi Priya,
    I know it's quite a long time that you started this discussion.
    But if you still want to know the answer, please go through my blog on how to do color printing in SAP scripts.
    White Paper on 'Color Printing in SAP Scripts'
    Regards,
    Sireesha Ch

  • Why can't I change the transparent color and font color in IOS 7?

    Who thought all this WHITE AND TRANSPARENT color looks appealing?
    Why can't I change the color of the folders and text?
    I already tried inverting the colors and then it washes out the photos I use as my wallpaper.
    I love everything, so far, except this transparent issue.

    That's very sad those colors can't be changed. They really look ugly.
    Thanks for responding.

  • HT2500 How do I change default color and font

    Trying to change the default font color of my font when I reply or compose a message and the font window will allow me to change the font style but the color won't budge. d

    you cant alas! however you can  set your signature with a first letter with the font and colour of your choice
    It work well for me and really stop to anoye me to reset each email with the  font and colouur I want ! Hopefully Apple smart people can do something on this very basic issue!

  • Colors and Fonts

    Hello again world.
    Here's a little program that displays the available font names on my machine:
    import  java.awt.*;
    import  javax.swing.*;
    public  class  GetFonts
       public  static  void  main(String[]  params)
          GraphicsEnvironment  ge;
          ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
          String  fonts[] = ge.getAvailableFontFamilyNames();
          JFrame  fontFrame = new  JFrame("Font List");
          fontFrame.setBounds(250 , 100 , 400 , 500);
          fontFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JList  fontList = new  JList(fonts);
          fontList.setBackground(Color.BLUE);
          fontList.setForeground(Color.YELLOW);
          fontList.setFont(new  Font("Old English Text MT" , Font.BOLD , 24));
          JScrollPane  fontScrollPane = new  JScrollPane(fontList);
          Container  contentPane = fontFrame.getContentPane();
          contentPane.add(fontScrollPane);
          fontFrame.setVisible(true);
    }There's really no problem here. Everything works OK. My question has to do with what I will (maybe incorrectly) call "scope".
    Upon which components, in general, should one set font and color attributes?
    In the program above, I tried to apply the attributes, in turn, to the Container, the JFrame, and the JScrollPane - none of which worked.
    I just get black text on a white background using the default system font.
    On the JFrame, I did notice a flash of blue but only for a split second before the text actually presented itself.
    So, empirically, it seems to me that you should apply font and color attributes to the inner-most unit of the component hierarchy that you've created.
    Is this in fact so, or have I missed something again?
    Thank you one and all.
    Ciao for now.

    Yeah, I guess I did. It's not an all together un-reasonable assumption, I think.
    "Everything is easy when you know what you're doing."
         Albert Einstein

  • How to do change color and font

    Site

    Best to do so in the source document if it is available. If not, in Acrobat Pro XI for PC you can use the Edit Text and Images tool. The font and color appear in the Tools pane under Format. I seem to recall this worked differently in version X.
    Hope this helps.
    a 'C' student

  • Setting color of fonts in the font menu

    I use cmd-T to select a font while composing in Mail 2.0.7.
    I would like to know how to enter a choice in Favorites, for example, that has a specific color.
    I know it is possible -- one of my Recently Used is already red. I have tried generating a font which is blue and clicking on "add to favorites" but the font is always black. I have also dragged the red font from Recently Used to Favorites, but on arrival it is black.
    Does anyone know how to do this simple thing?

    Michael, I have tried to duplicate what you see, sent a message with a red font, but it doesn't show up in my Recently Used list as red.
    Also dragging colors to the font window does not seem to work, I'm not sure you can do this at all.

Maybe you are looking for

  • Can I use an external hard drive for my ipad mini?

    Can I use an external hard drive for my ipad mini?

  • Streaming video from macbook pro to apple tv

    Hello, I understand that you can use airdisplay to stream the whole desktop view to the apple tv. However, I've found that its extremely laggy when I play videos that way. When I do, the video and sound is always off by a second. When I stream using

  • Setting up an External Content Type

    Is it possible to set up an External Content Type in SP Designer if the WCF service I'm using only has a method for creating an item in another system? I see that you must create a "Read Item" and "Read List" operation, and when I try to do so, it do

  • BPC 7.5 Client and Server

    Hi, I am planning to upgrade BPC server to version 7.50.17. Please advice if the Client and the server version should be the same? Any document referencing this would be great

  • Panel menu title bars disappear

    I have a long standing problem with the panel menus top and scroll bars disappearing. This happened in CS5 and still occurs in CS6 for me. I use a Mac Pro hexacore with three monitors (two video cards). It occurs after placing a document or switching