• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Getting a runtime error in ContainerController

Participant ,
May 12, 2011 May 12, 2011

Copy link to clipboard

Copied

Using SDK 4.5.0.20967

The error is thrown on line 3182:

while (containerListIndex == -1 && floatIndex > 0)

{

     floatIndex--;

     floatInfo = _composedFloats[floatIndex - 1];

     containerListIndex = _floatsInContainer.indexOf(floatInfo.graphic);

}

floatIndex is 1 when it enters the loop,

then it is decresed to 0,

then null gets assigned to floatInfo - when it is looking for:  _composedFloats[-1]

Then it throws an error when it tries to access a property on floatInfo - which is set to null

Here is the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

     at flashx.textLayout.container::ContainerController/http://ns.adobe.com/textLayout/internal/2008::updateGraphics()

    

I am not sure exactly how I am triggering this - I am trying to discern that - but if you have any thoughts - please let me know.

TOPICS
Text layout framework

Views

22.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 12, 2011 May 12, 2011

Copy link to clipboard

Copied

Here is an example of the bug, the yellow box in the TextFlow is an InlineGraphicElement.

Click the red box at the bottom of the flow to start adding text.

It crashes once the InlineGraphicElement is pushed out of the visible area of the container.

http://www.theyrule.net/test/tlf_images/SingleContainerTest.swf

This was published using the SDK 4.5.0.20967

Here is the same file published with HERO - which still has the other inlineGraphic alignment problem - but does not have the runtime error:

http://www.theyrule.net/test/tlf_images/SingleContainerTestHero.swf

Here is the source:

package

