Hmmm... Have you tried something like this:
<mx:Script>
<![CDATA[
//call this on application creationComplete(or when ever after that)
private function creationISComplete(e:Event):void{
//foo is in essence a class with the method setTempMethod()
foo.setTempMethod()
}
]]>
</mx:Script>
<c:MyComponent id="foo"/>
hth
B.
On Wed, Apr 2, 2008 at 6:17 AM, khan.ibraheem <[EMAIL PROTECTED]>
wrote:
> Thanks for the reply. But setTempMethod() lives in the Canvas, not in
> the label. However, I have reverfied and it is working.
>
> Your reply was indeed helping in the way, that I came to know that I
> was doing right thing. I just recheck it & there was nothing wrong in
> it. Maybe I havent saved the source code or something else.
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "Douglas
> Knudsen"
>
> <[EMAIL PROTECTED]> wrote:
> >
> > you have a scope issue there, setTempMethod() lives in the Label not
> > Canvas. Move this method up inside Canvas and teh outside world
> will have
> > access.
> >
> >
> > DK
> >
> > On Wed, Apr 2, 2008 at 8:02 AM, khan.ibraheem <[EMAIL PROTECTED]>
>
> > wrote:
> >
> > > Hello,
> > >
> > > I am creating a custom component and have 2 questions regarding it:
> > >
> > > 1) One way, I am thinking is to create actionscript class and use
> it. I
> > > can add controls using addChild method. But how can I set absolute
> position
> > > of the control.
> > >
> > > 2) The other way was to create MXML component and place all controls
> > > through the help of designer. But is it possible, that I can
> access methods
> > > created in MXML component.
> > >
> > > For example:
> > > ==========================================================
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="356"
> > > height="38">
> > >
> > > <mx:Label x="41" y="8" text="text" fontFamily="verdana"
> fontSize="12"
> > > fontWeight="bold" height="20"/>
> > > <mx:Script>
> > > <![CDATA[
> > >
> > > public function setTempMethod():void
> > > {
> > >
> > > }
> > > ]]>
> > > </mx:Script>
> > > </mx:Canvas>
> > > =============================================================
> > >
> > > I have tried to access "setTempMethod" from application but it wasnt
> > > allowing me to do so. So, I need help so I can create methods in
> components
> > > which can be used outside the component.
> > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Douglas Knudsen
> > http://www.cubicleman.com
> > this is my signature, like it?
> >
>
>
>