I haven't been following this thread, but if you find yourself putting the same 'change' handler on each instance of your TimeText component, then you should instead make that handler part of the DEFINITION of that component.

 

Although you could accomplish that by registering it in an override of createChildren(), it would be more natural to put it on the base tag of your component definition. It sounds like your TimeText is an MXML component extending TextInput. In that case, TimeText.mxml should look like this:

 

    TimeTextt.mxml:

 

        <mx:TextInput change="processTime(event)">

            <mx:Script>

                private function procesTime(event:Event):void

                {

                    ...

                }

            </mx:Script>

        </mx:TextInput>

 

That way, you can just write instances as <comp:TimeTextt> and every one will automatically have processTime() as its change handler.

 

This is similar conceptually to defining the component

 

    OKButton.mxml:

 

        <mx:Button label="OK"/>

 

and writing <comp:OKButton/> instead of <mx:Button label="OK"/>. Here you've set a property, rather than an event handler, as part of the component's definition so you don't have to set it on each instance.

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of boy_trike
Sent: Tuesday, October 03, 2006 6:00 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: can NOT call method in component

 

Well Thanks, of course, it works FINE now, with your suggestion.

Now here is the important question......

I feel like I know flex pretty well (not too difficult to figure out how all of the components
work...maybe a 9 on a 0 - 10 scale).

However, my actionscript knowledge seems to be a 1 MINUS!. I would have had NO idea to
look for the createChildren function. where the heck do I learn that info? would going to
MAXX help ?? any books you want to recomend? (wanna consult for $$$ ??? )

Bruce

--- In [EMAIL PROTECTED]ups.com, "Michael Schmalle" <teoti.graphix@...> wrote:
>
> Hi,
>
> Since you are instantiating the component in an Application, the scope is
> off,
>
> <comp:TimeText id="tt" change="processTime (event)" />
>
> needs to be
>
> <comp:TimeText id="tt" change="tt.processTime (event)" />
>
> I know that isnt what you wanted to here but the scope always refers to the
> application everywhere except a component tag.
>
> Why don't you add a listener in you custom component say in createChilren()
>
> IE
>
> override proected function createChildren():void
> {
> super.createChildren();
> addEventListener(Event.CHANGE, processTime, false, 0, true);
> }
>
>
> Peace, Mike
>
> On 10/3/06, boy_trike <[EMAIL PROTECTED]..> wrote:
> >
> > in my application, i am asking for time input in many places. right now
> > I have a
> > change="processTime( event)" in the text input of each time variable. (my
> > process time
> > parses the input". Of course, this requires that I import the ProcessTime
> > function into each
> > component that uses it. I created a new component called TimeInput based
> > on textInput and
> > added a public function processTime.
> >
> > When I try to use this component i.e.
> > <comp:TimeText id="tt" change="processTime (event)" />
> >
> > I get the error "call to possibly undefined method"
> >
> > Help
> >
> > Thanks
> > Bruce
> >
> >
> >
>
>
>
> --
> What goes up, does come down.
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to