Thanks Greg!
 
I actually just found this myself a few minutes before your reply, but
thanks for your effort nevertheless.
 
The Flex way is much easier and better to use, than Flash - it just
takes a little getting used to.
 
My deepest thank you's to everybody on this list, that continually help
me out :)
 
Regards,
 
Mike

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of greg h
Sent: Saturday, January 06, 2007 1:10 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] What happened to mx.utils.Delegate?


Mike,

I can not say for certain if the following will be of assistance.
However, based on your very concise description, it appears to
corroborate what you have observed.

The following is from page 16 in the PDF document "Migrating
Applications to Flex 2":


Step 4: Update events
The Event model changed in Flex 2. However, you can migrate most event
handlers with
minimal effort. This section describes the most popular changes that you
must make to your
event handling code.
...
Remove delegates
You are no longer required to wrap a listener function with a Delegate
to maintain application
scope. You can remove the Delegate from the following line:
b1.addEventListener("click", mx.utils.Delegate.create(this,myListener));
So the line appears as follows:
b1.addEventListener(MouseEvent.CLICK, myListener);


I personally have found portions of the "Migrating Applications to Flex
2" critically important.  For reasons I do not know, this critical doc
is available as PDF only.  Personally I would like to see this doc
included in the HTML browsable versions of the documents, and especially
up on LiveDocs where search engines could index it.  That all said, the
direct link for downloading the PDF version is:
http://www.adobe.com/go/flex2_migrating_pdf

I just pulled the download link from the main Flex 2 Documentation page
at:
http://www.adobe.com/support/documentation/en/flex/

hth,

g


On 1/5/07, Mike Anderson <[EMAIL PROTECTED]> wrote: 

        Is this now gone?
        
        I am trying to add an EventListener to a Control that doesn't
reside
        locally to the main application.  With that said, I need to use
the
        Delegate Class in order to specify the proper scope. 
        
        In Flex 1.5 as well as Flash, I would have coded my function
similar to
        this:
        
        private function addEventListener():void
        {
                myControl.addEventListener("change",
        mx.utils.Delegate.create (this, onControlChange));
        }
        
        private function onControlChange( event:Event ):void
        {
                // Change code goes here
        }
        
        Of course, the compiler knows nothing of the Delegate class and
I get a
        compile error - 
        
        This question also relates to my previous post, and I am hitting
a major
        brick wall with this scoping stuff.  I had this down to a
science with
        all the Flash Applications I wrote in the past...  I am getting
a tad 
        frustrated, trying to port all my AS 2.0 code, to the new Flex
        environment.  Even Flex 1.5 had the Delegate Class - so Flex 2.0
must
        have done away with it???  If so, how am I supposed to scope my
        functions??? 
        
        Thanks in advance for all your help,
        
        Mike
        


 

Reply via email to