Vertically Centering Dynamic Text

I am trying to get the text I am loading into a dynamic text
box vertically aligned. There are from 3 to 8 lines of text that
load into the dynamic text box via an array. I haven't found
anything to do this. Can I get a coordinate that tells me the
height of the loaded in text? Thanks for any help...

I have the answer to my own question....
placeText = function(){
//this first line just creates a variable with the button
number pushed
var currentButton = _parent._parent.buttNo;
//oBox_txt is my dynamic text box
oBox_txt.autoSize = "center";
//this line populates the text box with text from an array
using the predefined
//variable "currentButton"
oBox_txt.text = textual[currentButton];
oBox_txt._y = ((100 - oBox_txt._height) / 2);
This assumes that the box is at the _y coordinate 0, and that
the box is 100 pixels high.

Similar Messages

  • IPhone: Vertically centering UILabel text

    The UILabel permits horizontal centering of its text via the textAlignment property, but there seems to be no way to align the text vertically. I have 3 labels, the last holding from one line to several. It if only has a single line, the text is vertically centered giving a big gap from he previous text. That looks uncool. (and in the Mac world, cool is everything). Is there some secret magical way to get UILabel to vertically center is text as well, or do I need to abandon labels and just drop down to drawRect.

    Check out NSString(UIStringDrawing). It has the following method, which you can use to calculate the size of the text as it would be in the label. Then you can set the label height to the minimum necessary for the text, which will solve your vertically centering problem.
    sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode:

  • How to Vertically center dynamic text?

    I am trying to vertically center and wrap text within a Text div. I have figured out how to center text if it is a single line, but the text that I am using will be diffrent for each user depending on what language they view the page in. How can i make sure that text is always vertically centred and wrapped regardless of how long it is?

    Could you do this with css? There is a css attribute display:table that allows you to set the paragraph attribute to align to themiddle of a region. See: http://css-tricks.com/vertically-center-multi-lined-text/
    Hope that helps.

  • Rotate Dynamic text and make dynamic text go vertical

    Hello
    I am working on a visual customizer flash app in actionscript 2.0. Looking for good tutorials or examples of how to rotate dynamic text as well as how to make it vertical. Currently all the dynamic embedded text changes colors and size.
    Any help would be greatly appreciated. Thank you.

    distribute each character to a textfield and arrange the textfields to suit your needs.

  • Making Dynamic Text Vertical

    I have a php site, from which I would like to be able to
    extract a specific record and create a printable postage label.
    I have managed the result page with the Dynamic text but the
    printer/label configuration means I have to get the text in
    vertically (i.e. it would look correct if you looked from the right
    side of the page)
    I have trawled through the forum but the only reference is
    saying that you can only do this with images - Is this
    correct?

    I would think so, yes.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "RichardODreamweaver" <[email protected]>
    wrote in message
    news:elorub$kl6$[email protected]..
    >I have a php site, from which I would like to be able to
    extract a specific
    > record and create a printable postage label.
    >
    > I have managed the result page with the Dynamic text but
    the printer/label
    > configuration means I have to get the text in vertically
    (i.e. it would
    > look
    > correct if you looked from the right side of the page)
    >
    > I have trawled through the forum but the only reference
    is saying that you
    > can
    > only do this with images - Is this correct?
    >

  • Dynamic text doesnt appear chinese word!!!!

    dynamic text doesnt appear chinese word.
    i have try to set to arial unicode but still cant.
    Pls help.
    THx

    I change that line but is the same result....
    If I have one event it look like this:
    and if I fill all events look like this:
    as you can see it doesnt align vertical....its the same alignment on the two images.... here is my code again...
    var urlLDR:URLLoader=new URLLoader();
    urlLDR.addEventListener(Event.COMPLETE,f);
    urlLDR.load(new URLRequest("hallsXML.xml"));
    function f(e:Event) {
        var xml:XML =new XML(urlLDR.data);
        TXThall.autoSize = "center";
        TXThall.text = "";
        for(var i:uint=0;i<xml.hall.length();i++){
            TXThall.appendText(xml.hall[i]+"\n");
    TXThall.y= Math.floor((stage.stageHeight - TXThasll.textHeight) / 2);
    My page size of the project is 768 * 1024 and the position & size of the dynamic text is X: 384.0    Y: 332.5  W: 664.0    H: 405.9...
    I dont know if it helps that data....
    Thanks for responding and I hope you can help me figure out this...

  • Vertical Centering of a page in GoLive

    I need a help in vertical centering a page. After long trials and with the help of others in this forum I was able a website that is functioning well enough. The only concern is that it needs to be centered vertically. You can see the website on: http://www.chimeddorj.com
    I read the tutorial on the following link, and I liked the 3rd method.
    http://blog.themeforest.net/tutorials/vertical-centering-with-css/
    But it was too complicated for me as I don't use GoLive often enough. I made this website 3 months ago and since then I haven't used it again. As a result I kind of forgot a lot of things that I knew at that time. If you know how to make the Vertical Centering, could you please guide me how to place the codes in right places? I could provide you with necessary files if necessary. You can also see the HTML code sources by clicking the right button on the website that I created. 
    For some people it may be easy as click. Please help me if you can.

    Thank you very much for comment. I tried to use the table method with your codes. It is centering the content horizontally, but not vertically. The contents are stuck to the top as I resize the window. It seems like I am missing some point. I copy and paste my current code. Could you please give me more advice?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="generator" content="Adobe GoLive" />
    <title>Mongolian Artist Chimeddorj</title>
    <script src="js/swfobject.js" type="text/javascript" ></script>
    <style type="text/css" media="screen"><!--
    body { text-align: left; }
    a:link { color: silver; font-size: 14px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; font-weight: 600; font-stretch: condensed; line-height: 18px; text-decoration: none; }
    a:visited { color: silver; font-size: 14px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; font-weight: 600; line-height: 18px; text-decoration: none; }
    a:hover { color: black; font-size: 14px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; font-weight: 600; line-height: 18px; text-decoration: none; }
    a:active { color: gray; font-size: 14px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; font-weight: 600; line-height: 18px; text-decoration: none; }
    #Name { color: #633; font-size: 14px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; font-weight: 600; text-decoration: none; }
    .note { color: gray; font-size: 11px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; line-height: 15px; }
    --></style>
    </head>
    <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="100%">
                    <tr align="center" valign="middle">
                        <td align="center" valign="middle">
    <div style="position:relative;width:1060px;height:540px;-adbe-g:p;">
    <div style="position:absolute;top:0px;left:0px;width:700px;height:540px;-adbe-c:c">
    <script type="text/javascript">
    var flashvars = {XMLFile: "paintings.xml"};
    var params = {bgcolor: "#ffffff", allowFullScreen: "true"};
    swfobject.embedSWF("ArtFlashGallery.swf", "myAlternativeContent","700", "540", "10.0.0",false, flashvars, params);
    </script>
    <div id="myAlternativeContent">
    <a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> </a></div>
    <br />
    <!-- You can't remove the copyright text below if you're using free version --></div>
    </div>
    </td>
    </tr>
    </table>
    </body>
    </html>

  • Scrolling event: movieclip instead of dynamic text

    Hello everybody. I am very very novice to actionscript, so probably my question will sound a little silly.
    I am trying to put an arabic text to scroll with a custom scrollbar. So I found a nice video in youtube about doing that with a dynamic text field. It works wonderful for latin characters (left to right and separated letters) but unfortunately not for arabic characters (they don't get connected). Actually, I don't care to use just a movieclip with the text instead of the dynamic text field. But I don't know how to change the actionscript code for the movie clip instead of the dynamic text field.
    Here I show you the code for the scrolling text in a dynamic text field (it's a short code), on the stage I got just the dynamic text field (instance name: texto_txt), the scrollBar (a vertical line, instance name: scrollBar_mc) and the scroller itself (a little rectangle, instance name:scrollHandle_mc):
    var content:String = "cjeihfirehjfejlkfjkerjfirjfejifjrijwkjfirwjekñlkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkllllllll";
    texto_txt.text = content;
    texto_txt.wordWrap = true;
    var min: Number = scrollHandle_mc.y;
    var max: Number = min +(scrollBar_mc.height - scrollHandle_mc.height);
    var intervalo: Number = max - min;
    var arrastrando: Boolean = false;
    var bounds: Rectangle = new Rectangle (scrollHandle_mc.x, scrollHandle_mc.y, 0, scrollBar_mc.height - scrollHandle_mc.height);
    scrollHandle_mc.addEventListener (MouseEvent.MOUSE_DOWN, arrastrandoScroll);
    stage.addEventListener (MouseEvent.MOUSE_UP, stopIt);
    function arrastrandoScroll(mouseEvent:MouseEvent)
    scrollHandle_mc.startDrag(false,bounds);
    arrastrando = true;
    scrollHandle_mc.addEventListener(Event.ENTER_FRAME, progress);
    function stopIt(mouseEvent:MouseEvent)
    scrollHandle_mc.stopDrag();
    arrastrando = false;
    function progress(e:Event)
    var moverScroll:Number = scrollHandle_mc.y - min;
    var percent:Number = moverScroll/intervalo;
    if (arrastrando == true)
    texto_txt.scrollV = percent * texto_txt.maxScrollV;
    What I want to do is clear the dynamic text field and use instead a movieclip (text_mc) that includes already the text, the bounding box would be a mask. How do I change the actionscript? Could anyone help me out?

    It isn't really a matter of math, as much as it is logical reasoning, but if you plan to do things with programming, you better plan on getting comfortable with learning math as well.  Programming and math go hand-in-hand.
    Here's a simplified explanation of what your code needs to do -> If you move the scroller 25% of the total distance it can move, then the movieclip should be moved 25% of the distance it can move (in the oppostie direction).
    Your scroller handle can be moved a predefined distance.  In your code that value is called "intervalo".  See if you can figure out how that value is determined in the 3 lines of code.
    var min: Number = scrollHandle_mc.y;
    var max: Number = min +(scrollBar_mc.height - scrollHandle_mc.height);
    var intervalo: Number = max - min;
    Later on in your progress function you can see where the scrollbar handle values com into play again when determining where to place the textfield.  But if we change that to be the movieclip, it becomes more like the following...
    function progress(e:Event)
        var moverScroll:Number = scrollHandle_mc.y - min;
        var percent:Number = moverScroll/intervalo;
        if (arrastrando == true)
             yourMC.y = percent * (yourMCmaxY-yourMCminY) + yourMCMinY;
            // where  yourMCmaxY-yourMCminY is the mc's movement range
            // which is likely to be negative since yMax is likely < yMin for the mc.

  • Horizontal Spacing on dynamic texts?

    Hi friends!
    I have created some dynamic texts and i am triying to change
    the horizontral
    space between
    letters but it doesnt seem to work, how do i do it??? Do i
    have to know
    something special?
    Can i do it using code (AS 2.0)???
    The funny thing is that the vertical spacing works perfect.
    Cheers
    Jaime

    I believe your first response was to embed the font, which I mentioned had been done in the introduction.  Here is a sample of what I am talking about.

  • UIScrollBar component dynamic text capital letter Y not appearing

    I'm using the UIScrollBar component, dynamic text is my setting.  When I view the swf or exe, all my text appears except for capital letter Y, it appears in flash, but not the swf or exe file.
    Any reason why this happens?
    Any help is appreciated.

    I finally found the answer but this scenario doesn't make
    sense. It seems you have to create a dynamic text field with a
    scrollbar during runtime through actionscript, rather then creating
    the text field and scrollbar in design mode. Here is the code that
    worked:
    import fl.controls.UIScrollBar;
    var myTxt:TextField = new TextField();
    myTxt.background = true;
    myTxt.backgroundColor = 0xFFFFFF;
    myTxt.border = true;
    myTxt.wordWrap = true;
    myTxt.width = 200;
    myTxt.height = 200;
    myTxt.x = 22;
    myTxt.y = 75;
    var mySb:UIScrollBar = new UIScrollBar();
    mySb.direction = "vertical";
    // Size it to match the text field.
    mySb.setSize(myTxt.width, myTxt.height);
    // Move it immediately right the text field.
    mySb.move(myTxt.x + myTxt.width, myTxt.y);
    // put them on the Stage
    addChild(myTxt);
    addChild(mySb);
    // load text
    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest("breakroomText.txt");
    loader.load(request);
    loader.addEventListener(Event.COMPLETE, loadcomplete);
    function loadcomplete(event:Event) {
    // move loaded text to text field
    myTxt.htmlText = loader.data;
    // Set myTxt as target for scroll bar.
    mySb.scrollTarget = myTxt;

  • Centering Imported Text

    Hi,
    I am importing a few thousand lines of text  via variable/datasets from a csv on cs4.
    This text varies in length from a few lines long up to almost a dozen.
    The import is working fine, however is there any way of centering the text vertically with the text paragraph box upon import?
    I really dont want to have to go through every exported psd and manually reposition.
    Any Idea?
    Cheers
    P.Pop

    Add line-height: 36px; to your 'tracks' class css, as below:
    .tracks {
        font-family: "Goudy Old Style";
        color: #000;
        padding-left: 120px;
        margin-top: 60px;
    line-height: 36px;

  • Vertically center live text

    Since the anchor point of live text is normally at the baseline, vertically centering text using %age of comp doesn't work.
    It doesn't seem that dividing the text point size by 2 gives me a correct vertical offset either (which should work if my text size was the caps height, right?). So AE must be using the X-height as the font size?  So I have no idea what the X-height for some fonts are.
    Other than visually manually adjusting the anchor point or the baseline offset, is there any better/quicker/automated way of vertically centering text within a comp?

    Hey Navarro, I understand your pain
    I've used a workaround, not automated but it helped me anyway. You'll have to do this for every font you wanna use.
    1) Create a new comp, standard HD for exemple and write a text with your font in size 20.
    2) Now use the region of interest to match exactly the size of your text (well the height at least).
    3) In the comp menu, use the crop to region of interest button. Co to the comp setting and write down the height.
    4) Now redo the 3 first steps with size 60.
    5) then all you'll have to do is a little rules of 3 to automagically calculate the actual X-size depending on the size of your font, and write down an expression for this on your anchorPoint.
    A bit PITA, but it has worked great for me.
    Hope that helps.

  • Displaying the result of a calculation in a dynamic text box

    Hi folks,
    I'm having a very minor issue here (operator error, I'm sure ). With the help of some folks here, I've created a series of calculations, and I've got that part down. Now, I just need it to show up in the movie.
    I've created the dynamic text box in Flash (CS3), but when I hit test, it won't show up.
    After all the calculations, I should have a figure that I call totalmoney. My dynamic text box is called total. The user doesn't need to hit anything for it to appear. It just appears as part of the movie.
    Here's my code:
    stop();
    var startDate:Date = new Date(2010,0,12);  // use your  startyear, startmonth, startdate in the new Date() parameters.
    var  currentDate:Date = new Date();  // assuming user's clock is correct and in your  timezone.  else use server date/time.
    var numberOfSeconds:Number =  (currentDate.getTime()-startDate.getTime())/1000;
    var interest:Number =  (numberOfSeconds*0.74356);
    var totalmoney:Number =  (interest+15,000,000);
    function displaytotal(evt:TextEvent):void {
         total.text = "totalmoney";
    Any thoughts?
    Thanks!
    Napo

    You didn't have to bury any of the calculations in the function--leaving it as you had it is better.  They could remain where they a=werew, and you'll probably find you want them outside it if you have other plans for using them.  If left inside, they only have scope inside.  In the programming world, it's good to think of functions as things that do one thing and one thing only (though it isn't often practiced that way)--it's called modular design.
    When you place an event as an argument for a function, it typically means that there is an event listener that initiates the call to the function.  If you work with buttons you'll see what I mean.  But if the plan is to create your own call to a function when you desire it as such, not have it driven by an event listener, then you don't need to pass any event to it, though you may pass some other type of variable to it if need be.
    For instance, what you have now will call the function without an argument because the function has the value built into its code....
    displaytotal();
    But you could also make the function a little more generic and set it up to recieve the value instead as an argument...
    function displaytotal(amt:Number):void {
         total.text = String(amt); // an earlier error of mine
    displaytotal(totalmoney);
    That would make your function a little more useful.  Now it could be used to display other Number variables as well.
    // my earlier error was that a textfield displays text, so you need to convert the Number value to s String.
    Hope I'm not confusing you.

  • Dynamic Text Field is not displaying foreign characters... HELP!

    I have a dynamic text field that is not displaying foreign characters properly. They appear as boxes.
    Here's what I've tried.
    Under properties for the text field, I clicked on the embed characters button. In there, I pasted all the special characters I would need and clicked okay. Shouldn't this be enough for the text to display properly? What am I missing? Please help...

    More info: I'm noticing that in the actual dynamic text field in my .FLA file, if I type a foreign character like é, it pops up as a block. My family font is set to New Caledonia... is it possible that New Caledonia doesn't have those particular glyphs? The thing that doesn't make sense to me though is, last year when I made this card, it worked fine with New Caledonia... Any help is greatly appreciated!!

  • EDGE and HTML dynamic text in a "box" with scroll bar

    I'm new to EDGE, a win7pro master collection cs5.5 suite owner. I'm mainly in the Film/Video post production field (mostly AE, PPro, Pshop, IA) but have been branching into web design the last couple of years.  I use Dreamweaver, Fireworks, Flash. While I'm a expert user with all the Film/video apps, I would say I only have intermediate ability with the web apps. While I understand a lot of programing logic bulding blocks I'm not a coder.
    So since we're told "flash is dead",  my interest in Edge is to try to do some of the things that I can currently do in flash in  EDGE. I was excited when Edge first came out but lost interest when it became obvious that Adobe was not going to offer Edge and Muse to "suite owners" but only in their force feeding of the "Cloud". Better known as the "golden goose" for adobe stockholders and a never ending perpetual hole in the pocket for users. Anyway....
    I spent the last couple of days doing some of the tuts and messing with the UI. It's matured a lot since I was here last.
    I've been working on a flash site for a sports team where one of the pages is a player profile page where college recuriters and other interested parties can view recuriting relavent info/stats about players. This is how it works. While on the "Team" page a users clicks on  a button labled "Player Profiles" . (Animation) A "page" flies in and unfurls from the upper right corner (3d page flips effect created in AE played by flash as a frame SEQ). Once it lands filling most of the center of the screen there is a bright flash. As the brightness fades we see the "page" is a bordered box with a BG image of a ball field(End). (Animation) from behind the border in fly small pictures (player head shots with name and jersey number). They stream in and form a circle like a wagon train and the team logo zooms up from infinity to the center of the circle(End). As the user mouses over a player's pic it zooms up a little and gets brighter (like mouseover image nav thumbs for a image slider). If the user clicks on a player's head shot it flips over and scales up to become a text box with a scrollbar. The content of the box is a mix of images, static and dynamic text fields populated from data in an "player info data base" XML file, and some hyperlinks. It's all kept updated dynamicaly with current stats, info and images from the XML file. There is also a "PDF" button that allows the user to open/save/print a PDF of the player's profile (the PDF's are static files for now but the choice of which pdf to retrive is dynamicaly supplied via the XML file.
    So.... Is Edge now able to do something like this?  Would it need to be a collection of small animations? could these be "assembled" and connected as an asset in dreamweaver ?
    I thought I would approach this from the end (ie click on an image and display a box with dynamic TEXT fileds. ) since that is the most important part, ie displaying the dynamicaly updated profile info.  Sooooo....
    Can Edge display a scrolling text box with Images, static text, and html dynamic text in it??
    Joel

    The code is in composition ready. Click the filled {}

Maybe you are looking for