AS3 CS5 TLFTextField Scrolling ???

Hi All,
Does any one know of a scrolling example or tutorial for TLFTextField Scrolling?
I have read where the TLFTextField class does not support Scrolling yet.  
I need to create a scrolling EULA for 30 plus languages. I have all my buttons and text object using TLF and embedded fonts. All displayed text is imported from XML files.
My Flash player is part of Director and (I believe) at v10.3 functionality.
Is there a resource I can check to see what works and what's not (yet)? In Flash Pro and Flash Player?
Thanks,
Jim

Thanks fljot,
I got that info here:
http://cs5.org/?p=179
the scroll commands within the TLFTextField may or may not work (I did not test it), but using scroll components do work on the mc.
we also have this combine dev environment of Flash and Flex - they don't always align.
Jim

Similar Messages

  • TLFTextField and AS3 / CS5

    Background:
    I could not make a purely AS3 TextFlow object display text in the same way as a TLFTextField object in the library, even though the settings appeared to be the same (checked using the library xml file in the fla/zip). (The spacing between letters was not kerned in the same way.)
    Therefore I changed tack and attempted to use a library object and update it with AS3. However, I feel that the TLF documentation is somewhat lacking, so I am sharing my findings, simple though they may seem to pros. The text was used for buttons, so I only needed to consider one paragraph with only one span.
    What I worked out
    It has taken me a long time, but I have finally worked out how to access the elements in a TLFTextField object in the library.
    //create an instance of the 'tlfContainer' symbol containing the  TLFTextField object, with the Instance name 'tlfTextField' and 'default'  as the text.
    var container:tlfContainer = new tlfContainer;
    //target the textFlow of the object
    var flow:TextFlow = container.tlfTextField.textFlow;
    //get the first (and only) child of the TextFlow, which is a ParagraphElement
    var paragraphElement:ParagraphElement = flow.getChildAt(0) as ParagraphElement;
    //get the first (and only) child of the ParagraphElement, which is a SpanElement
    var span:SpanElement = paragraphElement.getChildAt(0) as SpanElement;
    Now I can change the text (eg span.text = "new text";) and format the text (eg paragraphElement.direction = "rtl") AND have it display correctly!
    Questions:
    1. Is something like this documented somewhere that I have missed?
    2. Is there an easier way to do this, ie directly access elements? Using getParagraph() gave a null, even though the above worked..
    3. Why should a dynamically generated TextFlow look different to a TLFTextField object?

    It took me a while to find it when I saw an example of code a couple of days ago.
    It basically means a variable number of comma delimited paramaters. From online doc's:
    Statements, Keywords & Directives 
    Definition keywords
    ... (rest) parameter
    Specifies that a function will accept any number of comma-delimited arguments.
    I am trying to find a coding example or two to model my own.
    Thanks,
    Jim

  • Indesign CS5 Slow Scrolling

    Hello
    I'm currently being affected by a slow scrolling bug in InDesign CS5 where no matter what my scroll settings are the speed is constantly slow. Is there an override in InDesign somewhere to fix this?
    This was also present in CS4 but not quite as bad and have also seen other posts in Ps forums.
    Using Windows 7 and logitech mouse
    Thanks
    Nathaniel

    Could you be more specific about this slow scrolling, and what settings are not making a difference?

  • Bridge CS5 random scrolling and jumping

    Hi, I'm using Bridge CS5 on OSX 10.8.4 with a wired apple keyboard and Wacom Intuos 4.
    When viewing a folder full of images in the content tab, it will seemingly randomly scroll up or down through the images without any kind of input on my part. I've tried updating everything (bridge, OSX, wacom drivers). I turned off all of the buttons on the tablet since I don't use them anyway.
    It's extremely frustrating when I'm trying to skim images for retouching and bridge will decide to randomly skip to another part of the folder contents.
    This happens when viewing content in remote folders, not sure if it happens on local folders.
    Does anyone else have this problem?

    I'm on Bridge CC but also 10.8.4 and a wired keyboard and Intuos 4 but I also do use the wireless magic mouse from Apple that can be very restless sometimes and makes things move and scroll or enlarge without my intention to do so. For now I'm blaming my 'thick fingers' for it…
    This problem happens in any remote folder I browse on multiple servers at different physical locations so purging folder cache isn't going to do anything. I have tried resetting prefs to no avail.
    Still not clear if your problem is persistent or only at the start of using the folders.
    And while no experience nor knowledge about network environment you should be able to purge cache without problem because in the default installation your cache file is installed in the user library of your user account.
    But if you have set a custom location this might be a bit more tricky. You can check the location of your central cache file in Bridge Preferences cache tab.
    I should mention that I have colleagues and associates also running Bridge CS5 on different machines with different loadouts who are also experiencing this problem which leads me to wonder why I haven't been able to find similar posts about it.
    This brings up another question. Could it be you or one of your colleagues or all have set the option to distribute cache to folders when possible?
    If so a build cache of your colleague in the folder might conflict with your own cache trying to read different info. Just a thought. Check one folder and use menu view, show hidden files.
    See if there are 2 files with a document icon called .BridgeCache and .BridgeCacheT
    If so delete both files and try again.
    And since Bridge is not designed nor official supported for use over a network this might be the reason not many people manage to use it over a network and therefor don't run in this problem??

  • AS3 Creating Side Scrolling Thumbnails?

    I'm creating a gallery page for my site, and I need a side
    scrolling thumbnail display.
    Basically it would have several thumbnails that would keep
    scrolling for ever (some how duplicating the content in a mask). If
    anyone has anything like this or any links that would be great.
    Cheers!
    Parallels.fm

    Six different examples here:
    http://robdillon.com/flash.html

  • CS5 Mouse scroll up jumps full page

    I need some help. Just starting to use Flash but I've got this one issue that is just ruining everything for me.
    When drawing on the stage, any upward movement of my scroll wheel scrolls the screen by at least half a screen width, if not more. Scrolling down works as normal, equivilent to a few lines at a time.
    This problem seems to only exist in Adobe Flash. No issue in Chrome, Adobe Reader, Inkscape or any other program I've run. I've attempted to adjust the mouse settings, but they have no effect. Even disabling verticle scroll does not nothing.
    Currently I'm using a Microsoft Wireless Mouse 6000 with Windows 7.  I've tried using other mice and they've suffered the same fate. I've also tried updating the drivers as well as cleaning them out and reinstalling them. Nothing works. I've googled and searched these forums but have found nothing related to this.
    Suffice to say, its making using Flash impossible.

    I FOUND A SOLUTION!!
    After a few searches, this article gave a work around:  http://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/mouse-scroll-wheel-not -behaving-correctly/84204cc1-097b-440f-ad16-aa92b6795465?page=1
    Here is the relevant post:
    my apologies -- I honestly didn't realize this was a non-technical forum.  To execute the above workaround (assuming the "built in" drivers...aka the HID-compliant...are being used):
    1. Start menu -> in search box, type "regedit" and hit Enter (click through UAC security prompts)
    2. expand down through...
         HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Enum -> HID
    3. click around (expand the tree nodes) until you find a node named something like 6&xxxx that, when clicked, has something like Mouse or msmouse.inf appear in the Data column
    4. expand to the 'Device Parameters' child node (of 6&xxx....) and click on it...you should see something like "FlipFlopWheel' appear in the Name column
    5. [menu] Edit -> New -> DWORD
    6. type in 'VScrollHighResolutionDisable' (no quotes) as the name
    7. double click on your new DWORD and set the value to '1' (no quotes)
    8. reboot, cross fingers, and retry your programs (if the programs are keyboard based, cross legs...just make sure to cross something....)
    Microsoft probably has disclaimer text around modifying the registry by hand, but they also have disclaimers around using pre-release operating systems so you're already in unsupported territory (just don't delete or rename anything and you'll be fine).
    in the quoted post, it says to look for something named "6&xxx".   I didnt find anything named that, so looked through each folder/subfolder (from top to bottom) until i found the first one to have a value of "Mouse" (in the data column) and applied the changes, and rebooted computer.
    Hope this helps.

  • I need some how to info that I cannot find on AS3 CS5

    How do I make a
    dynamically created TLFTextField
    editable
    or is that impossible??? Please be specific and give an example, if possible.

    Not really sure what you mean, but I think this does what you want:
    import fl.text.TLFTextField;
    var tlf:TLFTextField=new TLFTextField();
    tlf.border=true;
    tlf.x=100;
    tlf.y=100;
    tlf.width=200
    tlf.height=15
    tlf.text="Hello world"
    tlf.type=TextFieldType.INPUT
    addChild(tlf);
    The border, x, and y properties are just being set to make it easier to see. I think the part you need is the type property. Check it out in the help files.

  • AS3 alternatives to *_exclude.xml files, loading class definitions dynamically

    I've been banging my head against a wall for this for almost a couple days now and hoping that someone can point me in the right direction.
    Working in a very large Flash application, previously in AS2/CS3 I would have a setup like the following:
    root.swf
    -- modules
    ---- code_a.swf
    ---- code_b.swf
    -- views
    ---- view_a.swf
    ---- view_b.swf
    Using _exclude.xml files, I could exclude the classes defined in code_a and code_b from the ouptut .swf of view_a and view_b. root.swf would be responsible for loading the code modules before view_a or view_b, ensuring that class definitions that view_a and view_b depended on existed.
    The Problem
    We've recently migrated to using Actionscript 3/CS5. *_exclude.xml files no longer exist. To get the same functionality as above, I've tried the following:
    My setup now looks something like:
    root.swf
    -- modules
    ---- class_a.as
    ---- class_b.as
    -- views
    ---- view_a.swf
    ---- view_b.swf
    Use mxmlc to compile root.swf, view_a.swf and view_b.swf, passing it -externs option to specify classes that will be loaded externally (the two classes in modules). This ensures that the class is excluded from the compiled swf.
    Use compc to compile class_a.as and class_b.as into classes.swf, using -directory=true to access library.swf for external loading.
    However, when I try running one of the two view files which depend on classes.swf, I get runtime errors telling me that a class definition is not present.
    Current Workaround
    I've devised a workaround which I'm currently not happy with as it's backwards to the modular approach that I was previously using:
    Rather than loading the code modules, I statically link all class definitions required by child movies intoroot.swf. When building root.swf, I use the -link-report option of mxmlc to provide a list of included classes. When building child swfs, I can the use -load-externs to ensure that class definitions that already exist will not be included in the compile output.
    Is there a way that anyone is aware of to replicate the AS2/_exclude.xml solution that I had using AS3/CS5?

    I'd double check if you are loading the child SWF with correct LoaderContext and/or calling ApplicationDomain.getDefinition() correctly - otherwise you cannot access classes defined in loaded SWF files.

  • CS5 Component Inspector performance

    I'm curious when Adobe are going to repair the performance issues inside component inspector panel in CS5? Scrolling through the properties of some components is ridiculously slow, 486 like slow...

    Hi, ya, same issues... Regardless of whether I'm on a fast Mac or a fast PC the component inspector is too slow to be worth my time.
    I've switched back to Flash CS4. Is someone from Adobe monitoring these forums? This should get some serious attention...

  • Appling Ext. Embedded Fonts to Text

    Hi All,
    I am spinning here. I believe I am missing the intermediate step of getting/creating a font obj to apply to the text format. The TLFTextField (instance name Label) was created on stage and has _typewriter font set. It is in movieclip instance mc and is rotated.
    AS3 CS5 Player 10
    The text is substituted but the Arial Unicode MS font is not applied.
    import flash.display.MovieClip;
    import com.greensock.*;
    import com.greensock.loading.SWFLoader;
    import com.greensock.events.LoaderEvent;
    import fl.text.TLFTextField;
    import flash.text.TextFormat;
    import flash.text.Font;
    var loader:SWFLoader = new SWFLoader("Code/FontTLF.swf", {onComplete:completeHandler});
    loader.load();
    function completeHandler(event:LoaderEvent):void {
    var fontClass:Class = loader.getClass("FontClassName");
    var fontArray:Array = Font.enumerateFonts(true);
    var formatMC:TextFormat = new TextFormat();
    for(var i:int = 0; i < fontArray.length; i++) {
    var font:Font = fontArray[i];
    if (font.fontName == "Arial Unicode MS") {
      trace("name: " + font.fontName);//name: Arial Unicode MS
      trace("typeface: " + font.fontStyle);//typeface: regular
    formatMC.font = font.fontName;//I may need an intermediate step here??
      break;
    trace (formatMC.font);//Arial Unicode MS
    mc.Label.text = "New S"; // Rotated MC with text displays as Times s/b Arial...
    mc.Label.defaultTextFormat = formatMC;
    mc.Label.embedFonts = true;
    Thanks,
    Jim

    Yes , I believe you are right but ... 
    Here's a common TLFText example I am referencing.
    import fl.text.TLFTextField;
    import flash.text.TextFieldAutoSize; 
    import flash.text.TextFormat;
    var fmt:TextFormat = new TextFormat();
    fmt.color = 0xFF0000; // red 
    fmt.font = "Arial";  fmt.size = 32;
    var tlfTxt:TLFTextField = new TLFTextField();
    tlfTxt.defaultTextFormat = fmt;
    tlfTxt.border = true;
    tlfTxt.text = "The quick brown fox jumps over the lazy dog.";
    tlfTxt.wordWrap = true;
    tlfTxt.width = 300;
    tlfTxt.autoSize = TextFieldAutoSize.LEFT;
    tlfTxt.x = tlfTxt.y = 40;
    addChild(tlfTxt);
    It also runs out sequence, but I am cleaning that up.
    I am trying to use a method that allows me to use plain text strings w/o markup.
    It a CD based captioned video player and uses a Director platform that has flash player 10.3 built in. 30 plus languages, some RTL and maybe a BiDi.

  • Is there a way to mark my place in code view?

    Hi -
    My favorite text editor, BBEdit, has a way to set a marker in a text file so that I can jump back to that spot by selecting it from a menu.
    Now I'm using DW CS5 and scrolling up and down on the page is making me crazy.  I'm hoping DW has the same "set marker" feature feature somewhere.
    Can someone tell me if it exists and where it is?
    Thanks
    JL

    Insert comments into your code.  Use Find (Ctrl+F), current document, source code to jump back to where you need to go.
              /**this is a CSS comment**/
              <!--this is an HTML comment -->
              //this is a JavaScript comment//
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Open With default Application in Bridge

    When I double click a "RW2" file in Bridge my Photomatix application opens the file. Nowhere in the file associations do I see Photomatix or the "RW2" file format for that matter. I reset to default associations - still no joy. The only app showing in the "Open With" pull down in Bridge is "Photomatix (default)". How so I change this default to PS4?

    To my knowledge RW2 is the Raw format for Panasonic ?
    The file type association in Bridge prefs should be found under Panasonic.
    In your situation it might show Photomatix. (mind you that Photomatix claims
    to rather not convert Raw files in their own app because they have no good
    converter for that and they are better in working with tiff). See if you
    have the option to change this to CS4.
    If not you will have to look in the supported Raw formats for your ACR
    converter to see if your camera model is supported in the list for the ACR
    plug in for CS4:
    Try this link (otherwise find it with a search on the Adobe.com site):
    http://www.adobe.com/products/photoshop/cameraraw.html
    Mind that this is already the ACR 6 version that will only work with CS5.
    Scroll down for the latest version for CS4 which should be ACR 5.7
    Check your version in PSCS4: go to the menu Photoshop / about plug ins /
    Camera Raw, This should show only one plug in with version 5.7
    Also try to convert the files to DNG using Adobe's free DNG converter. DNG
    files have much benefit and work also with older ACR and PS versions:
    http://www.adobe.com/products/dng/
    Problem is BTW longstanding, every vendor uses his own Camera Raw format and
    to makes things worse, they also make a slightly different format for almost
    every new type of camera they put on the market.
    Adobe kindly delivers about 3 to 4 times a year a free new update for ACR
    and DNG with support for most of those cameras.
    It is best to first check compatibility with new cameras and third party
    software. If you want to work with Raw files you better wait until support
    is there or you have to use the vendor software (not always that nice to
    work with)
    The only app showing in the "Open With" pull down in Bridge is "Photomatix
    (default)". How so I change this default to PS4?

  • External SWF Disappears on Browser resize

    I am loading external swf's inside content_2 and when i resize my browser the external content OR content_2 disappears. Can someone help me as to what I need to do to stop this. I've tried adding an onresize function but that does not work. Here my as3 code:
    scroll_sb2.scrolling("content_2", "area_2", 0.18); // Range from 0.00 to 1.00
    stage.addEventListener(Event.RESIZE, resizeHandler);
    function resizeHandler(e:Event):void
    scroll_sb2.x = stage.stageWidth - scroll_sb2.width - 2;
    scroll_sb2.y = 0;
    scroll_sb2.height = stage.stageHeight;
    area_2.x = stage.stageWidth/2 - area_2.width/2;
    area_2.y = stage.stageHeight/2 - area_2.height/2;
    area_2.y = 0;
    area_2.height = stage.stageHeight;
    content_2.x = stage.stageWidth/2 - content_2.width/2;
    content_2.y = stage.stageHeight - content_2.height;  // comment this line if you whant to remove the carrusel affect on resize browser
    backgroundMC.x=0;
    backgroundMC.y=0;
    backgroundMC.width=stage.stageWidth;
    backgroundMC.height=stage.stageHeight;
    downbg_mc.x = 0;
    downbg_mc.y = 0;
    downbg_mc.width = stage.stageWidth;
    stage.align = StageAlign.TOP_LEFT;     
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.dispatchEvent(new Event(Event.RESIZE));
    var mem:String = Number ( System.totalMemory / 2048 / 2048 ).toFixed ( 2 ) + 'Mb';
    trace ( mem ); 

    Guys can you PLZZZ Help me out with this. I've been researching this ALL day with no solution, I'v
    e posted this in THREE forums and I havent gotten ONE response. Plz assist me!
    ALSO..This is the action script that's in my scrollbar movie:
    var sd:Number;
    var sr:Number;
    var cd:Number;
    var cr:Number;
    var new_y:Number;
    var drag_area:Rectangle;
    var scroll_content:MovieClip;
    var scroll_content_area:MovieClip;
    var scrolling_speed:Number; // 0.00 to 1.00
    //.............. SCROLL BUTTON .............//
    scroll_scroller.buttonMode = true;
    addEventListener ( MouseEvent.MOUSE_OVER, mouse_over );
    addEventListener ( MouseEvent.MOUSE_OUT, mouse_out );
    function mouse_over ( event:MouseEvent ) {
      scroll_scroller.alpha = 0.7;
    function mouse_out ( event:MouseEvent ) {
      scroll_scroller.alpha = 1;
    //.............. END scroll button...........//
    function scrolling( ct:String, ct_area:String, speed:Number ):void
    scrolling_speed = speed;
    if( scrolling_speed < 0 || scrolling_speed > 1 ) scrolling_speed = 0.50;
    scroll_content = parent[ct];
    scroll_content_area = parent[ct_area];
    scroll_content.mask = scroll_content_area;
    scroll_content.x = scroll_content_area.x;
    scroll_content.y = scroll_content_area.y;
    scroll_scroller.x = scroll_scrollable_area.x;
    scroll_scroller.y = scroll_scrollable_area.y;
    sr = scroll_content_area.height / scroll_content.height;
    scroll_scroller.height = scroll_scrollable_area.height * sr;
    sd = scroll_scrollable_area.height - scroll_scroller.height;
    cd = scroll_content.height - scroll_content_area.height;
    cr = cd / sd * 1.01;
    drag_area = new Rectangle( 0, 0, 0,scroll_scrollable_area.height -  scroll_scroller.height );
    if ( scroll_content.height <= scroll_content_area.height )
      scroll_scroller.visible = scroll_scrollable_area.visible = false;
    scroll_scroller.addEventListener( MouseEvent.MOUSE_DOWN, scroller_drag );
    scroll_scroller.addEventListener( MouseEvent.MOUSE_UP, scroller_drop );
    this.addEventListener( Event.ENTER_FRAME, on_scroll );
    function scroller_drag( me:MouseEvent ):void
    me.target.startDrag(false, drag_area);
    stage.addEventListener(MouseEvent.MOUSE_UP, up);
    function scroller_drop( me:MouseEvent ):void
    me.target.stopDrag();
    stage.removeEventListener(MouseEvent.MOUSE_UP, up);
    function up( me:MouseEvent ):void
    scroll_scroller.stopDrag();
    function on_scroll( e:Event ):void
    new_y = scroll_content_area.y + scroll_scrollable_area.y * cr - scroll_scroller.y  * cr;
    scroll_content.y += ( new_y - scroll_content.y ) * scrolling_speed;
    // END

  • Sinhala support - Sri Lanka

    Hi,
    I am working on a project at the moment which has the requirement to be localised into Sinhala.
    We are working with AS3, CS5 and the TLF, the text is being loaded in XML format.  We are using the font Iskoola Pota.
    I have a sample piece of text in xml, I load it in and set the text property of a Textfield instance to the loaded text. The Zero-Width-Joiners (ZWJ) are NOT removed and the glyphs combine correctly (as per the XML), however the line breaks (Text Field wraps the text) in the middle of a word where ZWJ/ZWNJ are present.  The wrapping is what I expect to see as I am purley setting the text property of a clasic text field.
    When I use TLF to create TextLine instances and add them to my container, the text breaks correctly - i.e. not in the middle of the word - however the ZWJs are removed causing the letters to be displayed individually (not joined).
    This is the AS I am using for reference:
    // create a line starting at the previous line (null, as non existant) and breaking at the width
                        var textLine:TextLine = textBlock.createTextLine(null, lineWidth);               
                        while (textLine)
                                  // position the x
                                  if (align == TextFormatAlign.CENTER) {
                                            // place this x at x location of the orig textfield + half its width minus half the textWidth of the new line
                                            textLine.x = (xPos + (lineWidth / 2)) - (textLine.textWidth / 2);
                                  } else if (align == TextFormatAlign.LEFT) {
                                            // place this x at x location of the orig textfield
                                            textLine.x = xPos;
                                  } else {
                                            // place this x at x location of the orig textfield + its width minus the textWidth of the new line
                                            textLine.x = (xPos + lineWidth) - textLine.textWidth;
                                  // add the height of the text
                                  yPos += textLine.height;
                                  // if not the first line, add some space down
                                  if (textLine.previousLine != null) {
                                            yPos += iVerticalLineSpacer;
                                  } else {
                                            //add 12%
                                            // TODO - need to come up with a better solution here
                                            yPos += textLine.height * 0.12;
                                  // position the y
                                  textLine.y = yPos;
                                  // add to sprite
                                  container.addChild(textLine);
                                  // create a line starting at the previous line (textLine) and breaking at the width
                                  textLine = textBlock.createTextLine(textLine, lineWidth);                         
    Does anyone have any insight into how to go about solving this issue?
    Thanks for your time,
    Dave

    Hi daithi,
    I can not quite understand your issue, could you please show you complement code, so I can see the effect of your issue, thanks. By the way, you use the FTE actually, not TLF.
    I am not sure is this your case bellow?
    package{
        import flash.display.Sprite;
        import flash.text.TextFormatAlign;
        import flash.text.engine.ElementFormat;
        import flash.text.engine.FontDescription; 
        import flash.text.engine.FontLookup; 
        import flash.text.engine.TextBlock; 
        import flash.text.engine.TextElement; 
        import flash.text.engine.TextLine; 
        public class Forum extends Sprite
            [Embed(mimeType="application/x-font", exportSymbol="iskpota", embedAsCFF="true", source="iskpota.ttf", fontName="iskpota")]
            private const iskpota:Class;
            public function Forum()
                    var xPos:int = 0;
                    var yPos:int;
                    var align:String;
                    var textBlock:TextBlock = new TextBlock();
                    var lineWidth:int = 200;
                    textBlock.content = new TextElement(
                        String.fromCharCode(
                            0x5185, 0x200D, 0x95A3, 0x5E9C, 0x304C, 0x300C, 0x653F, 0x5E9C, 0x30A4,
                            0x30F3, 0x30BF, 0x30FC, 0x30CD, 0x30C3, 0x30C8, 0x30C6, 0x30EC,
                            0x30D3, 0x300D, 0x306E, 0x52D5, 0x753B, 0x914D, 0x4FE1, 0x5411,
                            0x3051, 0x306B, 0x30A2, 0x30C9, 0x30D3, 0x30B7, 0x30B9, 0x30C6,
                            0x30E0, 0x30BA, 0x793E, 0x306E
                    var elementFormat:ElementFormat = new ElementFormat();
                    var font:FontDescription = new FontDescription();
                    font.fontLookup = FontLookup.EMBEDDED_CFF;
                    font.fontName = "Iskpota";
                    elementFormat.fontDescription = font;
                    textBlock.content.elementFormat = elementFormat;
                    // create a line starting at the previous line (null, as non existant) and breaking at the width
                    var textLine:TextLine = textBlock.createTextLine(null, lineWidth);
                    while (textLine)       
                           // position the x
                           if (align == TextFormatAlign.CENTER)
                              // place this x at x location of the orig textfield + half its width minus half the textWidth of the new line
                                textLine.x = (xPos + (lineWidth / 2)) - (textLine.textWidth / 2);
                           } else if (align == TextFormatAlign.LEFT)
                             // place this x at x location of the orig textfield                           
                                  textLine.x = xPos;
                           } else
                         // place this x at x location of the orig textfield + its width minus the textWidth of the new line
                                textLine.x = (xPos + lineWidth) - textLine.textWidth;
                          // add the height of the text
                           yPos += textLine.height;
                         // if not the first line, add some space down
                            if (textLine.previousLine != null)
    //                        yPos += iVerticalLineSpacer;
                            yPos += textLine.height * 0.12;
                           } else
                           //add 12%
                         // TODO - need to come up with a better solution here
                                  yPos += textLine.height * 0.12;
                        // position the y
                             textLine.y = yPos;
                         // add to sprite
                            this.addChild(textLine);
                         // create a line starting at the previous line (textLine) and breaking at the width
                             textLine = textBlock.createTextLine(textLine, lineWidth); 

  • Stage.stageWidth in Percent not Pixels

    Hi All,
    I am trying to set masks and other component positions in relation to Stage size.
    AS3 CS5
    I trace stage.stageWidth on a 800x600 pixel stage and I get - 100
    My stage will scale within a Director piece.
    Is this a bug? Modal condition? Releated to scaling??
    Thanks,
    Jim

    Now this is interesting.
    stop();
    trace ("The Stage width is " + root.stage.stageWidth);
    trace ("The Stage height is " + this.stage.stageHeight);
    var temp:Number = new Number();
    temp = stage.width;
    trace(temp);
    The first time I run the swf-compile (ctrl-Enter) - It Output the following:
    Page1 is now loaded
    The Stage width is 100
    The Stage height is 100
    0
    While the SWF is still selected (being viewed) I hit ctrl-Enter again and I get this add to it:
    Page1 is now loaded
    The Stage width is 1874
    The Stage height is 763
    0
    This is the size of my stage window in the FLA development window.
    I drag it out of the projects bar to be an independent window and it gives me what I expected:
    Page1 is now loaded
    The Stage width is 800
    The Stage height is 600
    0
    Note I can make the window any size and I get the same right -expected - answer, except when it overlaps other Flash dev. window objects or a display border.
    food for thought,
    Jim

Maybe you are looking for