# Adding a constant interface to my component

**URL:** <https://forum.kirupa.com/t/adding-a-constant-interface-to-my-component/281367>\
**Category:** flash\
**Created:** [February 8, 2009, 12:18pm UTC](https://forum.kirupa.com/t/adding-a-constant-interface-to-my-component/281367 "2009-02-08T12:18:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grozavpaul](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@grozavpaul](https://forum.kirupa.com/u/grozavpaul)\
**Post date:** [February 8, 2009, 12:18pm UTC](https://forum.kirupa.com/t/adding-a-constant-interface-to-my-component/281367/1 "2009-02-08T12:18:27Z")

</div>

I have a variable named **child** in which i put one of my customized components such as a Button, Image or Text etc. But i want to add a _focus rectangle_ to my child component so that no matter what kind of component child is when i go with my mouse over it would get one effect and when i click it would get another effect.

So this is my class that is supposed to at least show my child component and then add those effects but i can’t even get it to show my component

```auto

    public class EditableObject extends UIComponent
    {
        public function EditableObject(obj:*)
        {
            addChild(obj);
        }
        
    }

```

This is how i used it:

```auto

var child:*;
child = new Button();
child.label = "test";
var child2:EditableObject = new EditableObject(child);
addChild(child2);

```

And all that i can see on my stage is a little dot 👁. The button is not scaled to show the label and it’s width = height = 0. So i tried to use the _measure()_ method from [here](http://www.adobe.com/livedocs/flex/3/html/help.html?content=ascomponents_advanced_2.html) (About the component instantiation life cycle - 12 b) yet i was not able to make it resize itself.

What am i doing wrong? How should I do it? How should I add those effects to my component? Is there a better way to do it?

[RIGHT]Thank you.  
[/RIGHT]
