Copy link to clipboard
Copied
I do as the article Flex4 updates for tlf2.0, but when i use float attribute such as "left" or "right" ,the image will disappear,
1. load the sdk 4.0.14159
2. replace the the files (FTETextField.as and csstextLayoutFormat.as);
3. replace the textLayout.swc in the framework
4.run ant -q main
then I set the flashbuilder 4's sdk with the sdk I just changed.
Do i miss something or i do something wrong?
the <img /> float="left" or "right" the img is disappear, but there is no compiler error or runtime errors.
Copy link to clipboard
Copied
the list is the same question, does't show,but no compiler error and runtime error.
who has the same problem? tell me , thanks very much!
Copy link to clipboard
Copied
I had to do one additional step, which was to set the Framework linkage in the Properties for the application under "Flex build path" to "Merged Into Code".
The new list features aren't working correctly when accessed via mxml -- I will submit a fix for this.
I wrote a very simple back to basics application that does work, can you try it? Also, if this app works, can you post your application that doesn't work? My best guess is that the problem has to do with the connection to Flex, and once we can repro it here it may be easy to fix. I'll add another mxml application that is working for me.
Thanks,
- robin
package
{
import flash.display.Graphics;
import flash.display.Sprite;
import flash.geom.Rectangle;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.InlineGraphicElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class Test extends Sprite
{
public function Test()
{
var s:Sprite = new Sprite();
s.x = 100;
s.y = 100;
addChild(s);
var span:SpanElement = new SpanElement();
span.text = "Hello";
var ilg:InlineGraphicElement = new InlineGraphicElement();
var inline:Sprite = new Sprite();
inline.graphics.beginFill(0xFF0000);
inline.graphics.drawRect(0, 0, 100, 100);
inline.graphics.endFill();
ilg.source = inline;
ilg.float = "left";
var paragraph:ParagraphElement = new ParagraphElement();
paragraph.addChild(span);
paragraph.addChild(ilg);
var textFlow:TextFlow = new TextFlow();
textFlow.addChild(paragraph);
textFlow.flowComposer.addController(new ContainerController(s, 600, 600));
textFlow.flowComposer.updateAllControllers();
}
}
}
Here's the mxml one:
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns="library://ns.adobe.com/flex/spark"
xmlns:local="*"
xmlns:ai="http://ns.adobe.com/ai/2009"
xmlns:d="http://ns.adobe.com/fxg/2008/dt"
xmlns:flm="http://ns.adobe.com/flame/2008"
height="600" width="800">
<fx:Script><![CDATA[
import flashx.textLayout.conversion.ConversionType;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.TextFlow;
public function traceContent():void
{
trace(TextConverter.export(myRET.content as TextFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE));
}
]]>
</fx:Script>
<RichEditableText id="myRET" click="traceContent()" height="100" width="200">
<content>
<p><span id="span1">This is span 1.</span><img float="left" width="100" height="100" source="gremlin.jpg"/></p>
</content>
</RichEditableText>
</Application>
Copy link to clipboard
Copied
Thanks Robin.
you give me two examples, the first actionscript one has no problem, the img can float. But the second mxml one has problem: when I run the application, there is a error: Cann't create float attribute for InlineGraphicElement.
when I use TextConverter.inportToFlow to inport the textLayout, there is no compiler or runtime error:
<?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"
initialize="application1_initializeHandler(event)"
xmlns:ns="library://ns.adobe.com/flashx/textLayout">
<fx:Script>
<![CDATA[
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.*;
import flashx.textLayout.elements.*;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.*;
import mx.controls.List;
import mx.core.UIComponent;
import mx.events.FlexEvent;
protected function application1_initializeHandler(event:FlexEvent):void
{
var bodyMarkup:String = "<flow:TextFlow xmlns:flow='http://ns.adobe.com/textLayout/2008' fontSize='18' " +
"textIndent='10' paragraphSpaceBefore='6' paddingTop='8' paddingBottom='8' paddingLeft='8' paddingRight='8'>" +
"<flow:p paragraphSpaceBefore='inherit'>" +
"<flow:span>" +
"The man who now watched the fire was of a different order, and troubled himself with no " +
"thoughts save the very few that were requisite to his business. At frequent intervals, " +
"he flung back the clashing weight of the iron door, and, turning his face from the " +
"</flow:span>" +
"<flow:img source='test.jpg' float='left' width='50' height='50' />"+
"</flow:p>" +
"</flow:TextFlow>";
var inline:InlineGraphicElement
rich.textFlow = TextConverter.importToFlow(bodyMarkup,TextConverter.TEXT_LAYOUT_FORMAT);
}
]]>
</fx:Script>
<s:RichText id="rich" width="600" />
</s:Application>
I think there is something wrong with the rebuild process.
Copy link to clipboard
Copied
Sounds like it. We'll investigate and see if we can duplicate your results and fix. Thanks!
- robin
Copy link to clipboard
Copied
But the second mxml one has problem: when I run the application, there is a error: Cann't create float attribute for InlineGraphicElement??
what's the problem?
robin thank you very much.
now I got it, there is no problem left, I change the RichText with textArea, the img appear.
Copy link to clipboard
Copied
hello, robin. the img's float problem is ok;
but the list has a problem:
the mxml file:
<?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"
initialize="application1_initializeHandler(event)"
xmlns:ns="library://ns.adobe.com/flashx/textLayout">
<fx:Script>
<![CDATA[
import flashx.textLayout.container.*;
import flashx.textLayout.conversion.*;
import flashx.textLayout.elements.*;
import flashx.textLayout.operations.*;
import flashx.textLayout.formats.*;
import mx.controls.List;
import mx.core.UIComponent;
import mx.events.FlexEvent;
protected function application1_initializeHandler(event:FlexEvent):void
{
var bodyMarkup:String = '<TextFlow fontSize="14" paddingLeft="4" paddingTop="4" xmlns="http://ns.adobe.com/textLayout/2008"><p>BEFORE</p><list listStylePosition="outside" listStyleType="upperRoman" paddingLeft="30"><li><p>item item</p></li><li><p>another anotheranotheranother</p><list listStyleType="decimal" paddingLeft="24"><li>nested</li><li>another</li></list></li><li/><li/><li/><li/><li/><li/><li/><li/></list><p>AFTER</p></TextFlow>';
rich.textFlow = TextConverter.importToFlow(bodyMarkup,TextConverter.TEXT_LAYOUT_FORMAT);
}
]]>
</fx:Script>
<s:TextArea id="rich" width="600" height="200" editable="false"/>
</s:Application>
it dose show correct, but when I click the textArea, there will be a error:
TypeError: Error #1034: can't converter GlobalSWFContext@7315fc1 to mx.core.IFlexModuleFactory。
thanks very much.
Copy link to clipboard
Copied
Hi Zhangboustc,
I too came across this error. The problem in my case was that I tried to recompile the flex 4.1 sdk with the new changes for TLF 2, which worked, but on using it in an application it produced the same error :
TypeError: Error #1034: can't converter GlobalSWFContext@7315fc1 to mx.core.IFlexModuleFactory。
When I recompiled the 4.0 sdk, I did not have this error. You might want to check if you recompiled the 4.0 sdk (not the 4.1) and that you actually replaced the 2 classes that are necessary for your custom sdk build. If you compare the old and the new classes you will see that some of the changes regard GlobalSwfContext and IFlexModuleFactory typing.
Copy link to clipboard
Copied
Hi,
Make sure you turn off RSLs. From the Properties for your project Select "Flex Library Build Path", select the "Library Path" panel and change the "Framework linkage" to "Merged into code".
Hope that helps,
Richard