Entries for Tag: 'flex'

I had a really strange bug yesterday that we found that I thought it would be good to share. We had recently launched a new application to production. Long story short, there is a screen that gets the next ID for a report, and it had been working fine for a few days. All of the sudden though, about noon yesterday it stopped working. Nothing had changed in the code and our first instinct was a network problem. But what we found out was that it really was the code.

continue reading...

Posted on Thu. December 17, 2009 by Ryan Guill #
Quote from: the FAQ from Google's new programming language Go:
Do not communicate by sharing memory. Instead, share memory by communicating.
This is a very succinct and eloquent way of saying something that I have been stressing for years when talking to web developers. OO principles teach this by way of saying that your apps should be loosely coupled, but there are too many people that do not get what this means. I usually try to describe it as "Only let this object or method work with what it is given". Never act on data that you are not explicitly given. You cannot be sure it will always be there, and you cannot be guaranteed that it will be in the proper form for you to work with.
Posted on Wed. November 11, 2009 by Ryan Guill #
Flex Sparklines

I have talked about sparklines before and this seems to be a very well done implementation of them in Flex. Putting this out there for me as much as anyone else. See also: Flex Spinner.

Posted on Wed. November 26, 2008 by Ryan Guill #
SUMO Paint

I am sure this is written in flex; It is a very compelling layered photo editor. Lots of brushes, lots of options. And it seems pretty snappy considering what it all it does. Its not going to replace photoshop for any serious users, but for the casual user, yeah, I think it would.

