tags:

views:

438

answers:

3

Hi,

I have a tree object which is bound to an XML list. The XML list contains a name for the type of code I have written (e.g. IM client) and also a path to the file where I have some code.

When the user selects a node's child in the tree, I want to load the file from the path of the selected node's child and then show the text in a text box.

How can I go about this? Is it possible without a server side language?

Thanks

A: 

Flash is really restrictive on fetching files from the user's computer. To get around this, I have an application running on the user's computer that acts as the middle man between my Flex app and the files on the computer.

Edit: If you want to load files that you have on the server, then you would need something on the server side to relay that information back to your flex app. Flash runs in the browser, on the client-side, therefore it really doesn't have knowledge of where it actually lives.

Though, since you have those file paths, could you just put a relative path from the root of your server on the end of your domain name to find the files?

http://domain.com/path/file.jpg

DyreSchlock
All the relevant files are sitting on the server (e.g. code samples). I don't need to get anything from the user's PC.
dotnetdev
Ohh.. you want to load files that are on the server.
DyreSchlock
A: 

All the relevant files are sitting on the server (e.g. code samples). I don't need to get anything from the user's PC.

You need to use HTTPService or a similar object to make a call to your server and when loading is complete you can display it.

dirkgently
A: 

It's hard to give a solution without knowing the XML data structure. However, a good place to start is to listen to the tree's change event. You can then get the selectedItem from the tree and that should be the XML node which was clicked.

You say you should have a path to the file at this point, so it's just a matter of loading the file with a request using the URLLoader class.

Osman