Problem with TextConverter.importToFlow

Hello!

I am better thanks to Richard's first response on my first post. And now format and applying the format is no longer a problem for me !

But now I have a little problem with the TextConverter.importToFlow

The goal: a user create his own text editing and pasting and changing the style. Can he save it. I have therefore to convert my textflow into an xml file and save an XML file.

Then open this file. So I have to convert the xml into a TextFlow type to display it in my AIR application.

My XML: (details)

< Note >
" < TextFlow columnCount ="inherit"columnGap ="inherit"columnWidth ="inherit"lineBreak ="inherit"paddingBottom ="inherit"paddingLeft ="inherit"paddingRight ="inherit"paddingTop ="inherit"verticalAlign ="inherit"whiteSpaceCollapse ="preserve"xmlns =" http://ns.Adobe.com/TextLayout/2008 ">
< p >

< span > any animal (including human) who just ate expense in the hours following a </span > energy
< span textDecoration = "highlight" > important dedicated </span >
< span > a stomach digestion. </span >
< /p >
< / TextFlow >
< / note >

My problem is:

I don't know why, but I can't do

myXML.TextFlow

or

myXML.child ("TextFlow").

A mix of error appears (null reference).

' After a few tries, I found that xmlns = " http://ns.Adobe.com/TextLayout/2008 "Argument of TextFlow is the source of the error of compil. "

But I must give only the < TextFlow > tag to the importToFlow of the method without the note <>. What am I supposed to do? I can't access the tag < TextFlow >...

public void updateDetails (details: XML): void
{
If (details! = null)
{
var loadTextFlow:TextFlow is TextConverter.importToFlow (details.toString (), TextConverter.TEXT_LAYOUT_FORMAT);.
_textFlow = loadTextFlow;
_textFlow.interactionManager = new EditManager (new UndoManager());
_textFlow.interactionManager.selectRange (0,0);
_textFlow.flowComposer.updateAllControllers ();
_textFlow.interactionManager.SetFocus ();
}
}

Thank you for your help

It works:

static public const = noteXML:XML
      http://ns.Adobe.com/TextLayout/2008">
       

Any animal (including human) who just ate expense in the hours following an energy
          important dedicated
          a stomach digestion.
       


     
  
           
private void importIt (): TextFlow
{
var textFlowXML:XML = noteXML... *: TextFlow [0];
var textFlow:TextFlow = TextConverter.importToFlow (textFlowXML, TextConverter.TEXT_LAYOUT_FORMAT);
return textFlow;
}

Can read the E4X docs if you plan do a lot of handling XML. Here is a good starting point:

http://help.Adobe.com/en_US/AS3LCR/Flash_10.0/XML.html

Could be added - it is a matter of namespace - it seems it should be simpler that what I wrote above, but I was not able to simplify.

Hope that helps,

Richard

Tags: Adobe Open Source

