I’ve been working on a way to program software using a simple instructions instead of writing code. In that journey I found Flex MXML is helping to solve that problem. I’ll give you an example. Let’s say you want to filter a list of values. In code you would create an ArrayCollection, then create a function that filtered the values to match what is typed into a search text input. You’d also add event handlers to run the filter when the text input changes.
What I’d like to be able to do is type, “Filter Collection” and then set some options. I’m not there yet but I’m getting closer. This MXML code will do that:
<s:HGroup>
<s:TextInput id="filterInput" width="80%" prompt="Search"/>
<s:Button id="searchButton" label="search"/>
</s:HGroup>
<fx:Declarations>
<!-- FILTER -->
<handlers:EventHandler eventName="change" target="{filterInput}">
<data:FilterCollection target="{arrayCollection}"
source="{filterInput}"
sourcePropertyName="text"/>
</handlers:EventHandler>
</fx:Declarations>
The code above uses the EventHandler class to add an event handler to the search text input change event. This event occurs when as you type into the text input.
Once the event is triggered it runs the code listed inside of it. The code inside are part of the Effects classes. These allow you to run code in a sequence or parallel. It also allows you to pause and resume in the middle of a sequence of effects. They are part of the Effects classes but they are different from normal effects in that they are used for more than just performing visual changes.
The post title uses the term “code snippets” but they are the same as or related to what commands, behaviors, actions, interactions, macros, soft keys, scripts and so on.
Here is an example project demonstrating their general use http://www.flexcapacitor.com/examples/LibraryExamples/
The library of action effects and more info can be found here http://code.google.com/p/flexcapacitor/.
Note: There are many different categories of effects. For example, database behaviors are listed here.
Note: I wrote these in a way that you don’t have to “buy in” to a framework. You can use them when you need them. They are also good for learning code. The code used to perform the actions are in the instance classes.
Comparisons

