It might be the Alert.show() that is expecting something else than an Object .. Philippe ________________________________
From: [email protected] on behalf of Brian Lesser Sent: Mon 2/6/2006 3:15 To: [email protected] Subject: Re: [flexcoders] SetEventHandler Limitations? Hi Jeremy, Well, first of all this does work: <uic:SignOnForm id="signOnForm" connect="connector.connect(event)"/> But this doesn't work: <mx:SetEventHandler event="connect" target="{signOnForm}" handler="connector.connect(event)"/> ...which is what confuses me. Anyway, below is the package/class with the connect method that expects an Event object as a parameter. Yours truly, -Brian package FMSComponents { import flash.events.Event; import mx.controls.*; public class FMSConnector extends flash.events.EventDispatcher{ public function FMSConnector(){ } public function connect(ev:Event):void{ Alert.show("Time to connect! from: " + ev.target); } } } jeremy lu wrote: >hi Brian, > >seems like this line is where the problem is : > >handler="connector.connect(event)" > >connect() is expecting an Object but what get passed in is an Event. > >what's inside the connect() method ? > > > >On 2/6/06, Brian Lesser <[EMAIL PROTECTED]> wrote: > > >>FYI, I now can do what I want this way without using SetEventHandler: >> >> <mx:states> >> <mx:State name="SignOn"> >> <mx:AddChild><fmsc:FMSConnector id="connector" >>/></mx:AddChild> >> <mx:AddChild><uic:SignOnForm id="signOnForm" >>connect="connector.connect(event)"/></mx:AddChild> >> </mx:State> >> <mx:State name="Main"> >> </mx:State> >> </mx:states> >> >>Which is simpler. Still I'm a little surprised I couldn't do that with >>SetEventHandler. >>For example one of the things I tried: >> >><mx:SetEventHandler event="connect" target="{signOnForm}" >>handler="connector.connect(event)"/> >> >>gives the error: >> >>Implicit coercion of a value with static type 'Object' to a possibly >>unrelated type 'flash.events:Event' >> >>Yours truly, >>-Brian >> >>Brian Lesser wrote: >> >> >> >>>Hi, >>>I'm having a problem with using SetEventHandler in Flex 2 beta. Maybe it >>>doesn't do what I would like? Within a State tag I create a component >>>and class. I'd like the class to listen for "connect" events from the >>>component. I can do that in a few ways, but have not been able to set it >>>up so that I receive the actual event from the component. A code snippet >>>is below. In it I create an Event but that's not what I want. I want the >>>event the signOnForm component is broadcasting... My apologies if I have >>>missed the answer in the docs. >>>I have tried things like >>><mx:SetEventHandler event="connect" target="{signOnForm}" >>>handler="{connector}"/> >>>and >>><mx:SetEventHandler event="connect" target="{signOnForm}" >>>handler="{connector.connect}"/> >>>without success. >>>Yours truly, >>>-Brian >>> >>><mx:states> >>> <mx:State name="SignOn"> >>> <mx:AddChild><uic:SignOnForm id="signOnForm"/></mx:AddChild> >>> <mx:AddChild><fmsc:FMSConnector id="connector" /></mx:AddChild> >>> <mx:SetEventHandler event="connect" target="{signOnForm}" >>>handler="connector.connect(new Event('connect'))"/> >>> </mx:State> >>> <mx:State name="Main"> >>> </mx:State> >>></mx:states> >>> >>> >>> >>> >>> >> >> -- ______________________________________________________________________ Brian Lesser Assistant Director, Teaching and Technology Support Computing and Communications Services Ryerson University 350 Victoria St. Toronto, Ontario Phone: (416) 979-5000 ext. 6835 M5B 2K3 Fax: (416) 979-5220 Office: AB48D E-mail: [EMAIL PROTECTED] (Enter through LB66) Web: http://www.ryerson.ca/~blesser ______________________________________________________________________ -- 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 Web site design development <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ> Computer software development <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw> Software design and development <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ> Macromedia flex <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw> Software development best practice <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw> ________________________________ YAHOO! GROUPS LINKS * Visit your group "flexcoders <http://groups.yahoo.com/group/flexcoders> " on the web. * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . ________________________________ ------------------------------------------------------------------ **STATEMENT OF CONFIDENTIALITY** This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited. We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus. ------------------------------------------------------------------ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
<<winmail.dat>>

