A Persistent/Interactive Tooltip in Flex

I came across a requirement at work a few weeks back which involved an "interactive" tooltip... We needed to provide a summary of information in the tooltip, but then provide a link button to a more detailed document.

I came up with the following example by creating some functionality around the DataGrid mouse movements to display a "tooltip" (in reality a Menu instance) at the mouse position. Rather than digging into the framework to try and extend the ToolTip class to make it "stick" when moused over, I realized we've got popup menu functionality like that already. Slap a custom menu item renderer in there, skin it, and you've got a mousable, interactive tooltip instance.

I could have gone the extra mile and created a custom DataGrid instance using this new functionality, but I'm lazy so I'm just going to post the instance I implemented and let you figure out how to implement it for yourself :-) The idea being that it could be just as easily implemented on any List based control, and even with a bit of work any component in the Flex framework. Just modify the renderer to fit the content you need!

Example Here

Source Here

Copy from DataGrid to Clipboard/Excel in Flex

A really simple example today for a pretty useful feature... being able to copy contents from a datagrid (or any structure which uses a dataProvider for that matter) onto the system clipboard, and into an application like Excel.

Excel is able to recognize an HTML table format and pastes the structure into appropriate cells. The following example is tailored to that type of structure, but can really be formatted to whatever needs you have by modifying the createHTML() (or more appropriately named) method.

View example here : Example

And source here : Source Code

Set "Loading" screen background color on Flex

If I had a nickel for every time I've looked at a Flex application these days and seen that dull, default greyish blue color...

So here's my tip for the day:

Check out the compiler arguments line in the Flex properties and add

-default-background-color #PUTYOURCOLORHERE

Easy to do, and then your Flex apps won't look like everyone else's anymore :-)

More compiler arguments are available if you'd like to get frisky...

http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=compilers_123_24.html

And better yet, check out Ted Patrick's blog on creating custom preloaders and be a real rock star.

http://www.onflex.org/ted/2006/07/flex-2-preloaders-swf-png-gif-examples.php

Installing CFEclipse/Subclipse plugins on FlexBuilder 3

A co-worker sent me this post for installing things through software updates. Issue is, trying to install through update sites would result in error:

Eclipse Modeling Framework (EMF) - org.eclipse.emf.codegen.ecore.ui (2.3.0.v200706262000) requires plug-in "org.eclipse.jdt.core".

Joao (Fernandes?) has posted the solution over on his blog:

Link Here

Note the comment I added about having to check a second option labeled:

'Eclipse Java Development Tools 3.3.1.r331_......' as well to get it to work.

Thanks Joao!

What is Adobe Thermo? - Answer: Designer/Developer Integration

Notes taken from the keynote at MAX:

- an RIA design tool

- allows designers to create rich internet applications with logic embedded

- allows them to wire up interactivity without working any code

- allows them to use dynamic data without having access to the data source

- seamless workflow for developers working with flex builder

- can access Flex source code for the design

- taking a layered image from photoshop, and importing the psd file into Thermo generates layout and code for that layout.

- converting artwork to components on the fly (wow, very cool)

- they take a rectangle graphic, right click, convert to a TextInput component, and it retained the text within the graphic (made default text of TextInput component), all style information on the graphic is transferred to component (including font styles)

- highlight multiple graphical elements, and converted the group to a list, and creates a design time data set with the selected images to power the list

- changed padding on list items, and an onion skin of original image placement was retained for reference but just with reduced opacity

- edited an item in the list in place, and added an event to it to go to a new state, applied a transition to the state change. The state change was a size change, and was able to preview the increase in size, with the transition effect applied. Added some text information underneath the new state, which had fade effects applied to it. Was able to stagger effect play times using a simple gantt chart type tool.

- automatically provides lorem ipsum text for testing, and can define the number of words to show for it.

- takes two selected rectangle and converts to a scrollbar instance (seriously?... no way...) Able to identify the different layers of the graphic selection as the different components of a scrollbar. Associates the new scrollbar with the list using a wiring handle to simply drag over the list that it should affect, binding the two components together.

