Need Flex Migration Help?
- Adobe ends Flash player support in 2020
- Flex apps will no longer function
- We can help migrate your app
[UPDATE]
The post below was originally for Flex 2. In Flex 3, the property name has changed to UIComponentGlobals.designMode.
[/UPDATE]
Ever write a custom component that needs to do something different in design view than at runtime?
Perhaps at runtime the component should query an rpc service and return the results, but, in design view, it just needs to display a filler value.
Well the nice folks at Adobe have given us a completely undocumented way of handling this.
UIComponentGlobals.mx_internal::designTime which is found in mx.core. UIComponentGlobals is a Boolean value that will tell you if the application is currently displayed in flex builder’s design view.
So, for a random example:
if ( UIComponentGlobals.mx_internal::designTime ) {
this.text = "In design View";
} else {
doSomethingComplicatedToGetOurData();
}
We use it to handle some conditional instantiation in our larger components. You can use it to… I don’t know. Do something cool.
ML
Actuallly how to reproduce this? Any case, I’ve tried and didn’t work as well.
In Flex 3 it has changed to UIComponentGlobals.designMode
Sweet.
Thanks for the update.
Mike