I'm trying to create a cutom made clickablle field using AS3 but I have problem registering an OnClickListener.
What I do is create a subclass of MovieClip, draw a RoundRect on it and add a textfield as a child. Now when I click on that "thing", events are caught by the textField and I can't find a way to forward it to my MovieClip.
private function addListChild(i:Number, l:Number, c:Content):void {
var x:Number = 100;
var y:Number = 100;
var width:Number = 200:
var height:Number = 20;
var menuitemMV:ContentMV = new ContentMV(c);
//set background
menuitemMV.graphics.beginFill(MyGestureManager.midgrey, 1.0);
menuitemMV.graphics.drawRoundRect(x5, y5, width5, height5, 8,8);
menuitemMV.graphics.endFill();
//Create text label
var listText:TextField = new TextField();
listText.autoSize = TextFieldAutoSize.CENTER;
listText.selectable = false;
var format:TextFormat = new TextFormat();
format.color = MyGestureManager.lightGrey;
format.size = iconHeight * 0.4
listText.defaultTextFormat = format;
listText.appendText(c.getName());
listText.x = x+5;
listText.y = y;
menuitemMV.addChild(listText);
addChild(menuitemMV);
menuitemMV.addEventListener(TuioTouchEvent.TOUCH_DOWN, handleDown);
listText.addEventListener(TuioTouchEvent.TOUCH_DOWN, handleDown);
}
How can I now forward the ClickEvent registered by the textfield forward to my button to work with it...? Any idea, or is it even clear what I mean?