TextFlow.verticalAlign
When Setting Vertical Align on a TextFlow to VerticalAlign.MIDDLE or VerticalAlign.BOTTOM, The First TextFlowLine Selection and Caret is vertically offset with respect to the distance of vertical space between the top of the Container boundary and the top of the First Line of Text.
What is the trick to make the Text Selection line up on the First TextFlowLine when verticalAlign is not set to 'top'?
below is a simple code example that demonstrates it. The first line of text "Hello World" is positioned properly, however when you click on
the TextLine to edit it, the Caret appears some 100 pixels below where its supposed to, and so does the text selection.
I am loading this module within an app that is compiled in SDK 3.2
/****************************** BEGIN CODE ******************************/
package {
import flash.text.engine.BreakOpportunity;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.Configuration;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.formats.VerticalAlign;
import mx.core.UIComponent;
public class TextFrameExample extends UIComponent
var textFlow:TextFlow;
public function TextFrameExample()
var config:Configuration = new Configuration();
var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
textLayoutFormat.color = 0xFF0000;
textLayoutFormat.fontFamily = "_sans";
textLayoutFormat.fontSize = 22;
textLayoutFormat.breakOpportunity = BreakOpportunity.ANY;
textLayoutFormat.verticalAlign = VerticalAlign.MIDDLE;
config.textFlowInitialFormat = textLayoutFormat;
textFlow = new TextFlow(config);
var globalP:ParagraphElement = new ParagraphElement();
var p:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
span.text = "Hello, World!";
p.verticalAlign = VerticalAlign.TOP;
p.addChild(span);
textFlow.addChild(p);
p = new ParagraphElement();
span = new SpanElement();
p.verticalAlign = VerticalAlign.TOP;
span.text = "Next Line should be split into some columns after all this right? i mean come on";
p.addChild(span);
textFlow.addChild(p);
p = new ParagraphElement();
span = new SpanElement();
span.verticalAlign = VerticalAlign.TOP;
span.text = "Next Line should be split into some columns after all this right? i mean come on";
p.addChild(span);
textFlow.addChild(p);
textFlow.interactionManager = new EditManager();
textFlow.flowComposer.addController(new ContainerController(this, 0, 0));
textFlow.flowComposer.getControllerAt(0).setCompositionSize(500, 500);
textFlow.flowComposer.updateAllControllers();
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
textFlow.flowComposer.getControllerAt(0).setCompositionSize(unscaledWidth, unscaledHeight);
textFlow.flowComposer.updateAllControllers();
/****************************** BEGIN CODE ******************************/
Thanks for your time!
Bow
The verticalAlign property in TLF works only at the TextFlow or container level. So you can set the verticalAlign for an entire component, but not for individual paragraphs or spans. That's something it would be nice to add in the future, but not supported now. Sorry.
- robin
Similar Messages
-
Hello forum,
I've been trying to get various things done with TLF, and every time I encounter the same problem. There are no decent documentation to be found anywhere on the web. This really raises my dissatisfaction levels. Since flash 6 all i wanted to have in text field is simply support img tag in htmlText like it was supposed to. Well tlf seems to do that, however now im stuck with a pseudo html/xml code that has no documentation. How do you get this text flow monster to understand hyperlinks, and I don't want use actionscript for it, I need it to be external XML.
People, please point me to the documentation on textflow xml syntax<text id="ending">
<![CDATA[
<flow:TextFlow verticalAlign="middle" paddingTop="0" paddingBottom="0" paddingLeft="0" paddingRight="0" columnCount="1" columnWidth="auto" whiteSpaceCollapse="preserve" xmlns:flow="http://ns.adobe.com/textLayout/2008">
<flow:p textAlign="center">
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF">
Pixelfarm bedenkt en creeert effectieve
</flow:span>
</flow:p>
<flow:p textAlign="center">
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF">
digitale communicatie.
</flow:span>
</flow:p>
<flow:p textAlign="center">
</flow:p>
<flow:p textAlign="center">
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Demi Cond" fontLookup="embeddedCFF">
Ook nieuwsgierig wat we voor
</flow:span>
</flow:p>
<flow:p textAlign="center">
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Demi Cond" fontLookup="embeddedCFF">
uw merk kunnen betekenen?
</flow:span>
</flow:p>
<flow:p textAlign="center">
</flow:p>
<flow:p textAlign="center">
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF">Email ons op </flow:span>
<flow:a href="mailto:[email protected]">
<flow:span color="0xD8363D" fontSize="18" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF">[email protected]</flow:span>
</flow:a>
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF"> of kijk op</flow:span>
</flow:p>
<flow:p textAlign="center" textJustify="interWord">
<flow:a href="http://www.pixelfarm.nl" target="_blank"><flow:span color="0xD8363D" fontSize="18" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF" >www.pixelfarm.nl</flow:span></flow:a>
<flow:span fontSize="18" color="0x999999" fontFamily="Franklin Gothic Book" fontLookup="embeddedCFF">
voor een overzicht met werk.
</flow:span>
</flow:p>
</flow:TextFlow>
]]>
</text>
and heres the AS3 code
public function set comment(parValue:String):void {
var textXML:XML = XML(parValue);
if (_commentContainer) {
TweenMax.to(_commentContainer, 0.5, { alpha:0, onComplete:Constants.cleanRemoveChild, onCompleteParams:[_commentContainer] } );
_commentContainer = null;
if (_textContainer) {
TweenMax.to(_textContainer, 0.5, { alpha:0, onComplete:Constants.cleanRemoveChild, onCompleteParams:[_textContainer] } );
if(!_importer){
_importer = new TextLayoutImporter(new Configuration());
_flow = _importer.createTextFlowFromXML(textXML);
_textContainer = new Sprite();
_timeline.addChild(_textContainer);
_containerController= new ContainerController(_textContainer, _timeline.stage.stageWidth, _timeline.stage.stageHeight);
_flow.flowComposer.addController(_containerController);
_flow.flowComposer.updateAllControllers();
_textContainer.alpha = 0;
TweenMax.to(_textContainer, 0.5, { alpha:1, delay:0.5 } ); -
PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
I'm printing a datagrid using something like this...
<mx:PrintDataGrid
id="printDataGrid"
width="100%"
height="100%"
showHeaders="false"
borderVisible="false"
horizontalGridLines="false"
variableRowHeight="true"
dataProvider="{titles}"
>
<mx:columns>
<mx:DataGridColumn
itemRenderer="renderer.TitlePrintRenderer"
/>
</mx:columns>
</mx:PrintDataGrid>
TitlePrintRenderer.mxml has s:RichText component. I use RichText's textFlow property to render the text. The approach is working fine except that if the textFlow has embedded images (<img source=... />), the images are not printed!
Is this a bug? Is it a limitation? Has anyone come across this issue?
I'm using Flex SDK 4.5.1After struggling for 4+ days on using timer / events for printing PrintDataGrid with embedded images in RichText's textFlow, I tried your other suggestion... to convert <img> tags to InlineGraphicElement and give it Bitmap from image loaded from a .gif file. The approach works but the printout skips images in a few rows!
I've this test case in which, every time I print, it skips printing image in the second row! I also implemented this approach in a more complex test case and depending on the total number of rows, it would skip printing image in different number of rows. I'm suspecting that even if you construct InlineGraphicElement from bitmap loaded from an image, PrintDataGrid's renderer still skips printing image intermittently.
I would very much appreciate it if you could create small project from my following code and verify this behavior. I'm at my wit's end in getting this printing to work.
PrintImagesTest.mxml
=================
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
initialize="initData();"
viewSourceURL="srcview/index.html"
>
<s:layout>
<s:VerticalLayout
paddingLeft="20" paddingRight="20"
paddingTop="20" paddingBottom="20"
/>
</s:layout>
<mx:Button
label="Print"
click="printClickHandler();"
/>
<fx:Script>
<![CDATA[
import flash.utils.setTimeout;
import flashx.textLayout.elements.InlineGraphicElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import mx.collections.ArrayCollection;
import mx.printing.*;
import mx.utils.OnDemandEventDispatcher;
public var contentData:ArrayCollection;
private var embeddedImages:ArrayCollection;
private var numberOfImagesLoaded:int;
public var printJob:FlexPrintJob;
public var thePrintView:FormPrintView;
public var lastPage:Boolean;
private var textFlowNS:Namespace = new Namespace("http://ns.adobe.com/textLayout/2008");
public function initData():void {
contentData = new ArrayCollection();
var page:int = 0;
for (var z:int=0; z<20; z++) {
var content:Object = new Object();
content.srNo = z+1;
content.contentText =
"<TextFlow whiteSpaceCollapse='preserve' xmlns='http://ns.adobe.com/textLayout/2008'>" +
"<span>some text</span>" +
"<img width='53' height='49' source='assets/images/formula.gif'/>" +
"</TextFlow>";
contentData.addItem(content);
public function printClickHandler():void {
convertToTextFlow();
private function convertToTextFlow():void {
embeddedImages = new ArrayCollection();
numberOfImagesLoaded = 0;
for each (var contentElement:Object in contentData) {
extractImageInfo(contentElement.contentText);
if (embeddedImages.length > 0) {
loadImage(embeddedImages.getItemAt(0).source);
} else {
printData();
private function extractImageInfo(contentText:String):void {
var textXml:XML = new XML(contentText);
var imageList:XMLList = textXml.textFlowNS::img;
for each (var img:XML in imageList) {
var embeddedImage:Object = new Object();
embeddedImage.source = String(img.@source);
embeddedImage.width = parseInt(img.@width);
embeddedImage.height = parseInt(img.@height);
embeddedImages.addItem(embeddedImage);
private function loadImage(imageSource:String):void {
var loader:Loader = new Loader();
var urlRequest:URLRequest = new URLRequest(imageSource);
loader.load(urlRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
private function imageLoaded(e:Event):void {
embeddedImages.getItemAt(numberOfImagesLoaded).bitmap = (Bitmap)(e.target.content);
embeddedImages.getItemAt(numberOfImagesLoaded).width = ((Bitmap)(e.target.content)).width;
embeddedImages.getItemAt(numberOfImagesLoaded).height = ((Bitmap)(e.target.content)).height;
++numberOfImagesLoaded;
if (numberOfImagesLoaded < embeddedImages.length) {
loadImage(embeddedImages.getItemAt(numberOfImagesLoaded).source);
} else {
// all the images have been loaded... convert to textflow
buildContent();
printData();
private function buildContent():void {
var contentIndex:int = 0;
for each (var contentElement:Object in contentData) {
if (hasImage(contentElement.contentText)) {
buildTextFlow(contentElement, contentIndex);
++contentIndex;
private function buildTextFlow(content:Object, contentIndex:int):void {
var textXml:XML = new XML(content.contentText);
var p:ParagraphElement = new ParagraphElement();
for each(var child:XML in textXml.children()) {
switch (child.localName()) {
case "span":
var span:SpanElement;
span = new SpanElement();
span.text = child;
span.fontSize = 10;
p.addChild(span);
break;
case "img":
var image:InlineGraphicElement;
image = new InlineGraphicElement();
image.source = embeddedImages.getItemAt(contentIndex).bitmap;
image.width = embeddedImages.getItemAt(contentIndex).width;
image.height = embeddedImages.getItemAt(contentIndex).height;
p.addChild(image);
break;
content.textFlow = new TextFlow();
content.textFlow.addChild(p);
private function hasImage(contentText:String):Boolean {
var textXml:XML = new XML(contentText);
var imageList:XMLList = textXml.textFlowNS::img;
if (imageList.length() > 0) {
return true;
} else {
return false;
private function printData():void {
printJob = new FlexPrintJob();
lastPage = false;
if (printJob.start()) {
thePrintView = new FormPrintView();
addElement(thePrintView);
thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;
thePrintView.printDataGrid.dataProvider = contentData;
thePrintView.showPage("single");
if(!thePrintView.printDataGrid.validNextPage) {
printJob.addObject(thePrintView);
} else {
thePrintView.showPage("first");
printJob.addObject(thePrintView);
while (true) {
thePrintView.printDataGrid.nextPage();
thePrintView.showPage("last");
if(!thePrintView.printDataGrid.validNextPage) {
printJob.addObject(thePrintView);
break;
} else {
thePrintView.showPage("middle");
printJob.addObject(thePrintView);
removeElement(thePrintView);
printJob.send();
]]>
</fx:Script>
</s:Application>
FormPrintView.mxml
===============
<?xml version="1.0"?>
<mx:VBox
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:MyComp="myComponents.*"
backgroundColor="#FFFFFF"
paddingTop="50" paddingBottom="50" paddingLeft="50"
>
<fx:Script>
<![CDATA[
import mx.core.*
public function showPage(pageType:String):void {
validateNow();
]]>
</fx:Script>
<mx:PrintDataGrid
id="printDataGrid"
width="60%"
height="100%"
showHeaders="false"
borderVisible="false"
horizontalGridLines="false"
variableRowHeight="true"
>
<mx:columns>
<mx:DataGridColumn
itemRenderer="MyPrintRenderer"
/>
</mx:columns>
</mx:PrintDataGrid>
</mx:VBox>
MyPrintRenderer.mxml
=================
<?xml version="1.0" encoding="utf-8"?>
<s:MXDataGridItemRenderer
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:bslns="com.knownomy.bsl.view.component.*"
>
<s:layout>
<s:VerticalLayout
paddingLeft="5"
paddingRight="5"
paddingTop="3"
paddingBottom="3"
gap="5"
horizontalAlign="left"
clipAndEnableScrolling="true"
/>
</s:layout>
<fx:Declarations>
</fx:Declarations>
<s:HGroup
width="100%"
gap="5"
verticalAlign="middle"
>
<s:Label
text="{data.srNo}"
color="0x000000"
fontFamily="Verdana"
fontSize="10"
/>
<s:RichText
id="title"
width="700"
textFlow="{myTextFlow}"
color="0x000000"
fontFamily="Verdana"
fontSize="10"
/>
</s:HGroup>
<fx:Metadata>
</fx:Metadata>
<s:states>
<s:State name="normal" />
<s:State name="hovered" />
<s:State name="selected" />
</s:states>
<fx:Script>
<![CDATA[
import flashx.textLayout.elements.TextFlow;
[Bindable]
private var myTextFlow:TextFlow;
override public function set data(value:Object) : void {
if (value != null) {
super.data = value;
myTextFlow = data.textFlow;
]]>
</fx:Script>
</s:MXDataGridItemRenderer> -
How convert an xml to string for a textflow
Hi
usually I use fields type String to feed the textFlows.
now for visual convenience, I would like to store them in file formatted XML, and the thing succeeds well, but when I want use them I have problems, because the formatting XML creates line spacings that I don't want,
for example:
<TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" lineBreak="toFit" paddingBottom="4" paddingLeft="4" paddingRight="4" paddingTop="4" paragraphSpaceAfter="15" paragraphSpaceBefore="0" verticalAlign="top" id="flow" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">
<linkActiveFormat>
<TextLayoutFormat color="#cc00cc" fontWeight="bold" textDecoration="underline"/>
</linkActiveFormat>
<linkHoverFormat>
<TextLayoutFormat color="#cc0000" fontWeight="bold" textDecoration="underline"/>
</linkHoverFormat>
<linkNormalFormat>
<TextLayoutFormat color="#000099" fontWeight="bold" textDecoration="none"/>
</linkNormalFormat>
<p color="#990099" fontSize="15">
<span>Gestione dei testi con TLF e Testo classico</span>
</p>
<p color="#666555" fontFamily="Arial" fontSize="14">
<span>Le novità introdotte con l'ultima release di Flash CS5 sono molteplici, una di queste novità riguarda i campi di testo.</span>
</p>
<p color="#990099" fontSize="15">
<span>Cosa c'è da sapere sul Text Layout Framework (TLF)?</span>
<img id="1|emot|0" height="18" width="18" source="[object Bitmap]"/>
<span></span>
</p>
<p color="#666555" fontFamily="Arial" fontSize="14">
<span>Che rispetto al Testo Classico,</span>
</p>
</TextFlow>
produce me:
init--------------------------------------------------------------
Gestione dei testi con TLF e Testo classico
Le novità introdotte con l'ultima release di Flash CS5 sono molteplici, una di queste novità riguarda i campi di testo.
Cosa c'è da sapere sul Text Layout Framework (TLF)?
Che rispetto al Testo Classico,
--------------------------------------------------------------------- end
instead of:
init--------------------------------------------------------------
Gestione dei testi con TLF e Testo classico
Le novità introdotte con l'ultima release di Flash CS5 sono molteplici, una di queste novità riguarda i campi di testo.
Cosa c'è da sapere sul Text Layout Framework (TLF)?
Che rispetto al Testo Classico,
--------------------------------------------------------------------- end
as I will want.
Now i see that with spark.utils i can use importFromXML to convert in a textFlow with collapse the line in excess, but unfortunately the class spark is not visible in Flash/as3.
can you help me?
thanks in advance
jeanPaulhi
I tested with this code:
package
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.display.Sprite;
import flash.events.*;
import flashx.textLayout.elements.*;
import flashx.textLayout.conversion.*;
import flashx.textLayout.formats.TextLayoutFormat;
public class importer extends Sprite
private var urlRequest:URLRequest;
private var urlLoader:URLLoader;
public function importer()
urlRequest = new URLRequest('newPRV_scritto.xml');
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, caricato);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, erroreCaric);
urlLoader.load(urlRequest);
private function erroreCaric(e:IOErrorEvent):void
{ trace("error: file not found"); }
private function caricato(e:Event):void
var markup:String = e.target.data;
var config:Configuration = new Configuration();
var format:TextLayoutFormat = new TextLayoutFormat(config.textFlowInitialFormat);
format.whiteSpaceCollapse = "collapse";
config.textFlowInitialFormat = format;
var imp:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT, config);
imp.throwOnError = false;
var flow:TextFlow = new TextFlow;
flow = imp.importToFlow(markup);
if (flow==null)
trace('----------not imported---------');
else
trace( TextConverter.export(flow, TextConverter.TEXT_LAYOUT_FORMAT,ConversionType.STRING_TYPE) as String);
and the result is the trace: '----------not imported---------'
what you say of it? -
Runtime Error when setting the textFlow of a TextArea with specific size
Hi All
When trying to set the textFlow of a Textrea with a specific size (412x258) the flash player crashes because of a 15 sec loop. Could you please help me on this?
Please find the code below:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="
library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"creationComplete="init()"
>
<fx:Script>
<![CDATA[
import flashx.textLayout.conversion.TextConverter;
private var tfText:String = '<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 color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textDecoration="none" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">THE BEAUTIFUL NEW VAGUENESS</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="italic" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textDecoration="none" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">How do I learn to love the non-predictability of the world?</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default"></span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">Nothing is as it is forever. Time and again, everything changes. Again and again, the unpredictable happens, chaos breaks out constantly. Things never stay in order, things can never be effectively planned!</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default"></span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">The problem of contingency, of the non-predictability of personal and professional development, is problematic for many people. Continually, they see themselves questioned existentially. – Delité describes six effective ideas to overcome this problem. With a new attitude to this problem:</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default"></span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">1. Idea: We are children of evolution</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">2. Idea: Primal fear AND basic trust</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">3. Idea: A sensible attitude towards work</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">4. Idea: The illusion of secondary virtues</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">5. Idea: The end of self-pity</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">6. Idea: Loving life</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textDecoration="underline" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">Read more here</span></p><p color="#000000" direction="ltr" fontFamily="Arial" fontSize="12" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="justify" textAlignLast="start" textIndent="0" textJustify="interWord" trackingRight="0"><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="11" fontStyle="normal" fontWeight="normal" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textDecoration="underline" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default"></span></p></TextFlow>';
private function init():void{
this.richText.textFlow = TextConverter.importToFlow(this.tfText, TextConverter.TEXT_LAYOUT_FORMAT);
trace(this.richText.text)}
]]>
</fx:Script>
<s:TextArea name="richText" id="richText" x="0" y="0" width="412" height="258" horizontalScrollPolicy="
auto" verticalScrollPolicy="auto" selectable="true" borderVisible="
false" editable="false" contentBackgroundAlpha="0" paddingRight="15"renderingMode="
cff" fontLookup="embeddedCFF" cffHinting="horizontalStem"/></s:Application>
The Error details:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at flashx.textLayout.compose::BaseCompose/fitLineToParcel()[C:\Vellum\branches\v1\1.1\dev\ou tput\openSource\textLayout\src\flashx\textLayout\compose\BaseCompose.as:536]
at flashx.textLayout.compose::ComposeState/composeNextLine()[C:\Vellum\branches\v1\1.1\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\ComposeState.as:312]
at flashx.textLayout.compose::BaseCompose/composeParagraphElementIntoLines()[C:\Vellum\branc hes\v1\1.1\dev\output\openSource\textLayout\src\flashx\textLayout\compose\BaseCompose.as:3 95]
at flashx.textLayout.compose::ComposeState/composeParagraphElement()[C:\Vellum\branches\v1\1 .1\dev\output\openSource\textLayout\src\flashx\textLayout\compose\ComposeState.as:272]
at flashx.textLayout.compose::BaseCompose/composeBlockElement()[C:\Vellum\branches\v1\1.1\de v\output\openSource\textLayout\src\flashx\textLayout\compose\BaseCompose.as:219]
at flashx.textLayout.compose::BaseCompose/composeInternal()[C:\Vellum\branches\v1\1.1\dev\ou tput\openSource\textLayout\src\flashx\textLayout\compose\BaseCompose.as:372]
at flashx.textLayout.compose::ComposeState/composeInternal()[C:\Vellum\branches\v1\1.1\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\ComposeState.as:134]
at flashx.textLayout.compose::BaseCompose/composeTextFlow()[C:\Vellum\branches\v1\1.1\dev\ou tput\openSource\textLayout\src\flashx\textLayout\compose\BaseCompose.as:339]
at flashx.textLayout.compose::ComposeState/composeTextFlow()[C:\Vellum\branches\v1\1.1\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\ComposeState.as:102]
at flashx.textLayout.compose::StandardFlowComposer/http://ns.adobe.com/textLayout/internal/2008::callTheComposer()[C:\Vellum\branches\v1\1.1\ dev\output\openSource\textLayout\src\flashx\textLayout\compose\StandardFlowComposer.as:678 ]
at flashx.textLayout.compose::StandardFlowComposer/internalCompose()[C:\Vellum\branches\v1\1 .1\dev\output\openSource\textLayout\src\flashx\textLayout\compose\StandardFlowComposer.as: 758]
at flashx.textLayout.compose::StandardFlowComposer/compose()[C:\Vellum\branches\v1\1.1\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\StandardFlowComposer.as:821]
at flashx.textLayout.container::TextContainerManager/compose()[C:\Vellum\branches\v1\1.1\dev \output\openSource\textLayout\src\flashx\textLayout\container\TextContainerManager.as:1207 ]
at flashx.textLayout.container::TextContainerManager/updateContainer()[C:\Vellum\branches\v1 \1.1\dev\output\openSource\textLayout\src\flashx\textLayout\container\TextContainerManager .as:1294]
at spark.components::RichEditableText/updateDisplayList()[E:\dev\4.x\frameworks\projects\spa rk\src\spark\components\RichEditableText.as:2601]
at mx.core::UIComponent/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework\src\m x\core\UIComponent.as:8709]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework \src\mx\managers\LayoutManager.as:663]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:736]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]
Thank you for your support!This bug should be fixed in SDK 4.5. Please use the latest SDK.
My environment is FlashBuilder 4.5 premium and its default SDK 4.5. It's all right on my machine.
Thanks -
Import html to textFlow creates paragraphs
That;s what I do :
str = "Some example text with <b>bold</b> and <i>italic</i> or <b> even one <i>and another</i></b>.";
this.textFlow = TextFilter.importToFlow(str,TextFilter.HTML_FORMAT);
And the textflow is (TextFilter.export(this._textFlow,TextFilter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE); ):
<TextFlow paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"><p><span>Some example text with </span></p><p><span fontWeight="bold">bold</span></p><p><span> and </span></p><p><span fontStyle="italic">italic</span></p><p><span> or </span></p><p><span fontWeight="bold"> even one </span></p><p><span fontStyle="italic" fontWeight="bold">and another</span></p><p><span>.</span></p></TextFlow>
I see each part in new line. What's with those <p> .. </p> tags ?Hi,
This bug was fixed some time in August. Please try a more recent build.
Thanks,
Abhishek
(Adobe Systems Inc.) -
Accessing the 'text' in a TextFlow instance?
How do I actually access the textual content of a TextFlow object?
When there is a single SpanElement in the TextFlow then I am able to use ...
mySpan.text
But if I have added multiple SpanElements to the ParagraphElement then how do I get the entire textual content so that I can store it in a String variable.
I am also having problems accessing the entire text when the user has pasted in to an editable field, I presume this is because of multiple SpanElements being created.
Is there anything that is the equivalent to the old ...
myTextField.text
Thanks in advance,
AdrianHi Alan,
Thank you so much for your help!!!
Just for the record, here is a working example ...
import flashx.textLayout.container.*;
import flashx.textLayout.elements.*;
import flashx.textLayout.edit.*;
var config:Configuration = new Configuration();
config.manageEnterKey = false;
var textFlow:TextFlow = new TextFlow(config);
var para:ParagraphElement = new ParagraphElement();
var span1:SpanElement = new SpanElement();
span1.text = "Hello ";
span1.fontSize = 12;
var span2:SpanElement = new SpanElement();
span2.text = "World";
span2.fontSize = 16;
para.addChild(span1);
para.addChild(span2);
textFlow.addChild(para);
var cc:ContainerController = new ContainerController(this, 550, 400);
textFlow.flowComposer.addController(cc);
textFlow.flowComposer.updateAllControllers();
trace("textFlow.numChildren:"+textFlow.numChildren);
// OUTPUT: 1
trace("para.numChildren:"+para.numChildren);
// OUTPUT: 2
trace("textFlow.getText():"+textFlow.getText());
// OUTPUT: Hello World -
Click attribute in textFlow anchor tag in Flash Builder 4
Hi folks,
At first congratulation to you, Adobe and Flex team for Adobe Flash Builder 4 & flex 4 SDK final release...
then, I have a click attribute in my textFlow anchor tag, just like this:
<fx:Script>
<![CDATA[
import mx.controls.Alert;
public function func():void{
Alert.show("hello!");
]]>
</fx:Script>
<s:RichEditableText x="50" y="50" editable="false" id="RET" >
<s:TextFlow>
<s:a href='http://www.adobe.com' click='func()'>
<s:img source='adobe.jpg' width='50' height='50' />
</s:a>
</s:TextFlow>
</s:RichEditableText>
When I run the project, everything's allright; and after click on my image, I have adobe site in new window, and also have my popup alert window with "Hello!" text...
But the Problem is another thing. I want to give this textFlow content from one webservice and put it in a string var then bind it to my RichEditableText. I receive it from webservice, put it in the string, and then bind this string to textFlow attribute of my RichEditableText obj with simple function... after running my project, I can see the content, and when I click on my image, I have adobe site in new window, again. but my function does not call!
What is the problem?! the code is something like this (of course without webservice codes!):
<fx:Script>
<![CDATA[
import flashx.textLayout.conversion.TextConverter;
import mx.controls.Alert;
public function func():void{
Alert.show("hello!");
internal var str:String;
public function func2():void{
str = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' paddingRight='5'>"+
"<a href='http://www.adobe.com' click='func();'><img source='adobe.jpg' width='50' height='50' /></a>"+
"</TextFlow>";
RET.textFlow= TextConverter.importToFlow(str, TextConverter.TEXT_LAYOUT_FORMAT);
]]>
</fx:Script>
<s:RichEditableText x="50" y="50" editable="false" id="RET" />Listening for a FlowElementMouseEvent.CLICK event will be beneficial.
In your webservice feed (Textflow), have a tag such as:
<a href="event:adobe.jpg">Click here to view Adobe's logo!</a>
Then in your ActionScript code, listen for any FlowElementMouseEvent.CLICK events from your textFlow instance.
textFlow.addEventListener(FlowElementMouseEvent.CLICK,
onLinkHandler);
Next, declare onLinkHandler:
* In the XML there are href tag which has 'event:' prefix to the value. This prefix
* allows method calls.
private function onLinkHandler(event:FlowElementMouseEvent):void
//extract the number value from the string.
var uri:String = LinkElement(event.flowElement).href.split(":")[1];
trace(uri);//outputs: adobe.jpg -
Creating a bitmap copy of a TextFlow object without the caret [cursor]
Hey all
I'm currently working on creating a bitmap copy of a TextFlow object and I am looking at hiding the caret. What would be the best way forward, using the focusmanager to 'unfocus' the TextFlow object, or is there some more direct approach available? I know there is a cursormanager in Flex, but this is an AS3 only project.
Cheers for your thoughts once again
emdI think I've just done something similar to what you need (except I'm adjusting the width of the bitmap according to that of the text), and so far I have seen no cursor
Here's the code. You'll need to adjust it depending on how many containers (Sprites) you are drawing the TextFlow to.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="init()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Group id="groupText" width="560" />
<fx:Script>
<![CDATA[
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.TextFlow;
import mx.core.UIComponent;
private function init() : void
var text : String = "Greek god gives mints.";
var fontSize : int = 24;
//We create a textflow with some text and set it's font size, just as an example.
var flow : TextFlow = TextConverter.importToFlow(text, TextConverter.PLAIN_TEXT_FORMAT);
flow.fontSize = 24;
//We'll use a single container (and consecuently a single controller)
var container : Sprite = new Sprite()
var controller : ContainerController = new ContainerController(container);
flow.flowComposer.addController(controller);
//This is kind of weird, but I saw it in a TLF example, and it works.
//It seems you have to "stretch" the container.
controller.setCompositionSize(this.stage.stageWidth, this.stage.stageHeight);
flow.flowComposer.compose();
//Set the text's actual width and height as the composition size.
controller.setCompositionSize(controller.getContentBounds().width,
controller.getContentBounds().height);
//Redraw.
flow.flowComposer.updateAllControllers();
//As BitmapData's draw method takes an IBitmapDrawable,
//we'll need to wrap the Sprite instance in an UIComponent.
var tf : UIComponent = new UIComponent();
tf.addChild(container);
//Create an instance of BitmapData and "draw the container" into it.
var bd : BitmapData = new BitmapData(controller.getContentBounds().width,
controller.getContentBounds().height + 2, true, 0x000000);
bd.draw(tf);
//Create a Bitmap with the text's data and add it to the application.
var bmp : Bitmap = new Bitmap(bd);
var ui : UIComponent = new UIComponent();
ui.addChild(bmp);
this.groupText.addElement(ui);
]]>
</fx:Script>
</s:Application>
Hope it helps,
Sebastián. -
Multiple containers for same TextFlow
I have a pretty complex scenario but I should be able to see
what's going wrong here... the question is on the very last line.
I'm building an application where inside an editor users can
lay out and edit text, (using things like resize handles and the
EditManager for position and selection/typing). The app has a
strict MVC implementation and I'm utilising a global undo system
via commands so every edit to the text runs through a central
mechanism instead of using the UndoManager directly. I'm also
generating thumbnail images of this "container" after a certain
time period after user activity, in effect producing 2 views of the
same data.
The problem this causes is that each TextFlow object is now
being used by two Containers (I'm using a "TextElementRenderer" as
a container class, which takes a TextFlow object and using the TLF
draws the text). So it only actually renders in the last one
assigned (in my case the thumbnail which lives inside a TileList
that lets you switch between editors).
So to avoid this I could just perform a clone/deep copy of
the TextFlow, but due to aforementioned approach I need a single
TextFlow to exist so that one change update's all, and I'm also
editing this via a properties panel (bold/italic etc), which lives
elsewhere in the visual hierarchy (I have quite a few types of
element apart from text that can be placed on stage and many
property panels in this system to cater for them).
So is there a way to allow 2 containers to be used for one
TextFlow?Thanks for your response, I'm glad I'm not just missing
something. I have ended up with a fairly clean solution in that
only 1 container needs to be actively editing the model at any one
time (depending on focus), so if I have 2 containers both using the
model the one that is not actively editing (the thumbnail in this
case) can re-create clones whenever the active container updates
the text as it is merely displaying the TextFlows and not actually
allowing direct user editing via an EditManager/mouse/keyboard.
It's not as efficient as detecting changes to a single
TextFlow instance but it works fast enough for most scenarios.
The properties panel is not really affected as it can still
grab a reference to the TextFlow's EditManager and work on it from
there.
Speaking of which, I think also the docs could promote better
the Selection(/Edit)Manager.getCommonCharacterFormat() method as it
took a while to find this and it's needed as soon as you start to
implement things like Bold/Italic/etc buttons (where the TextFlow's
container loses focus) and the pointFormat is nullified as soon as
you click the button (due to the focus change/loss of
carat). -
Hi,
I'm new at the Text Layout Framework.
And I need multiple textflows without losing the abilities of the tlf editor.
To be more precise:
I have an XML with multiple paragraphs that must be edited and i will split each paragraph into a separate textflow. Finally I want to display each paragraph in it's own container and make it all editable with one tlf editor. (I don't need to flow between the containers)
So the question is:
Is it possible to have multiple containers/textflows and just one tlf editor that controls the selected container/textflow? (And updating the values when I select an other textcontainer?)
Is there someone who can point me to the right direction to control the communication between the containers and the editor?
Thanks in advance.
GlenIf I understand it correctly I will have an interactionManager for each textflow which can be set on the same location so the user won't notice the interactionManager is replaced?
Is it easy to set the location of the interactionManager separatly from the containers?
And is it possible to have these containers (textflows) in a wrapping container (with scrollbars when I have to many to display) and have the editmanager outside?
I try to visualise it with a table:
Container with textflows
Textflow number 1 with editable text
The editManager / InteractionManager
Textflow number 2 with editable text
Textflow number 3 with editable text
Textflow number 4 with editable text
Textflow number 5 with editable text, to go to number 6 i need to scroll in this container -
How to import a richly formatted html text to textflow with importer?
hey all
i am trying this:
open google docs, new document, and type in:
hello world
(world bolded)
then download it as html(zipped)
i unzip the html file, and save it to the assets folder in src folder of my Flex app
i have a Spark:TextArea instance and i want to do:
var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_FIELD_HTML_FORMAT);
myTextArea.textFlow = importer.importToFlow(htmlSource);
where htmlSource should point to the saved html file somehow
how do i do this? i tryed embedding, converting to ByteArrayAsset and to String, but i always get the source of the html file and not it's rendered rich text (ie "hello world).
this is what i c at runtime:
Untitled documentol{margin:0;padding:0}p{margin:0}.c0{color:#000000;font-size:11pt;font-family:Ari al;font-weight:bold}.c3{line-height:1.15;text-indent:0pt;direction:ltr}.c2{color:#000000;f ont-size:11pt;font-family:Arial}.c1{background-color:#ffffff}
hello world
am i clear?
any help?
thanxHi Wim,
It is about dynamic and your solution was indeed correct. I failed earlier in this way due to wrong (non compatible) images.But it keeps difficult stuff for me to setup a smooth interface.>
What is smooth? If you mean page and images take time to load then it has to do with the size (bytes) of the images. Just reducing the height and width of images will not help. No matter which method you use if the images are bulky then the page will take time to load, especially the images.
>
Since I'm still investigating: do you now if those Ajax calls you mention would smoothen things for me ( I forsee I have to do a lot of things with pictures )?
In that case: do you know of some example app?
>
AJAX is not going to make it faster. Neither is hosting the images on webserver going to eliminate the problem. You need to reduce the size (byes) of the images.
Cheers, -
WhiteSpaceCollapse not working on textFlow created from HTML
Is there a trick to getting whiteSpaceCollapse to work with imported HTML? Here's my current code, where value is HTML text (e.g. "<p>Blah</p>.."):
textFlow = TextConverter.importToFlow( value, TextConverter.TEXT_FIELD_HTML_FORMAT);
textFlow.whiteSpaceCollapse = WhiteSpaceCollapse.COLLAPSE;
I've also set whiteSpaceCollapse on the RichEditableText to "collapse" but I'm still noticing vertical space differences if my external HTML has linebreaks between <p></p> nodes. Many thanks in advance for any suggestions.
-Robertthis is the way to solve this bug and no need for changing any xml settings , simple and it works
exporting the textflow:
var richTextXML:xml = new XML("<"+"richTextXML"+"/>");
richTextXML.appendChild(getCdataXMl());
private function getCdataXMl():xml{
var textFlowStr:String = TextConverter.export(textFlow,TextConverter.TEXT_FIELD_HTML_FORMAT
, ConversionType.STRING_TYPE).toString();
var textFlowXMl:xml = new XMl("<![CDATA["+textFlowStr+"]]>");
return textFlowXMl;
importing TextFlow from XMl :
var htmlTextInStr:String = richTextXMl.text();
var importtedTextFlow:TextFlow = TextConverter.importToFlow(htmlTextInStr,TextConverter.TEXT_FIELD_HTML_FORMAT);
textArea.textFlow = importtedTextFlow; -
TextFlow and Controller Being Created Too Early?
I've successfully rolled my work with the TextFlow into a
Canvas component, made it into an SWC, and made that part of the
application it was originally designed for. No problems. Alright,
now time to re-use my work in another app. that could benefit from
a rich text component. Went through the usual motions and got all
of my UI for my text component to render except the TextFlow!
Then what I discovered is when I resized the browser window
that hosting my Flex app, the cascade of resize events got the
TextFlow to finish rendering, the scroll bars got adjusted
properly, and it was ready to accept input with the blinking
cursor.
Here is a dump from some trace statements I have in my code,
I'm trying to work out the order in which events are happening and
when the text flow gets proper measurements:
Composer -> Resize -> New TextFlow Dimensions -> W:
0 H: 0
Composer -> Creating Display Controller -> TextFlow
Dimensions -> W: 754 H: 0
Composer -> Created
MessageEditorBase -> Created
MessageEditorBase -> Event Fired -> Resize
MessageEditorBase -> Event Fired -> Show
Composer -> Resize -> New TextFlow Dimensions -> W:
754 H: 0
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1328 H: 274
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1328 H: 275
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1329 H: 276
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1334 H: 277
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1350 H: 279
"MessageEditorBase" is a canvas (used as a tab) that gets
displayed to the user. Within that Canvas are lots of components
including the "Composer" which is basically a toolbar of elegant
buttons and format functions, and then a blank canvas which holds a
UIComponent and becomes the DisplayObjectController. Works great in
my other app, the code is nearly line for line with Adobe's
examples.
Notice how it starts 0,0; then gets a width measurement of
754; finally when I the user resize the entire application do the
rest of the proper dimensions get computed.
I don't think it's a TextFlow problem, but I can't say I
understand the Flex rendering hierarchy enough to have implemented
TextFlow and its controller in the right way with this app.
Any thoughts? If you need more information just ask and I'll
try to explain as best as possible.As it turns out with a lot of fiddling and trace statements,
I figured out a way to initialize the DisplayObjectController with
valid pixel values. In your TLF examples, the developers always
created a display object controller using specific dimensions, like
250 x 250. But I need my text component to be created dynamically
based on the screen size of the user. This was not happening
correctly after I upgraded to TLF build 370, though it's not even a
TLF problem.
I took the measurements from the parent canvas. For whatever
strange reason, in the world of measuring Flex components, the
child canvas further down in the application, the one that I added
the sprite to, was not getting measured out correctly. Thus when I
passed the controller width and height values from this child, they
were 0.
I hope that made sense, but either way, problem fixed.
Edit:
Here's an example of my code using a custom controller that
had the keyDown event overriden:
theController = new
ComposerDisplayController(uiFlowComponent, uiTextArea.width,
uiTextArea.height, this);
I passed values which I expected the UI to measure out rather
than me providing explicit pixel values. I had a problem when the
UI gave me zero. -
Getting list of used fonts in TextFlow
Hi!
I'm wondering how i can get a list of fonts used in a TextFlow - especially usefull, when working with embedded fonts loaded
at runtime.
The idea is to be able when loading new content into textflow, to preload the used fonts before the text is shown.
Any suggestions? - looking at the API, i have not been able to come up with any solution.
Kindly regards
// NetphreakThere's no single place you get can a list of fonts, but it wouldn't be too hard to generate one. Iterate through all the leaf nodes, and get the font from the computedFormat. I'm thinking something like this would work:
function getFontList(textFlow:TextFlow)
var leaf:FlowLeafElement = textFlow.getFirstLeaf();
while (leaf)
var fontFamily:String = leaf.computedFormat.fontFamily;
// add fontFamily to list if its not already there
leaf = leaf.getNextLeaf();
If you want to, you could check for InlineGraphicElement and ignore their fontFamily settings.
- robin
Maybe you are looking for
-
I am working in a prepress environment and will be upgrading our G4's and a G5 to Tiger from Panther 10.3.9. Will be running Adobe Creative Suite 3, Quark 7 and other programs. *Does anyone know of any issues that I should be aware of (i.e. slow down
-
Hyperlinks to URL added in course in Adobe Presenter 9 does not open.
I have a URL added in my course slide and I want student to be able to click on it and see the video on the website. But the URL does not seem to work all the time. It seems to work in Internet Explorer once in a while and does not work at all in Chr
-
How to push a hangup request to phone
Hi, When a call is in process on a cisco ip phone, is there a way to push a hangup request to disconnect the call. Or in other way is it possible to force phone to dial a number but before disconnect the current call? Thanks for you ideas, Parisa
-
How to know whether a connection leak occured in weblogic8.1
How to Know whether Conenction Leak has Occured or Not ??..Where does the WeblogicServer8.1 print the STACK TRACE if connection Leak has occured ? or does it maintain a LOG FILE , where any entries can be seen................
-
Is there any way to sync the photo albums I create on my iPad to my mac. Photo only seems to sync the photos but not my own albums. Any idea? My dad has taken a heap of photos and put them in albums yet I can't copy those albums to the Mac so I can b