I've been doing this very thing right at the moment, and once you get your
head into actionscripting its actually quite easy.
set up your CFC to return a query...
<cffunction name="getCategories" access="remote" returntype="query">
<cfquery name="categories" datasource="test" dbtype="ODBC">
SELECT group_id, group_name
FROM groups
WHERE active = 1
</cfquery>
<cfreturn categories>
</cffunction>
then in your flash MX movie, ensure you have flash remoting properly setup
and include the following in the first frame:
#include "NetServices.as"
if (gatewayConnection == null) {
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/gatewa
y");
gatewayConnection = NetServices.createGatewayConnection();
CFMService = gatewayConnection.getService("componentdir.componentname",
this);
}
you may need to change some of the above....
then call your CFC function:
CFMService.getCategories();
and build a _Return function to handle the incoming data (in it I reference
an fTree component instance on the stage named 'catTree'):
function getCategories_Result(result) {
_root.catTree.setEnabled(true);
_root.treeRoot = new FtreeNode("Categories");
_root.treeRoot.setDataProvider(result, "group_name", "group_id");
_root.catTree.setRootNode(_root.treeRoot);
//_root.catTree.setDataProvider(result);
_root.catTree.setAutoHideScrollBar(true);
_root.catTree.setSize(300,400);
_root.treeRoot.setIsOpen(true);
_root.catTree.refresh();
}
there we go! Flash displays all my categories in the tree component (and you
can add a clickHandler to handle what happens when a node is selected). You
can change the appearance of the whole thing (although I'm not going into
that here) and you can add child nodes to other nodes etc. Look at the
reference window for the fTree component and you'll see all its methods
available to you.
I'm still learning myself, so the above may be stylistically yucky, but it
the idea is right.
> -----Original Message-----
> From: Mike Tangorre [mailto:[EMAIL PROTECTED]]
> Sent: 19 July 2002 00:03
> To: CF-Talk
> Subject: Re: CF MX / FLASH MX - Tree Menu
>
>
> Thanks Ben.
>
> I think I will go with the Flash approach now.. no better
> time to get up to
> speed.. I'll deal with the elarning curve. :-)
>
> Flashkit.com has been useful in the past, are there any other
> sites you can
> think of that might discuss the concepts I will need to grasp
> to build the
> menu?
>
> Data Binding and Data Glue.. any other concepts/ideas/or approaches?
>
> I appreciate the help.
>
> Mike
>
>
> ----- Original Message -----
> From: "Ben Johnson" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Thursday, July 18, 2002 6:41 PM
> Subject: RE: CF MX / FLASH MX - Tree Menu
>
>
> > > Anyways, does this sound like a good Flash MX project? I
> > > have never used Flash to interact with dynmaic data so any tips,
> > > links, advice, or thoughts would be much appreciated.
> >
> > Well, the answer is two fold. One hand, yes, this is
> actually a great
> Flash
> > MX project. On the other hand, if you haven't used Flash MX before,
> there's
> > going to be quite a learning curve to get to the point
> where you can pull
> > dynamic data from the server and populate a Tree component with a
> recursive
> > function.
> >
> > I have an article that will/may/(who knows) be on FlashKit
> that covers
> Data
> > Binding using the DataGlue class. That would be a good
> start. It doesn't
> > cover adding tree data, though, because that's a whole
> other can of worms.
> >
> > If you don't have to worry about browser compatibility, you
> can go with an
> > IE 5.0+ solution which involves some heavy javascripting &
> XML. That also
> > has a pretty steep learning curve, but it's really a nice
> interface. It's
> > used as the left hand navigation on Microsoft's MSDN library:
> >
> > http://msdn.microsoft.com/library
> >
> >
> >
> >
> > Ben Johnson
> >
> >
>
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists