Archive for the 'Flex' Category
Disable Drag for Certain Items in List
Drag and drop is easy in Flex when you have basic requirements. Just setup a list with dragEnabled=”true” and you’re up and running. However, what if you need to disable dragging for only a select few items in your list? For example, if you have a list of users and you can only drag a user with a specific role, such as an admin.
The answer is pretty simple, create a custom ItemRenderer and stop the mouseDown event from propagating.
....
private function onMouseDown(event:MouseEvent):void {
if (someCondition == true)
event.stopImmediatePropagation();
}
[RemoteClass] must specify alias
Most metadata tags in Flex have default property values. For example, the following are equivalent:
[Embed("/path/img.png")]
However, when using RemoteClass, even though it only has 1 possible parameter (”alias”), it still requires that you specify the property name as follows:
[RemoteClass(alias="com.myDTO")]
// NOT correct:
[RemoteClass("com.myDTO")]
Monster Debugger
This is a fantastic external debugger for Flex/Flash applications. The primary thing I love is being able to change properties at run time, and being able to execute methods.
Grab it here, it’s free: Monster Debugger
No commentsSlider Increment – snapInterval
For future reference, trying to remember what the property name was for the interval or step size for a slider. The property is named “snapInterval”
No commentsTargeting the Right Component for Transitions
When doing any state transitions, you have to be sure to specify the intended target. For instance, recently I was debugging some client code to see why a fade wasn’t working. It turned out that the target was set to the parent group instead of each specific component.
<s:Transition fromState="*" toState="*">
<!-- INCORRECT way of doing it:
Don't target the parent container-->
<s:Fade target="{[content]}"/>
<!--CORRECT: target each specific component-->
<s:Fade targets="{[pageOne, pageTwo]}"/>
</s:Transition>
</s:transitions>
<s:Group id="content">
<local:PageOne id="pageOne" includeIn="one"/>
<local:PageTwo id="pageTwo" includeIn="two"/>
</s:Group>
In this case, you need to target pageOne and pageTwo, NOT content.
No commentsFlex Formatter
After moving from projects that religiously used FlexFormatter to one that didn’t, I realized just how nice this plugin is. If by chance you haven’t heard of it, FlexFormatter is an eclipse plugin that will format spaces, tabs, declarations, reorder properties & functions, indent, and lots more.
To install, use the update site http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite.
No commentsMikeOrthLib updated
I added a lot of new custom Flex components to my library, MikeOrthLib. It includes a PagedDataGrid control, some handy popup base classes, and other utility components.
Check out the example application (work in progress).
360|Flex San Jose
I just got back from 360|Flex conference in San Jose. I got to meet a lot of cool people, as well as put faces to several fellow Universal Mind guys. At past 360s, you had to search to find someone with a PC because it was overwhelmingly Macs, but I was surprised at the amount of PCs I saw this time. There was also a lot of focus on mobile development. Looking forward to next time.
1 commentPlaying with 3D Rotation in Flex 4
I wanted to experiment with the new 3D features in Flex 4 Gumbo, so I made this simple rotate demo. Your mouse controls the rotation of the paw. I used the new functionality of
&
for the ‘info’ button effects and when clicking the paw. Rather than use the Rotate3D effect, I am just setting the rotation properties on MouseMove.

This was done for my good friends at CFBgaming.com.
Skinning Flex 4 slides, Uber-Basic Example Button Skin
Here are my slides from Flex Flash Camp along with an uber-basic example button skin that shows a quick breakdown of a Spark Skin. Great for those who haven’t had time yet to really peer into Flex 4 skins. Look for more advanced skinning topics soon.
<!--
UBER-BASIC BUTTON SKIN EXAMPLE
Demonstates:
- States
- FXG Graphics
- Skin Parts
Mike Orth 2009
-->
<s:Skin
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
>
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<!--SKIN STATES-->
<s:states>
<mx:State name="up"/>
<mx:State name="down"/>
<mx:State name="over"/>
<mx:State name="disabled"/>
</s:states>
<!--graphical elements-->
<s:Rect top="0" bottom="0" left="0" right="0">
<s:stroke>
<mx:SolidColorStroke color="0x000000"/>
</s:stroke>
<s:fill>
<mx:SolidColor color="0xFF00CC"/>
</s:fill>
</s:Rect>
<!--SKIN PARTS-->
<s:SimpleText id="labelElement"
top="5" bottom="5" left="20" right="20" />
</s:Skin>