- able to easily add new items to the design time data collection

- and it all just works... amazing... bring on the applause :-)

- thermo and flexbuilder share the same project format, meaning designers and developers can very easily collaborate during development cycle.

- can expect early alpha/beta next year (2008).

Flex is Catching On... a conversation on the Train

More than a few times on my commute into or home from work, I see people plugging away on laptops, and wonder what they're working on. Sometimes, if I'm sitting directly behind them, I can make out the Eclipse IDE view, and immediately think "Hey, maybe they're working with Flex?"... I'm not peeping, or want to intrude by asking what they're doing (would be kind of rude no?)... but still wonder.

Then this morning, for the first time ever, I overheard a couple of guys above me discussing Flex. Well that's kind of neat isn't it... a sure sign that the Flex buzz is really catching on. I caught bits of the conversation, and the two guys (one with a background in Flash) had nothing but positive things to say about the framework, and ability to create "cool" things easily.

So a word of caution... don't sit close to me on the train if you want your privacy ;-)

"Flash Player Not Found" Flex Builder/Player patch

Mike Morearty has posted a fix for a FlexBuilder fix if you've installed FB3, or just the newest version of the Flash Player, and are all of a sudden seeing "Flash Player Not Found" when compiling your apps. Check it out here...

http://www.morearty.com/blog/2007/04/16/new-flash-player-and-also-a-flex-builder-patch/

Google Finance with Flex from Silvafug last night

So I gave a presentation at the Silvafug meeting at Adobe in San Jose last night on Flex Charting. I struggled on what to give the talk on up until about a week ago. I finally decided to continue with the basic range selection example I'd done a few months ago, and create a "Google Finance" app in Flex, with all (or almost all) the functionality that the Google app offers.

While the presentation was exciting and fun to do, I think my last minute prep, and the fact I haven't spoken in public for many many many years resulted in a less than stellar walk-through of the functionality involved. However, the experience and feedback gained from last night was HUGE. I realized how I can improve the presentation 1000% percent, and plan on doing so before I give my talk in Seattle at 360Flex on August 13th (at least that's the tentative date.

Today I'm posting the app for everyone to play around, but am holding off on posting the code until Seattle (I don't want to steal my own thunder). However, I fully intend to release both the code-base, and an associated swc file for everyone to use, and integrate their own data into this type of interface. Hopefully this might entice the fence-sitters to attend 360 in August if you're interested in this kind of stuff.

I will say that it's not complicated stuff... and everyone and anyone should be able to insert their own data, or adapt the UI to fit their own project needs.

So here's the app... (click the image to view)

Flex Chart Annotations... Source and Example

I've finally posted my Flex Charting Annotation sample and source code over on my personal blog... http://www.visualconcepts.ca/blog/

360Flex Conference - Seattle

A quick note that I'll be doing a presentation at the 360Flex conference in Seattle from August 13th to 15th. More details to come as I finalize a topic. Looking forward to seeing even more talented/aspiring/curious Flex developers than we had in San Jose.

360 Flex - Seattle

Chart Range Selector - Take Two

After the great feedback I've gotten from the previous post, I decided to add a tad bit more functionality... namely the ability to drag the upper and lower selected chart areas. Same link as before... just click and drag...

http://www.stretchmedia.ca/code_examples/chart_range_selection/main.html

Flex Chart Range Selector - Google Finance'ish

So I noticed some posts re: this type of component on flexcoders the other day, and being that I was bored at work on this sunny Friday afternoon, decided to give it a whirl. Right click to view source inside app...

http://www.stretchmedia.ca/code_examples/chart_range_selection/main.html



After I finished putting this together (in all of 45 minutes) I was as giddy as a little kid because it's just so damn COOL... Yeah, it doesn't have all the bell's and whistles that the graphing on Google Finance has, but still, can you imagine how long this effect would have taken to do in Flash?

Three words... "I love Flex"...