Posted on Mon. October 06, 2008 by Ryan Guill #
I haven't had a chance to check all of them out yet, but 10 futuristic user interfaces is a blog post title that I can get interested in!
Posted on Tue. August 19, 2008 by Ryan Guill #
Do you want to use a config.xml file for your flex applications, and be able to change the values in that file without needing to recompile your flex app? I have written a couple of utility classes to help with just that. If you create a config.xml file and stick it in your src directory and then use mx:xml to pull it in, the xml file will be compiled into the application and will not show up in your bin-debug or bin-release directories. But using this class will allow you to load and reload the configuration file at runtime. This is particularly useful when you are deploying your application to different servers in different environments. The first file is the main class ConfigLoader: package com.util { import flash.events.Event; import flash.events.EventDispatcher; import flash.events.IEventDispatcher; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; [Event(name="complete",type="ConfigLoaderEvent")] [Event(name="fault",type="ConfigLoaderEvent")] public class ConfigLoader extends EventDispatcher { private var _configXMLPath:String; private var _configLoaded:Boolean = false; private var _configXML:XML; //our favorite constructor... public function ConfigLoader(configXMLPath:String, target:IEventDispatcher=null) { super(target); _configXMLPath = configXMLPath; } //here lies the meat and potatoes of this class public function load () : void { var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.TEXT; loader.addEventListener(Event.COMPLETE,loadConfigXML_complete_handler); loader.addEventListener(IOErrorEvent.IO_ERROR,loadConfigXML_ioError_handler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,loadConfigXML_securityError_handler); //clear the config in case it has been loaded before _configXML = null; //set that the config hasn't been loaded _configLoaded = false try { trace("loading config: " + _configXMLPath); loader.load( new URLRequest(_configXMLPath) ); } catch ( e:Error ) { //trace out the error, but it will be caught below trace("an error occurred loading the config file"); } } public function loadConfigXML_ioError_handler ( e:IOErrorEvent ) : void { //woops, something went wrong with the transfer, create and dispatch an event letting everyone know var cle:ConfigLoaderEvent = new ConfigLoaderEvent(ConfigLoaderEvent.FAULT); cle.message = "I/O Error"; dispatchEvent(cle); } public function loadConfigXML_securityError_handler ( e:SecurityErrorEvent ) : void { //looks like someone is trying to access something they aren't supposed to be able to see. var cle:ConfigLoaderEvent = new ConfigLoaderEvent(ConfigLoaderEvent.FAULT); cle.message = "Security Error"; dispatchEvent(cle); } private function loadConfigXML_complete_handler ( e:Event ) : void { try { //convert the text to xml _configXML = new XML( e.target.data ); //set the flag that the config has been loaded. _configLoaded = true; //create and dispatch the complete event for a job well done. var completeEvent:ConfigLoaderEvent = new ConfigLoaderEvent(ConfigLoaderEvent.COMPLETE); completeEvent.data = _configXML; dispatchEvent(completeEvent); trace('configLoader complete'); } catch ( e:TypeError ) { var faultEvent:ConfigLoaderEvent = new ConfigLoaderEvent(ConfigLoaderEvent.FAULT); faultEvent.message = "Could not convert config to xml, document may be malformed."; dispatchEvent(faultEvent); } } public function get configXML () : XML { return _configXML; } public function set configXMLPath ( value:String ) : void { _configXMLPath = value; } public function get configXMLPath () : String { return _configXMLPath; } public function set configLoaded ( value:Boolean ) : void { _configLoaded = value; } public function get configLoaded () : Boolean { return _configLoaded; } } } and a custom event for it, ConfigLoaderEvent: package com.util { import flash.events.Event; public class ConfigLoaderEvent extends Event { public static const COMPLETE:String = 'Complete'; public static const FAULT:String = 'Fault'; private var _data:XML; private var _message:String; public function ConfigLoaderEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) { super(type, bubbles, cancelable); } public function set data ( value:XML ) : void { _data = value; } public function get data () : XML { return _data; } public function set message ( value:String ) : void { _message = value; } public function get message () : String { return _message; } } } just stick these in a com/util/ directory under source and you should be off to the races. So here is an example of how to use these classes: import com.util.ConfigLoader; import com.util.ConfigLoaderEvent; [Bindable] public var configXML:XML; //a variable to keep track if we are loaded or not public var configLoaded:Boolean = false; //create the configloader and tell it where the config.xml file is relative to src. public var configLoader:ConfigLoader = new ConfigLoader("config.xml"); // I use the initialize event on application to set up these event handlers //and load the configuration file because it does not //require any UIComponents to function. public function application_initialization_handler ( e:Event ) : void { //configLoader will broadcast an event on load complete or fault... configLoader.addEventListener(ConfigLoaderEvent.COMPLETE,configLoader_complete_handler); configLoader.addEventListener(ConfigLoaderEvent.FAULT,configLoader_fault_handler); //call load() to actually load in the file and parse it. configLoader.load(); } public function configLoader_complete_handler ( e:ConfigLoaderEvent ) : void { configXML = e.data; useConfig(configXML); } public function configLoader_fault_handler ( e:ConfigLoaderEvent ) : void { Alert.show(e.message); } public function useConfig( configXML ) : void { // so here you can now use the configXML to pull out whatever values you need. } Now this code is a work in progress of course so make sure you look over it and understand it before using it. Hope someone finds it useful.

Posted on Wed. June 04, 2008 by Ryan Guill #
Or, Pie Charts 2.0. Anil Dash on Pixel maps instead of pie charts to convey the same information. I love it; see here: http://www.dashes.com/anil/2007/07/pixels-are-the-new-pies.html Now, who wants to be the first to write a flex component that does this?

Posted on Wed. August 01, 2007 by Ryan Guill #
Someone helped me a while back figure this out (sorry, I can't remember who, if it was you, let me know!) but I thought it was quite useful, because it gives you a lot more flexibility. This allows you to create your remote objects for flex to talk to CF in actionscript instead of using the mx:RemoteObject tags. Here is the example code: import mx.rpc.remoting.RemoteObject; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.rpc.events.InvokeEvent; import mx.messaging.Channel; import mx.messaging.channels.AMFChannel; import mx.messaging.ChannelSet; import flash.events.Event; import mx.controls.Alert; public function onCreationComplete () : void { //create the remote objects first createRemoteObjects(); //set the AMF Channel on the remote objects setUpAmfChannel(); } public function createRemoteObjects () : void { ro = new RemoteObject(); ro.destination = "ColdFusion"; ro.source = "path.to.cfc"; ro.addEventListener("fault",ro_fault_handler); //You probably want and need a result handler... ro.methodName.addEventListener("result",methodName_result_handler); //You may need this if you need to do something when a method is called ro.methodName.addEventListener("invoke",methodName_invoke_handler); //You may need this if you need to catch and handle errors differently ro.methodName.addEventListener("fault",methodName_fault_handler); //This is just sugar, you really dont need it unless you want it. ro.methodName.showBusyCursor = true; } /* You can call the following method anytime to set the amf channel for a remote object on the fly */ public function setUpAmfChannel () : void { var amfChannel:Channel = new AMFChannel("my-cfamf","http://server/flex2gateway/"); amfChannelSet = new ChannelSet(); amfChannelSet.addChannel(amfChannel); //repeat the following line for all remoteObjects this.ro.channelSet = amfChannelSet; } public function ro_fault_handler ( event:FaultEvent ) : void { Alert.show( event.fault.faultString, 'Error'); } public function call_methodName () : void { //use this to call the method ro.methodName(/*pass arguments here*/); } public function methodName_invoke_handler ( event:InvokeEvent ) : void { //this will fire when the method is invoked } public function methodName_fault_handler ( event:FaultEvent ) : void { //this will fire when the method throws an error } public function methodName_result_handler ( event:ResultEvent ) : void { //this will fire when a result comes back from the method } You can see how the remote object is created, the methods are defined along with the actionscript methods that handle faults, invokes and results, and you can also specify the amf-channel on the fly, which is quite nice. This gives you far more flexibility when calling your remote object methods than the mxml does in my opinion.

Posted on Thu. January 18, 2007 by Ryan Guill #


Posted on Thu. January 04, 2007 by Ryan Guill #
Just throwing this out there because I have heard several people (including myself) that have had trouble finding these extentions on adobe.com You can find the extensions here: http://www.adobe.com/products/coldfusion/flex2/

Posted on Mon. August 07, 2006 by Ryan Guill #
Its true! Go get it now at http://labs.adobe.com/flexproductline/ and check out the changes as they relate to coldfusion over at Damon Cooper's Blog! What are you still doing reading this?!

Posted on Mon. May 08, 2006 by Ryan Guill #
I downloaded the flexbuilder 2 alpha on monday and in my free time here and there I have been playing around with it. Some quick observations: I LOVE that its built on eclipse, it works much better than the old flexbuilder. It has a microscopic memory footprint! Almost to the point that I think something is wrong. Memory usage has been as low as 424 K (!) and I have only seen it as high as 1.5 megs! crazy low. Its not screaming fast, but for its small footprint its fast enough. The new flex stuff is great. Havent messed with any as3 stuff yet (dont know if I will know when I do), but the things like viewstates are going to rock! The ability to build the swfs automatically on save, man, that is just rocking my socks off. And with this talk of the cf to flex bridge stuff, it really has never been a better time to be a cf developer. Ive got a feeling the best is yet to come.

Posted on Wed. October 19, 2005 by Ryan Guill #
I just received my copy of Developing Rich clients with Macromedia Flex, as well as the CFMX 7 WACK. I already had the advanced WACK and its great. I ordered from amazon less than 36 hours ago and the books have been at my house all morning. Ill never choose anything besides the free express saver shipping! So, as I start my journey into flex, are there any words from the wise that anyone can offer?

Posted on Wed. June 08, 2005 by Ryan Guill #
Does anyone know of a very simple, very explanatory guide to installing flex? The flex server in general is fine, although a guide to installing it with coldfusion would be even better. I have read this: http://www.macromedia.com/support/documentation/en/flex/1/flexforcf.html and the basic instructions: http://www.macromedia.com/support/documentation/en/flex/1/install.html but they are somewhat over my head. Can anyone point me in the right direction?

Posted on Tue. June 07, 2005 by Ryan Guill #
Design, Photograph, Work © Ryan Guill, aDeepBlue 2013: All Rights Reserved. | Contact | RSS Feed