Similar Questions

  • Problems with the method applylink on editmanager

    Hello

    Currently I am working on a text editor that uses the class editmanager package flashx.textLayout.edit do and transform the text. When I try to turn a piece of text (textflow) linking through the "applylink" on the editmanager class method, the selected text where I applied the link gets concatenated with the words preceding and following. If start and end spaces are removed text which is turned into a link.

    The textflow before modifying, for example, the "previous next link" text looks like this:

    " < TextFlow whiteSpaceCollapse ="collapse"version ="2.0.0"xmlns =" http://ns.Adobe.com/TextLayout/2008 ">

    < p >

    < span color = "#000000" > previous link next </span >

    < /p >

    < / TextFlow >

    After you apply the link on the word 'link' the textflow looks like this:

    " < TextFlow whiteSpaceCollapse ="collapse"version ="2.0.0"xmlns =" http://ns.Adobe.com/TextLayout/2008 ">

    < p >

    < span > < / span >

    < span color = "#000000" > </span > previous

    " < a href =" http://www.Google.com "target ="_blank"> "

    link < span > </span >

    < /a >

    < span color = "#000000" > next </span >

    < span > < / span >

    < /p >

    < / TextFlow >

    And the "previous next link" text is presented as 'previouslinkfollowing '.

    I used a TextArea component and a component RichEditableText as well as TextFlowUtil.importFromXML and TextConverter.importToFlow (text, TextConverter.TEXT_FIELD_HTML_FORMAT) and some other combination as well, but nothing seems to solve the problem.

    Does anyone know how to avoid this problem?

    Thank you and best regards,

    A.S. Doghqa

    Post edited by: asdoghqa

    Solved this problem by setting the property "whiteSpaceCollapse" on the TextLayoutFormat, that applies to the selection of the EditManager, to 'WhiteSpaceCollapse.PRESERVE ';

  • Errors with TextConverter with Configuration

    Hello

    I try to use the latest sdk flex (4.1.0.16032) but can not solve this problem:

    var conf:Configuration = new Configuration()


    var linkNormalFormat:TextLayoutFormat = new TextLayoutFormat()

    conf.defaultLinkNormalFormat = linkNormalFormat;


    textFlow = TextConverter.importToFlow (value, TextConverter.TEXT_LAYOUT_FORMAT, conf);


    trace (textFlow) / / null

    That's why zero?

    When I use textFlowInitialFormat:

    conf.textFlowInitialFormat = format;

    textFlow is not null and everything works fine.

    When I use defaultLinkHoverFormat:

    conf.defaultLinkHoverFormat = linkNormalFormat;

    textFlow is created correctly bu sure I get error on roll:

    TypeError: Error #1034: Type coercion failed: cannot convert flashx.textLayout.formats::TextLayoutFormat@1423e881 to flashx.textLayout.formats.TextLayoutFormatValueHolder.
    to flashx.textLayout.elements::LinkElement/computeLinkFormat() [C:\Vellum\branches\v1\1.1\dev \output\openSource\textLayout\src\flashx\textLayout\elements\LinkElement.as:427]
    at flashx.textLayout.elements::LinkElement/get http://NS.adobe.com/TextLayout/Internal/2008:effectiveLinkElementTextLayoutFormat () [C:\Ve llum\branches\v1\1.1\dev\output\openSource\textLayout\src\flashx\textLayout\elements\LinkE only .as: 458]
    to flashx.textLayout.elements::LinkElement/setToState() [C:\Vellum\branches\v1\1.1\dev\output \openSource\textLayout\src\flashx\textLayout\elements\LinkElement.as:517]
    to flashx.textLayout.elements::LinkElement/mouseOverHandler() [C:\Vellum\branches\v1\1.1\dev\ output\openSource\textLayout\src\flashx\textLayout\elements\LinkElement.as:780]

    Is this a bug?

    Hello

    Which reads like 1.1 bug to me.  Try replacing:

    var linkNormalFormat:TextLayoutFormat = new TextLayoutFormat()

    with

    Import flashx.textLayout.formats.TextLayoutFormatValueHolder;

    var linkNormalFormat:TextLayoutFormat = new TextLayoutFormatValueHolder();

    Just FYI: class TextLayoutFormatValueHolder is hidden in 1.1 (the ExcludeClass metadata tag).  FWIW in it 2.0 replaces TextLayoutFormat.  It is a much more efficient formats representation where only a few are defined.

    Hope that helps,

    Richard

  • error on 4.1.0.14965 SDK: TextConverter.importToFlow not to accept a Configuration

    Hello

    I got an error of sudden to update my SDK to 4.1.0.14965 that is just out. The error is just that TextConverter.importToFlow does not create the TextFlow, it returns null, so the rest of my code gets crashed.

    I tried to isolate the error that I could and here's the status:

    -everything worked fine until SDK 4.1.0.14883

    -the TextFlow not created when the source has an < a > tag (not sure if this happens with other tags) (this works very well if the source has no additional tags)

    -TextFlow was created perfect if I wasn't a Configuration (even with an < a > tag in the source)

    If my guess is that there are some new changes to the Configuration, especially in the part of link format, but I couldn't find anything else that might guide me to solve this. I looked on the TLF, code source, language reference, and nothing release notes!

    Everyone assumes that how to solve that? Is there indeed any update at day in the TLF source in this article? Is this a bug?

    It's my use of importToFlow:

    __tflow = TextConverter.importToFlow (__xml.toXMLString (), TextConverter.TEXT_LAYOUT_FORMAT, sprd.config);

    . Source XML formatted TLF
    . TextConverter.TEXT_LAYOUT_FORMAT as the format
    . a Configuration settings
    Thank you very much!!
    André

    You may run an integration error that I've heard today. The Flex 4.1 project is picking up a new generation of TLF 1.1, but the first integration did not work (the TLF build number has been incremented, but not the version number). Could you try to 4.1.0.14865 to see if that solves your problem of backup?

  • problem with function getCharIndexAtPoint

    Hello

    I encountered a strange problem using; It is a simple code that works well:

    package

    {

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    import fl.text.TLFTextField;

    import flash.text.TextFieldType;

    import flash.geom.Rectangle;

    import flashx.textLayout.elements.Configuration;

    import flashx.textLayout.elements.TextFlow;

    import flashx.textLayout.conversion.TextConverter;

    import flashx.textLayout.conversion.ConversionType;

    public class scrollV extends Sprite

            {

    private var tlf:TLFTextField = new TLFTextField;

    private var str:String = "click on this text field. Compare the ' + '.

    ' difference between clicking without «+»»

    'selection versus clicking and selecting text.';

    public function scrollV()

               {

    var config:Configuration = TextFlow.defaultConfiguration;         

    config.manageTabKey = true; / / activate the tab key

    addChild (tlf); tlf.width = 200;

    tlf.text = str;

    tlf.wordWrap = true;

    tlf.type = TextFieldType.INPUT;

    tlf.addEventListener (MouseEvent.CLICK, printCursorPosition);

    trace (TextConverter.export (tlf.textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE) as String);

                }

    printCursorPosition(e:*):void private function

                {

    trace ("tank #:", tlf.caretIndex + "from:", tlf.selectionBeginIndex + "to:", tlf.selectionEndIndex);

    var rett:Rectangle = tlf.getCharBoundaries (tlf.caretIndex);

    trace ("char pos:" + rett.x +', ' + rett.y);

    trace ("idx #:" + tlf.getCharIndexAtPoint (rett.x, rett.y));

               }

           }

    }         

    In this code, the function getCharIndexAtPoint works properly; then I wanted to try the same function but using textFlow and, using the export trace output, I wrote the following code:

    package

    {

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    import fl.text.TLFTextField;

    import flash.text.TextFieldType;

    import flash.geom.Rectangle;

    import flashx.textLayout.elements.Configuration;

    import flashx.textLayout.elements.TextFlow;

    import flashx.textLayout.conversion.TextConverter;

    import flashx.textLayout.conversion.ConversionType;

    import flashx.textLayout.container.ContainerController;

    public class scrollV extends Sprite

       {

    private var tlf:TLFTextField = new TLFTextField;

    private var str:String = '< TextFlow columnCount = "inherit" +

    "columnGap ="inherit"+"

    "columnWidth ="inherit"' + '.

    ' lineBreak = "explicit" paddingBottom = "inherit" +.

    "paddingLeft ="inherit"' + '.

    "paddingRight ="inherit"paddingTop ="inherit "+".

    "renderingMode = 'normal' ' +"

    "verticalAlign ="inherit"+"

    "whiteSpaceCollapse ="preserve"' +"

                                             'xmlns=" http://ns.Adobe.com/TextLayout/2008 "> '+

    ' < p > < span renderingMode = "inherit" > "+

    "Click on this text field. Compare the difference '.

    "between clicking without selecting ' + '.

    "versus clicking and text selection. '" +

    ' </span > < / p > ' +.

                                             '</TextFlow>';

    scrollV() of the public service

              {

    var config:Configuration = TextFlow.defaultConfiguration;         

    config.manageTabKey = true; / / activate the tab key

    addChild (tlf); tlf.width = 200;

    tlf.textFlow = TextConverter.importToFlow (str, TextConverter.TEXT_LAYOUT_FORMAT);

    control of the var: ContainerController = new ContainerController (tlf);

    tlf.textFlow.flowComposer.addController (control);

    tlf.textFlow.flowComposer.compose ();

    tlf.textFlow.flowComposer.updateAllControllers ();

    tlf.wordWrap = true;

    tlf.type = TextFieldType.INPUT;

    tlf.addEventListener (MouseEvent.CLICK, printCursorPosition);

    trace (TextConverter.export (tlf.textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE) as String);

               }

    printCursorPosition(e:*):void private function

              {

    trace ("tank #:", tlf.caretIndex + "from:", tlf.selectionBeginIndex + "to:", tlf.selectionEndIndex);

    var rett:Rectangle = tlf.getCharBoundaries (tlf.caretIndex);

    trace ("pos:" + rett.x +', ' + rett.y);

    trace ("idx #:" + tlf.getCharIndexAtPoint (rett.x, rett.y));

               }

         }

    }         

    in this code the getCharIndexAtPoint function gives the error #1009: cannot access a property or method of a null object reference.

    Does anyone know how to tell me where the error in this code?

    Thank you for all.

    1 TLFTextField is a kind of Sprite (extends Sprite). So, your solution makes sense anyway. I suggest that you first ask the question again on the Sub-Forum related to Flash pro (or Flash authoring), because TLFTextField is under their control, rather than TLF.

    2. more than details on TLF, you can see its codes, the docs and examples in http://sourceforge.net/adobe/tlf/home/

    How to implement * getCharIndexAtPoint *.

    TLF cursor may return its own position, which can also present the index of the char.

    Example Code:
    textFlow.interactionManager = new SelectionManager();

    textFlow.interactionManager. activePosition

    textFlow.interactionManager. anchorPosition

  • problems with, phone, 6, Bluetooth kit, Nissan, after update, for, Rios, 1.0.2

    After the update to ios 10.0.2 - trying to use bluetooth to call my vehicle, it says: "this article is not in your phone book." How can I solve this problem?

    Greetings, joybelino1!

    Thank you for joining the communities Support from Apple! I can't wait to see that you are having problems with your Bluetooth in your car! The good news is that Apple has a great article that will help you with measures to try to resolve the problem. Read this article to gethelp to connect your iPhone, iPad, or iPod touch with your car radio. Even though he talks about problems with the connection, it also has the steps for other questions you may have once connected.

    If you use Bluetooth

    1. Consult the user manual of your car stereo to get the procedure to a Bluetooth device.
    2. On your iOS device, drag up to open Control Center, then press ontwice to turn on Bluetooth and turn it back on.
    3. Restart your iOS device.
    4. On your iOS device, Cancel the twinning of your car radio. On the screen of your car désapparier your iOS device and any other device. Restart your car and your iOS device, then pair and connect again.
    5. Update your iOS device.
    6. Install the updates to the firmware of your car radio.
    7. If you still not connect, contact Apple technical support.

    Have a great day!

  • Anyone having problems with WiFi connectivity after upgrade to Sierra?

    I was wondering if anyone else knows issues with WiFi connectivity since the upgrade to Sierra 10.12? I have not had any problems with connectivity WiFi previously on El Capitan. Now I have regular randomly loose connectivity. My internet is cable and when it is connected I have a 100% connection. My details of iMac and I have used only 10% of my storage.

    No problem with my iphone 6.

    Hello AspDesigns,

    I understand that, since the upgrade to Mac OS Sierra, your Mac seems to have trouble staying connected to Wi - Fi. Fortunately the diagnosis built-in wireless can help identify the source of so much trouble.

    Search for Wi - Fi using your Mac problems

    See you soon!

  • Problems with mail after switching to macOS Sierra

    Hey all

    After having recently upgraded to macOS Sierra, I am unable to read my mail.

    I get the following error every time I check on "Get Mail".

    There may be a problem with the mail server or the network. Check the account settings "*" or try again.

    The server returned the error: Mail could not connect to the server 'pop1.tribcsp.com' using SSL on the default ports. Verify that this server supports SSL and that your account settings are correct.

    What does this error message mean and how can I solve this problem.

    Thank you

    Hi Michael,

    I see your message that you get an error in the mail indicating that there is a problem with the mail server or the network.  To help get this problem resolved, I suggest that you follow the steps below:

    If mail refers to a problem with the mail server, or the network

    Mail will say that it is impossible to connect due to a problem with the mail server or the network. For example, the message may refer to a connection that has expired, or too many simultaneous connections:

    If you are connected to the Internet, but the connection has expired, your email provider might be affected by a discontinuance of service. Contact them or see their status Web page to ensure that their e-mail service is online. Examples of status pages:

    If the message indicates the number of simultaneous connections, too many of your devices is check your e-mail account at the same time. Quit Mail on one or more of your other devices.

    If you are still unable to send or receive e-mails

    1. Make sure that you have installed latest version of the Mac software updates, especially if the problem occurred immediately after the installation of a previous update.
    2. In OS X El Capitan or later version, you can see a status icon and the short error message in the upper right of the Mail window, under the search box. The message may indicate 'Network offline' or 'Connection failed', for example. Click the message to see more details on the issue.
    3. Check your connection to the Mail connection doctor. It might be able to say more on the issue.

    If you cannot send or receive e-mail on your Mac.

    Take care.

  • iMac 27 "mid-2011 - Intermittent problem with CPU fan running at full speed and sleep mode.

    Hello!

    My iMac 27 "has an intermittent problem with the CPU fan runs at full speed. Sometimes it happens at the time when I start it, sometimes only in my session, and sometimes only after a certain time. So does seem to be a problem of "heating".

    Second issue is with the mode 'sleep'. It may occur also at any time, at the start of the iMac, session, or after a certain time. But once he starts to go in mode 'sleep', when I wake up, it goes right back in mode after a few seconds and that it will continue indefinitely until I restart the computer.

    What could be?

    Please help me!

    4ntoine

    Here is my model of iMac:

    iMac 27 "mid-2011 model 12.2

    Intel Core i7 3.4 GHz

    AMD Radeon HD 6970M 1024 MB

    OS X El Capitan 10.11.6
    SMC 1.72f2

    Boot ROM IM121.0047.B23

    reset the SMC

    Reset the management system (SCM) controller on your Mac - Apple Support

  • problem with playing the clash of clans

    I'm having some problems while playing the clash of clans on my 2 mini ipad screen does not seem to meet sometimes as if it was some sort of delay so I have to tap several times in order to use a filter or throw the troops on the battlefield.

    Hi Trinitygr,

    Thanks for posting in the Community Support from Apple! I understand that you are having problems with your iPad screen while playing a game. I like to play games on my iPad and I don't see how this could be a nuisance. I'm happy to offer assistance.

    Are you only had this problem when using the app clash of Clans, or does it happen in all applications? I recommend to start by following the steps described in this article:
    If an application you have installed unexpectedly closes, unresponsive, or does not open

    Take care!

  • I'm having problems with an outdated Apple ID

    I have problems with updating Apps etc in my Apple account because he always asked an obsolete in sign.  How can I change this?

    Hello

    Go down to itunes apple ID Delete page homepage all ID and then add it back back.

    See you soon

    Brian

  • Anyone having problems with the new iPhone LTE connection 7 on Verizon?

    I am now on my iPhone second 7 with Verizon. I had four phones for me and my family. I have now had issues where I have no signal in the same areas where my signal allows to be strong. I can't solve the problem with the activation/deactivation of the airplane and then mode again in normal mode. My phone will rest with no signal for 5 minutes, then going to LTE with three bars. I also had the problem where I had only 1 x signal, while my son standing right next to me has LTE. And he had the same questions, where I'm on LTE and it gets no signal. I use to have LTE where I live and work all the time, now it's spotty at best. Apple has replaced me and my sons iPhones but not luck. Still do. Any ideas or an any other suffering?

    (1) go to settings/cell phone/cellular data Options/enable LTE and select ONLY the DATA. This seems to solve the problem (as a temporary solution) for most of the people affected by this problem. The bad part is your request might not be as clear (since they cannot use the highest LTE signals) and you can make calls and data at the same time. But it does not solve the issue.

    (2) there are rumors (but you didn't hear that from me that we only are not supposed to discuss beta software program Apple in this forum) that the new version of Apple Beta for iOS (which also includes an update of the software carrier Verizon to 26.0) seems to solve this problem. So, there's a light at the end of the tunnel.

  • Problem with some fonts of symbols after the installation of the Sierra

    Hello

    I have recently upgraded the OS on my iMac late 2012 for Sierra, since doing so, I noticed a problem with several fonts.

    All symbolic symbols Apple to Wingdings fonts not correctly displayed in the font book. Apple symbols looks like a standard wheelbase of san, and other symbolic fonts just show as question marks '?' where the images should be.

    In text editing, that I can't even see the symbolic fonts like Zapf Dingbats and Wingdings in the selector. However, they all work well in Adobe Illustrator (CS5) and Microsoft Word 2011. Apple symbols still looks like a standard font.

    I already tried the following:

    1. check the fonts in font book

    2 fix the duplicates in the font book

    3. using the "Restore Standard fonts" option in the font book

    4 deleting a file in the folder Preferences plist Fonts

    5 deleted the cache of police and the database

    I'm out of ideas. Has anyone else had the same problem found a fix?

    Kind regards

    Greville

    I'm just to add that I used the recovery partition to do a clean install of Sierra on a hard drive external and then booted into it to see if it had the same problem.

    And he does. Wingdings and other photo fonts appear as '?' in boxes where the letters must be in the font book.

    So this seems like a problem with the way Sierra displays these fonts, not with the font files themselves.

  • ios10 problem with non-users of iphone messaging

    After upgrading my iPhone 6 ios10, I had intermittent problems with the messaging of Android users (basically, the conversations no iMessage). In about 60% of the time it is not just to deliver the message no matter what I do (pressing the 'Try Again' don't work do not). He has no problem with the reception of the texts, but I can't answer to Android users (Interestingly, I can message users of Android if they are in a group with iPhone users text). I tried everything was updated to the last verision until reset of ios everything.

    I can't find anything online about this. I'm the only one who what?

    Group Messaging uses the MMS. Normal text messages using SMS. SMS uses the voice channel to transfer messages and is strictly a basic function. If you are experiencing problems sending SMS, contact your carrier.

  • I have problems with ios 9.3.5

    my ipod says it's still Friday, September 23 when it is Monday 26 and is stuck in the 04:00 time when I change the time, the screen turns off a color at random, then restarts then both will and I have to change but rest later if it changes at all used to date will not change anything and it runs still works when it wants to and it doesn't stay connected to WiFi , I have the ipod 5th generation and am not elligible for ios 10 Please if you can solve this problem with ios 9.3.5 I would be very grateful as I use my ipod for almost everything. Thanks - René

    It is a community based on the user. You do not speak to Apple directly. You can contact the Apple Support here: http://www.apple.com/ca/contact/

Maybe you are looking for