<ahref="http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/* http://weather.yahoo.com/forecast/94089_f.html">Full Forecast at Yahoo! Weather</a>
(provided by The Weather Channel)
]]>
94089_2007_11_06_18_56_PST
When you need to access the nodes with complex node names such as yweather:location think XML namespaces.
In the above example, look for the xmlns declaration in the rss node
- xmlns:yweather='http://xml.weather.yahoo.com/ns/rss/1.0'.
Creating a Namespace object using the declaration will allow us to access the nodes with complex names.
Creating a Namespace object is a pretty simple process:
With the preceding example we need to know the namespace url ahead of time. E4X gives us the namespaceDeclarations() method that will return an array that contains the namespace declarations associated with the XML document
Using the namespaceDeclarations() method from the XML object:
Keep your code flexible - program to interfaces. What does this mean? Well there are a few things that we need to discuss before we can really answer that question. For this discussion you'll need a decent understanding of Object Oriented programming…but, hey if you don't have that it still may make some sense anyhow and you might even get something that you don't understand explained for you as we go along.
First things first, Polymorphism - The ability for one class to stand in for another, kind of. By "kind of" I mean that by programming to an interface, a variable or property's value can be assigned to an object that conforms to a "formal interface", more on that in a second. This means that if you crate a property or variable that is typed to an interface - myPet:IAnimal; - (where IAnimal is the interface) that item can be any number of classes that follow the "interface" defined by IAnimal .
Each of the classes, Dog, Fish, Camel, Giraffe must "implement" the IAnimal interface.
Okay, so what is a formal interface you say?
First off, a formal interface is a definition, some might say a contract, but I think that is confusing, of what a class's publically accessible methods should be and what they should look like. ActionScript 3 provides a construct to create these interfaces that is very similar to classes. Basically you create the public methods, their parameters and their return types, but nothing that has to do with what happens inside the method.
Notice that there is nothing that tells you what you need to do in the methods, or anything about properties or private methods. That is determined by the needs of the class that implements the interface. This is a good point to take hold of and knock into your head:
A class has an implementation (what the class does ) and an interface (how the outside world interacts with it).
This is what allows your code to be flexible. If you program to interfaces, you can crate objects that are much more flexible and powerful by have the ability to "stand in" for any property or variable.
You can also create an "interface" through inheritance by using something called an "abstract" class. An abstract class isn't intended for instantiation, so it is up to you to manage that. But abstract classes do allow for a default implementation (what the class does) as well as allowing for the type of interface implementation mentioned above because sub-classes inherit the interface of their parent classes.
So, keep your code flexible, program to interfaces!
Lately I've been working with CruiseControl, a continuous integration tool, and unit testing (ASUnit and FlexUnit) for our ActionScript 2, ActionScript 3/Flex projects. With the help of a couple of some great posts from eyefodder and Peter Martin, I've finally come up with a nice little system that isn't too much of a headache to set up and is very easy to maintain once it is set up.
When I get some real time, I'll be sure to blog about the set up and give some walk-throughs on how to get everything up and running.
The basic 'gist' of continuous integration is:
To build your code as soon as it changes. This helps to identify problems with the source code as quickly as possible after the problem is introduced. By introducting unit tests into the build process, you add more integrity to the build as well as your code.
So, like I said as soon as I get some real time, I'll be sure to put together some set up information.
There are many common events for Flex components, such as the click or change events. These events are very usefull and great for many situations. Your application or custom component may require more from an event than is provided in these built-in events. Not a problem! You can dispatch any of the predefined events inherited by a component's superclass, as well as new, custom, events that you define within the component.
To dispatch a new event from your custom component, you must do the following:
Create a subclass from the flash.events.Event class (or another event class) to create an event class that describes the event object. This step is optional.
Flex 2.0.1 SDK hotfix 1 (build 159086) is a collection of bug fixes that have been completed since the Flex 2.0.1 release on January 5, 2007.I like this note: "Installation of this hotfix release is not recommended for customers who are not experiencing one of the described issues"
Apollo is a cross-OS runtime that allows developers to leverage their
existing web development skills (Flash, Flex, HTML, Ajax) to build and
deploy desktop RIA’s.
Darron Shall announced on his blog that FlexLib is now launched.
FlexLib is a Google Code project that aims at being a concentrated effort by the Flex 2 community for creating high quality user interface components. FlexLib provides a standard component namespace, package structure, code and naming conventions, and common reusable base classes to unify the various efforts people have put forth on their own.
Also mentioned it FlexBox which Jun Heider brought to my attention yesterday. FlexBox is directory of Adobe Flex components available for developers.
Darron Shall's full post includes some additional Flex resources. Check it out and get Flexified!
Missing the LuminicBox debugger in Flex 2? Mark Walters at digitalflipbook has translated the LuminicBox classes from AS2 to AS3. Now you can debug the way you're used to (although the debugger in Flex Builder is still pretty great).
I'm a senior developer at RealEyes Media, Adobe Certified Instructor and Adobe Certified Professional. Here you'll get my ideas and experience Flex, Flash, ColdFusion and related technologies as well as some generally off the wall stuff.