how to get context menu of textflow container ?

Copy link to clipboard
Copied
Does TF control its CM and forbid its CM to be modified ?
Any ideas ?

Copy link to clipboard
Copied
--Brent

Copy link to clipboard
Copied

Copy link to clipboard
Copied
Alternatively, if you are in a position to be able to extend DisplayObjectContainerController for use with your container, you can do that and then override the protected method 'processContextMenuSelectHandler', which will be called automatically whenever a user 'right' clicks in the container. You can override in your class, make sure you call super, and then add items to the customItems array on the context menu. This is probably the cleanest way to do it if you can. But you should be able to handle outside the context of the container controller if you wish. If you do it outside of the container controller, keep in mind that (I'm fairly certain) the TLF container controller will also be handling the same event that you are, and you might need to adjust the priority of the listener depending on what exactly you're trying to do.
Hope this helps.
--Brent

Copy link to clipboard
Copied

Copy link to clipboard
Copied
and i also want the solution to add context menu or update the existing one process.

Copy link to clipboard
Copied
Copy link to clipboard
Copied
What I did was extend containerController to allow me to pass in the contextmenu for the textflow here is that simple class:
package classes.Email
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flash.ui.ContextMenu;
public class CustomController extends ContainerController
{
public var cm:ContextMenu;
public function CustomController(container:Sprite, con:ContextMenu, compositionWidth:Number=100, compositionHeight:Number=100)
{
cm = con;
super(container, compositionWidth, compositionHeight);
}
protected override function createContextMenu():ContextMenu{
cm.clipboardMenu = true;
return cm;
}
}
}
This seems to work perfect!
Copy link to clipboard
Copied
hi can u tell me with an mxml example, how to create a new context menu? or add some items in the existing context menu?
