Thanks a lot Scott! I guess there will be plenty of a stuff to write books about. Plus the great variety of options will make it even more important to have proper frameworks for the next generation of flash based RIAs.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Fanetti Sent: Tuesday, 14 February 2006 1:52 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] AS 3.0 tutorials Robin, I am right there with you about the migration from AS2 to AS3. Basically, as I gather it, packages are pretty much the same thing as the class path in as2 classes. com.exampleClass would become package com{ public class exampleClass{ public function exampleClass(){ ... code } } } some things to remember. AS3 constuctors cannot be private ( as of yet ). All the declarative classes (<mx:Button or <mx:Array ) in Flex have actionscript analogues. The event model has been completely revamped, too. Instead of using: myBtn.onPress = function(){ --click functions } you use myBtn:Button = new Button(); myBtn.addEventListener(MouseEvent.CLICK,doOnPress); function doOnPress(e:MouseEvent):void{ switch(e.target){ case myBtn: if(e.type==MouseEvent.DOUBLECLICK){ do one thing }else{ do another thing } break; case homeBtn: -- home button actions break; case menuBtn: -- menu button actions break; } } The whole point is to break apart the procedural calls associated with typical actionscript and tie the framework together in an object oriented setting that passes informative event objects to a centralized event processing area. This might seem like a lot of setup work for a small application, but the goal with AS3 is to allow for the complexity associated with rich internet applications in a flash client. Imagine putting a thousand onPress events all over your application then finding out you need to refactor (change) a huge chunk of your code to add another type of functionality. You would have to search through your code in a hundred places on a hundred frames to get the whole thing right. With the new way, your centralized events can be monitored and dispatched in one location You could do this with AS2, but it required some hacking. The whole MouseEvent.CLICK thing is just a constant in flex with the value of "click". They just wanted to provide a constant based reference to the event name so that developers didn't screw up their app with a typo. The whole e:MouseEvent thing is the event object that gets passed as a parameter when the event reaches its target. You can tell the function to accept e:ChangeEvent or e:WhateverEvent and the event will only active the function if it is the right kind of event. This can help you sort through the different types of events that are available in AS3. You can use that event object to get information about what triggered the event - as well as define custom reactions to the event as it flows through the document tree ( think of the document as an XML file and your button is a node) I know this 5 second breakdown sucks - and I am just really starting to understand this stuff today - literally I learned this stuff today - so don't feel like you are alone in the dark. Also - if you are a Flex guru with better information - or if I screwed up on my syntax above - I would love to get a reply to correct it. Thanks Scott Fanetti _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

