Skip to main content
Known Participant
August 2, 2011
Question

DivElement backgroundcolor doesn't work

  • August 2, 2011
  • 1 reply
  • 709 views

Hi guys,

Can anyone tell me why the backgroundcolor propery of DivElement doesn't work?

import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.elements.DivElement;

var textFlow:TextFlow = new TextFlow();

var paragraph:ParagraphElement = new ParagraphElement();
paragraph.fontSize = 16;

var se:SpanElement  = new SpanElement();
se.text                        = "asdf sdf sdf sdf sdfa sdfasdfafds afsdf adsf";

paragraph.addChild(se);

var div:DivElement = new DivElement();
div.addChild(paragraph);
div.backgroundColor = 0xff0000;

textFlow.addChild(div);

var firstController:ContainerController = new ContainerController(this,400,400);
textFlow.flowComposer.addController(firstController);
textFlow.flowComposer.updateAllControllers();

Thanks in advance!

Cheers,

Zsolt

This topic has been closed for replies.

1 reply

Adobe Employee
August 3, 2011

TLF does not support backgroundColor of "block element" right now, such as paragraph, div, textflow, because there is no border in TLF. So, we only draw backgroundColor for flash.text.engine.TextLine.  That's to say, TLF only supports backgroundColor of SpanElement.

We are implementing border feature and backgroundColor of "block element" now. Thanks!

VejkoAuthor
Known Participant
August 3, 2011

Thanks Jin-Huang, I am looking forward to the update!