Have to give credit to Ely Greenfield (for his data generation function, and let's face it, for being The Man) as well as Doug McCune for his Dual Slider component (which is better than the one I did, which is why I used it here).

List Control - Disable Selection Color/Highlight

In putting together a List control this afternoon, I discovered an annoying little property about Lists... you can't "disable" the selection color that occurs on a list item when you "select" an item (click on it). For my purposes, my list needed to be selectable for dragging elements to re-order, but I didn't actually want to select a given item in the list. The order of items was all I wanted to impact the order of series rendering in a stacked column chart...

Anyway... the solution I came up with was to specify a selectionEasingFuction style which returned "0".


  


private function myEasingFunction(t,b,c,d):Number
{
return 0
}


Flex TimeEntry Component

SM_TimeEntry is a custom Flex controls that allows a user to quickly and easily enter a valid time into your applications. It supports multiple styling options, text sizing, 12 and 24 hour format, and keyboard interaction too.

View Here

Chart Offset Calculator

I got sick of doing the calculations to determine the offset values for my ColumCharts so I put together this little app to do it for me. Thought others might find it useful as well.

View Calculator >>

Thanks to Ely Greenfield (www.quietlyscheming.com) for the inspiration and calculations, and to Ben Lucyk (www.esria.com) for the suggestions on improvement (sample chart and code).

Export to Excel with Flex 2.0 and ColdFusion

Hi,

I didn't really find a suitable solution for exporting to Excel after a bit of searching through forums and blogs, so I came up with the following. I wanted to achieve seamless "click to generate a report" from Flex and have the file option dialog popup in the browser allowing me to open or save. Here's what I came up with. While I don't see any issues with the solution, I realize it's a bit of a hack, and would appreciate any CF wizards letting me know if this is going to create problems.

From Flex, I'm calling a CFC function with my data being passed back as an array. The CFC takes the data and stores it to an application variable in CF. I then send a trivial result back to Flex. On the CFC result inside Flex, I make a call to a template CFM file which uses the cfcontent tag to generate the excel file from an html table structure I build with the saved application variable data.

CFC

<cffunction name="exportToExcel" access="remote" returntype="any" output="true">
<cfargument name="data" type="array" required="yes" default="" />
<cfset session.exportData = #ArrayNew(1)#>
<cfreturn 'true'>
</cffunction>


Flex

if(event.result == 'true')
{
var request:URLRequest = new URLRequest(URLToCFTemplate);
flash.net.navigateToURL(request, "_self");
}


Brendan

Updated: Download the source files here - Download

Adobe Flex Chart Annotations

A sneak peek into the Flex charting annotation project I'm currently working on at 'a company'... the company has been fantastic about allowing me to publicly release a lot of the development and ideas we're coming up with here. Moving forward in the next few weeks, I'll hopefully be able to release the code for others to use/critique/applaud... :)

Sorry for the large download size, and the fact it's still just a movie. I created this for a presentation by my colleague Bruce Boston for an Emetrics conference he attended and presented at last week. If you skip about half-way through you'll see the annotation portion.

http://www.visualconcepts.ca/blog/attachments/CNET Charts Demo.zip

Dual Slider Component

*****
NOTE

Have updated the link below to a newer version of the DualSlider. Fixed some buggy activity when going crazy with the slider, or mousing off the screen... Thanks to Michael Schmalle and Rostislav Siryk for their suggestions on making this component better. *****


This was something that started as a feature request, and ended up being a component I thought I'd share with the rest of you.



Not much expanation needed once you run the demo here:

View Demo - Right click in demo to view source

Adds a "scrollbar" below the span between a dual-thumb slider which is draggable. When the drag action takes place, both

Set Application State From Flex to URL

Although this didn't turn out to be difficult by any means, I thought I'd throw it up anyways...

I came across the requirement to save the current "view" or "state" into the URL (much like Google Maps does with their "Link to this page" feature) for my Flex 2.0 application. I ended up throwing together a solution that works the same way as Yahoo Maps does, using the a hash in the URL string.

From my Flex app, I added a function which called an external JavaScript function to reset the URL with the values I wanted added...

App.mxml (excerpt)
----------------------------------------------
private function changeDocumentURL():void
{
var urlString:String = "var1=test1&var2=test2";
ExternalInterface.call("myJSFunction", urlString);
}


Inside my HTML wrapper for my swf, I add my JS function that's getting called.

App.html (excerpt)
----------------------------------------------
function myJSFunction(newString)
{
location.replace('#' + newString);
}


When I make the call for changeDocumentURL() it sets the string of variables in urlString to the browsers url (but DOESN'T reload the page)

Browser URL now looks like: http://www.visualconcepts.ca/App.html#var1=test1&var2=test2

Now for the flip side... looking into the script used to initiate the swf object in our HTML wrapper page App.html there is already an entry for flashvars which we can simply append to:

App.html (inside the AC_FL_RunContent() JS function)
----------------------------------------------
var preLoadFlashVars = location.hash ? location.hash.substr(1) : '';
"flashvars",'historyUrl=history.htm%3F&lconid=' + lc_id + '&' + preLoadFlashVars


Back inside App.mxml file, accessing the input vars is simply done using:

App.mxml (excerpt)
----------------------------------------------
Application.application.parameters.var1
Application.application.parameters.var2


So simple, but so cool!

CF Flex Connectivity Setup

Good God... I don't think this could have possibly been more frustrating...

I finally figured out the method behind setting up the CF-Flex Connectivity this afternoon. I'd setup the default "ColdFusion" destination out of the box, with a minor adjustment to the channel uri setting a few weeks ago. However, I decided this afternoon that I would get it setup so that I could easily copy from my development environment over to production (both have CF and the CF Connectivity installed). So I wanted to setup two different destinations, one for my local instance, and one for the production instance.... that way when I was ready to deploy to production just test locally, and move it over if all was good.

The solution ended up involving the same version of the flex-gateway-config.xml file to be placed in each location, which had destinations for both the local development box as well as production box. Before moving over to production, change the destination to the production box, test locally, and if al

Flex 2.0 Officially Released

Well, it seems that the day we've all been anticipating has finally arrived. Word is starting to leak (although we all figured it was happening about now) about pricing structure and availabilities of Flex 2.0. I've got to say, I'm pleasantly suprised as it's come in at a price point a lot lower than I expected. In addition, it looks like there is a free "Data Services Express" option which will allow a single application (on a single CPU) but unlimited users... wow!

A link to Teoti Graphix's Blog (Michael Schmalle) for a bit more info. http://www.flex2components.com/f2cblog/2006/06/27/flex2-the-time-has-come-to-push-the-button-released/

And off to Adobe for the real deal:

http://www.adobe.com/cfusion/tdrc/index.cfm?product=flex

Let me just say, I'm really looking forward to the next year of

ComoboBox Renderer/Editor for Flex 2.0

*** Added a check for null inside the renderer... was written for b3, and Barry was kind enough to let me know it was throwing a runtime error in GA... thanks Barry! ***

Another one I had done the other day, and figured I'd post now that I've got the blood pumping on this Blog!

ComboBox Renderer Example

I'll try to start posting code in this in addition to the zip files, but I'll have to implement a rich text editor into this before I start... don't really feel like hand coding my code just to display right now. Also think I'll add an upload feature for attachments too maybe...

BTW, excellent job by Ray Camden on this CF Blog solution. Aside from having to upgrade my MySQL instance, this sucker was a breeze to setup... probably took all of 10 minutes to install and configure....

Loading, modifying, writing XML locally with Flex 2.0

Hi,

Here's a solution for loading a local XML file through HTTPService, viewing/modifying through a DataGrid control, and saving the updated XML structure back to the file. This example uses the CF Flash Remoting service and RemoteObject tags to tie into a CFC which does the server-side writing of the file.

You can download a zip file of the solution here:

Download Zip

BlogCFC was created by Raymond Camden. This blog is running version 5.005.