{

import flash.display.Sprite;

import flash.display.StageAlign;

import flash.display.StageScaleMode;

import flash.events.Event;

import flash.events.MouseEvent;

import flash.system.System;

import flash.text.TextField;

import flash.text.TextFormat;

import flashx.textLayout.container.ContainerController;

import flashx.textLayout.container.ScrollPolicy;

import flashx.textLayout.edit.EditManager;

import flashx.textLayout.elements.DivElement;

import flashx.textLayout.elements.InlineGraphicElement;

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 flashx.textLayout.tlf_internal;

import flashx.undo.UndoManager;

use namespace tlf_internal;

[SWF (width="500", height="700", backgroundColor="#FFFFFF")]

public class SingleContainerTest extends Sprite

{

protected var tf:TextFlow;

protected var em:EditManager;

protected var um:flashx.undo.UndoManager

protected var _bg:Sprite;

protected var _spr:Sprite;

protected var _cc:ContainerController

protected var _init_fmt:TextLayoutFormat;

protected var _btn:Sprite;

protected var _playing:Boolean = false;

protected var _count:int = 0;

protected var _graph:Sprite;

protected var _print_out:TextField;

protected var _last_time:Date = new Date();

protected var _last_five:Array = [];

public function SingleContainerTest()

{

stage.scaleMode = StageScaleMode.NO_SCALE;

stage.align = StageAlign.TOP_LEFT;

var cw:Number = 200; // the container width

var ch:Number = 600;  // the container height

_bg = new Sprite();

_bg.graphics.lineStyle(.25, 0);

_bg.graphics.drawRect(0,0,cw,ch);

addChild(_bg);

_spr = new Sprite();

addChild(_spr);

_graph = new Sprite();

_graph.x = cw + 10;

_graph.y = 250;

addChild(_graph);

_print_out = new TextField();

var fmt:TextFormat = _print_out.defaultTextFormat;

fmt.font = "_sans";

_print_out.wordWrap = true;

_print_out.multiline = true;

_print_out.width = stage.stageWidth - (10 + _graph.x);

_print_out.x = _graph.x;

_print_out.y = _graph.y + 10;

addChild(_print_out);

//define TextFlow and manager objects

tf = new TextFlow();

um = new UndoManager();

em = new EditManager(um);

tf.interactionManager = em;  

//compose TextFlow to display

_cc = new ContainerController(_spr,cw,ch);

//_cc.verticalAlign = VerticalAlign.BOTTOM;

//_cc.verticalScrollPolicy = ScrollPolicy.ON;

tf.flowComposer.addController(_cc);

tf.flowComposer.updateAllControllers();

//make a button to add Inline Graphic elements

_btn = new Sprite();

_btn.graphics.beginFill(0xFF0000,1);

_btn.graphics.drawRect(0,0,120,30);

addChild(_btn);

_btn.addEventListener(MouseEvent.CLICK, btnClicked);

_btn.y = 600;

addMessage("1");

addMessage("2");

addMessage("3", true);

}

public function addMessage(msg:String, add_image:Boolean = false):void {

//define elements to contain text

var d:DivElement = new DivElement();

var p:ParagraphElement = new ParagraphElement();

var s:SpanElement = new SpanElement();

s.text = msg;

//add these elements to the TextFlow

p.addChild(s);

d.addChild(p);

if(add_image){

var sp:Sprite = new Sprite();

sp.graphics.beginFill(0xFFCC00);

sp.graphics.drawRect(0,0,100,20);

var i:InlineGraphicElement = new InlineGraphicElement();

i.source = sp;

i.width = 100;

i.height = 20;

p.addChild(i);

}

tf.addChild(d);

tf.flowComposer.updateAllControllers();

_cc.verticalScrollPosition = _cc.getContentBounds().height;

tf.flowComposer.updateAllControllers();

}

protected function btnClicked(e:MouseEvent):void {

_playing = !_playing;

removeEventListener(Event.ENTER_FRAME, onEnterFrame);

if(_playing){

addEventListener(Event.ENTER_FRAME, onEnterFrame);

}

}

protected function onEnterFrame(e:Event):void {

_count++;

if(_count > 100){

tf.removeChildAt(0);

}

addMessage("Message Number: " + _count + " " + randomString());

printOut()

}

protected function printOut():void {

var now:Date = new Date();

var tm:Number = (now.getTime() - _last_time.getTime());

_last_five.push(tm);

if(_last_five.length > 10) _last_five.shift();

var avg_tm:Number = 0;

for(var i:int = 0; i < _last_five.length; i++) avg_tm += _last_five;

avg_tm = Math.round(avg_tm/_last_five.length);

var elapsed_str:String = "message: \t\t\t"+_count

+ "\ntime: \t\t\t\t" + tm + "ms"

+ "\navg of last 10:\t\t" + avg_tm +"ms";

//trace(elapsed_str );

_print_out.text = elapsed_str;

_last_time = now;

drawGraph(tm);

}

protected function drawGraph(tm:Number):void {

if(_count % 5 == 0){

_graph.graphics.beginFill(0x0);

_graph.graphics.drawRect(_count/10,-Math.round(tm/10),1,1);

_graph.graphics.beginFill(0xFF0000);

_graph.graphics.drawRect(_count/10,-Math.round(System.totalMemory/1000000),1,1);

}

}

protected function randomString():String {

var chars:String = "abcdefghijklmnopqrstuvwzyz                    ";

var chars_len:Number = chars.length;

var random_str:String = "";

var num_chars:Number = Math.round(Math.random() * 100);

for (var i:int =0; i < num_chars; i++){

random_str = random_str + chars.charAt(Math.round(Math.random() * chars_len));

}

return random_str;

}

}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 13, 2011 May 13, 2011

Copy link to clipboard

Copied

It can be reproduced with SDK 4.5 (tlf 2.0.232 in it). But your code works well without any runtime error when compiled with tlf 3.0.5 on my machine, which is not released officially to the outside of Adobe.


I'm not sure when flex team will add tlf 3.0 into their SDK.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 13, 2011 May 13, 2011

Copy link to clipboard

Copied

I will ask my workmate whether we can release a 3.0 tlf on https://sourceforge.net/adobe/tlf/home/ next week.

I'm not sure the time point is all right. Pls wait for the reply.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 13, 2011 May 13, 2011

Copy link to clipboard

Copied

Thanks,

Will this fix be back ported into TLF 2.x?

We are looking for a stable version of TLF 2 to get out our next release, scheduled for June 1.

We would also like to make use of a common RSL swz file such as:

http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 15, 2011 May 15, 2011

Copy link to clipboard

Copied

I'm trying to connect with Flex guys. But I'm not sure of the result.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

I can not find a work around to this bug.
I have updated our code to use TLF 2 - but cannot deploy it because of this.

We are in a bind.

There are a growing number of complaints in this forum about this bug - I suspect it will be widespread.

There is no version of TLF 2 available which is usable - I think it would be a great mistake not to back-port the fix for this bug into TLF 2.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 19, 2011 May 19, 2011

Copy link to clipboard

Copied

We have realized our mistake and want to back port the fix to the the old version of TLF. It need a lot of tests and processes. And we cannot control the time point when flex team will pick up our build. TLF and Flex are not the same team. We are begging flex team to pick up new TLF build these days...Picking up new build also need a lot of test.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 19, 2011 May 19, 2011

Copy link to clipboard

Copied

Thank you so much, that is good news.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

Has there been any progress on this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 10, 2011 Jul 10, 2011

Copy link to clipboard

Copied

TLF 2.1 has been released with several bug fixes but without new features. Flex SDK may pick up it this autumn.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 11, 2011 Jul 11, 2011

Copy link to clipboard

Copied

IMHO it should be a priority to get the fixes to the runtime errors included in the SDK. I will try the 2.1 update as sson as I can.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 15, 2011 Jul 15, 2011

Copy link to clipboard

Copied

Does TLF 2.1 fix this bug? Where can I find TLF2.1?

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 17, 2011 Jul 17, 2011

Copy link to clipboard

Copied

1. Yes.

2. TLF 2.1 will be on http://sourceforge.net/projects/tlf.adobe/files this week.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 29, 2011 Aug 29, 2011

Copy link to clipboard

Copied

Thanks I see the latest TLF 2.1 files.  It still hasn't been included in the Flex SDK  - is there any indication that it will be?

Also I could not find an Adobe hosted swz file at: http://fpdownload.adobe.com/pub/swz/tlf/2.1.0.006/textLayout_2.1.0.006 .swz

I came up with that URL from the BUILD and BRANCH numbers in the TextLayoutVersion class - which correspond in the 2.0 builds e.g: http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232 .swz

Is there any indication when TLF 3.0 will be included in the Flex SDK or in the IDE?

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 29, 2011 Aug 29, 2011

Copy link to clipboard

Copied

TLF 2.1 won't be included.

TLF 3.0 will probably be in Flex SDK next year.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 30, 2011 Aug 30, 2011

Copy link to clipboard

Copied

Can you put up a signed swz file for TLF 2.1 - so that users can cache it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 30, 2011 Aug 30, 2011

Copy link to clipboard

Copied

I uploaded a SWZ to https://sourceforge.net/projects/tlf.adobe/files/2.1/6/

PS: I don't think sourceforge.net can be RSL server, because it redirects you to a new link when downloading and there is time stamp within the redirection link.

You may want to find a server for yourself.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 05, 2011 Sep 05, 2011

Copy link to clipboard

Copied

No free service will tolerate hosting this file - we have a 1 gigabit per second connection which would be saturated by this. I understood that the point of hosting these files on the Flash player server was that Adobe was treating these swz files much like the player itself.  Something that can be downloaded once and cached and is useful for multiple third parties.  One of the reasons that we adopted TLF in the first place was because despite the fact that it had a large Actionscript overhead - that code would be centrally hosted by Adobe and used by many third party sites.

Is there anyway that you can have this swz hosted at the regular location: http://fpdownload.adobe.com/pub/swz/tlf/...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 05, 2011 Sep 05, 2011

Copy link to clipboard

Copied

Usually, Flex SDK pick up one build of tlf and then upload the swz to that server.

We will have a try.

But I prefer to upload a tlf 3.0 swz, because I think for now using 2.1 is meaningless.

1. There is still RTE found in 2.1, but which cannot be reproduced in 3.0.

2. In 3.0, there are only one simple feature, performance enhancement and dozens of bug fixes. We did not change the framework and APIs. Since both 2.1 and 3.0 have never go through the tests of Flex SDK, why not to choose 3.0.

3. We are focusing on and sell our 3.0 and don't plan to make any changes on 2.1.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 13, 2011 Sep 13, 2011

Copy link to clipboard

Copied

Do you know when the earliest date that the 3.0 swz will be uploaded? Could that happen before next year?

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 13, 2011 Sep 13, 2011

Copy link to clipboard

Copied

We are trying to get the access to upload rsl on that server. If we got the access, rsl will be there soon. But I cannot promise you the time. I will tell you here if state changes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2011 Sep 19, 2011

Copy link to clipboard

Copied

Hi.

I've noticed that TLF 3.0 was launched on sourceforge.

My question is: how can i update my flex sdk to use the new TLF?

I've copied the new folders of TLF 3.0 over the old ones but that does not help.

Any help is apreciated.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 19, 2011 Sep 19, 2011

Copy link to clipboard

Copied

I'd like to +1 the questions about integrating the tlf 2.1 (waiting for the 3.0swz) to my project.

In flashBuilder i have 3 projects:

2 library projects representing my appFramework (core and utils)

1 appProject

In my libraries projects the framework linkage is external.

In parallele in my app Project

So far no luck

I also tried in a release build i did to savagely paste textLayout_2.1.0.6.swz and rename it like the 2.0... one i had (I thought it worked for a second but unfortunatly didn't)

Any hints on a way to use the fixed lib instead of the 2.0 ?

Thanks in advance

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 20, 2011 Sep 20, 2011

Copy link to clipboard

Copied

In my libraries projects the framework linkage is external.

In parallele in my app Project

1. rsl libraries in frameworks\libs are just copies of the libraries on the server. They are not linked in your runtime.

2. it should work that you change link configuration of sdk. But http://sourceforge.net/projects/tlf.adobe/files/2.1/6/textLayout2.0.0.6.swz will be redirect to another place when you try to download the that swz...So the link showed on sourceforge cannot work. URL for SWZ should always be a direct link. Please wait for the RSL library on Adobe hosted server or you put RSL libraries on your own server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines