Posts Tagged ‘Flex’
In Flex, we sometimes need to find the component nearest to the mouse cursor. The following example will show you how to do so. Here are the basic steps:
- We will set up an event listener to watch for mouse movements.
- On every mouse movement, we will loop through all the application’s children, evaluating each one.
- We retrieve the bounding rectangle for the component we are currently evaluating.
- If the cursor is to the left or right of the component, we find the distance between the x position of the cursor and the x position of the nearest vertical side of the bounding rectangle. If it’s not to the left or the right, the horizontal distance is zero.
- If the cursor is above or below the component, we find the distance between the y position of the cursor and the y position of the nearest horizontal side of the bounding rectangle. If it’s not to the top or the left, the vertical distance is zero.
- We use the Pythagorean theorem to find the actual distance between the cursor and the component using the two distances previously determined.
- If it is a shorter distance to the component we are evaluating than the distance to any of the components previously evaluated, we’ll make note of it.
- Finally, we report the closest component found.
…I want more!
Tags: closest, distance, Flex, measure
Posted in Flex | 1 Comment »
Yesterday I took the Adobe Flex Certification exam. I did pretty well and passed, so I thought I’d share the resources I used to study:
http://partners.adobe.com/public/en/ace/ACE_Exam_Guide_Flex2.pdf
This will give you a brief intro to the exam, a few ideas of where to start your studying, and a short sample of questions to get you into the testing rhythm. The questions on there are a fairly good representation of what you might find on the exam.
http://office.realeyesmedia.com/blogs/jun/samples/certification/Flex20Blueprint.htm
This does a good job of breaking down all the topics that might show up on the exam. It would be helpful to look through the various items and focus on your particular weaknesses.
…I want more!
Tags: certification, exam, Flex, study
Posted in Flex | 1 Comment »
If you’ve read my article on Action Message Format (AMF) you’ll already know that AMF is a super-duper way to transfer data between a Flex/Flash/AIR application and its server-side counterpart. Essentially when the client application makes a call to a service, the server can return a Java (or PHP, Python, .NET) object and when it gets back to the Flex application, wallah, its converted into an identical object in ActionScript. Similarly, if the client application sends an ActionScript object to the server during a service call, it arrives as an identical Java object.
While that’s impressive, when it comes to implementation in a medium-to-high complexity system there are questions that still need to be answered. In this article, I’d like to address where to translate custom AMF classes.
…I want more!
Tags: amf, class adapters, coupling, Flex
Posted in Flex, General Programming | 8 Comments »
There isn’t one. At least not for everyone. That’s the bottom line and hours of googling won’t change it. I’ll explain what I mean–but first, here’s a real intro:
…I want more!
Tags: cairngorm, Flex, framework, guasax, mate, model view controller, mvc, nimbus, puremvc
Posted in Flex | No Comments »
With the advent of Flex and RIA (Rich Internet Application) development came AMF (Action Message Format). Flex, in general, focuses only on front-end functionality, meaning it does not directly hit a database to store or retrieve persistent data. Instead, database calls are written in a more traditional back-end language like Java, PHP, Python, or .NET and such services are then exposed to be “consumed” (used) by the Flex front-end.
AMF is a protocol that allows ActionScript (the language of Flash/Flex) to call services exposed by the back-end. Additionally, if you choose, AMF allows you to translate a programmer-defined object between ActionScript and your back-end language of choice. In other words, if you have a customer class in ActionScript and you want to pass an instantiated customer object to the back-end, you simply call the exposed back-end service and pass the customer object as a parameter. The AMF layer transparently translates the ActionScript customer object into, let’s say, a customer object in Java. This functionality isn’t required. Instead of using a class you have defined, you could instead just send an integer to the backend as a parameter and, after processing, send a string back to the front-end. …I want more!
Tags: amf, AMFPHP, Flex, serialization
Posted in Flex, PHP | 1 Comment »