Question: im trying to call a setter method in some an actionscript block of my custom component from an actionscript class.

I can do this fine when its the main application i want to call by using ;

```
Application.application.methodName();

```

however how can i call a method from a custom component? My component is in my components package and im trying the following

```
components.customComponent.methodName()

```

however its not happening, 
any ideas?

---

an instance of my custom componet calls the actionscript class so i dont want to instantiate the custom class again inside the actionscript, i just want to call a setter method...

any other ideas?

Answer: 
You don't have to make the method static; doing so would likely be useless, as you'd want the method call to do something with the component's current state, I'm guessing -- use some of its data, change its appearance, etc. What you really need is an object reference.

Since Application.application resides at the top (or actually very close to the top) of the fabled Display List, you should be able to access each component by starting at that point and then [traversing the Display List](http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_09.html) -- until ultimately, upon arriving at your nested component, calling its publicly defined method. 

However, I must say (with the utmost respect!) that you're venturing into dangerous OO waters, here. :) The right way to do this would really be to figure out some way to pass a reference to your custom component to the ActionScript class that requires access to it -- for example, in your MXML:

```
<mx:Script>
    <![CDATA[

        private function this_creationComplete(event:Event):void
        {
            var yourObject:YourClass = new YourClass(yourCustomComponent);
        }

    ]]>
</mx:Script>

<components:YourCustomComponent id="yourCustomComponent" />

```

... and then in your ActionScript class:

```
public class YourClass
{
    private var componentReference:YourCustomComponent;

    public function YourClass(component:YourCustomComponent)
    {
        this.componentReference = componentReference;
    }

    private function yourMethod():void
    {
        this.componentReference.someMethodDefinedInYourComponent();
    }
}

```

An approach like that would probably serve you better. Does it make sense? I'll keep an eye our for comments; post back and I'll do my best to help you through it.
You need to make sure you have a reference to an instance of that component from where you are trying to call it. So in the example below you can see that i've created an instance of B inside of the constructor of class A. So now i have an instance of B. Now from that instance i can call b.someMethod()

```
public class A
{
   public function A()
   {
      var b : B = new B();
      b.someMethod();
   }
}

public class B
{
   public function B()
   {
   }

   public function someMethod() : void
   {

   }
}

```

You can think of class A as your Application.mxml and class b as your custom component. So whereever you are trying to call it you need to make sure your component has been created.