[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

LoadVariables Server.MapPath?

Good morning everyone,

I've got a small flash movie for displaying my news items which reads the items out of a text file.
I'm currently using the following:

LoadVariables("news/news.txt", _root.mcNewsTicker);

But I want to move my news.txt file off of the public area and back into another directory that isn't public.
Can you use something like ASP's Server.MapPath to return the real path to my news.txt file rather than using the URL?

Many thanks,
Chris.
0
FalconUK
Asked:
FalconUK
  • 4
  • 3
1 Solution
 
FalconUKAuthor Commented:
Can anyone help?

Chris.
0
 
benlowryCommented:
Create an asp page that can access the non-public news folder, open the textfile and return the contents to flash.

Your asp file would look something like this:

Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("../privatefolder/news.txt"), 1)
Response.Write(f.ReadAll)
Set f=Nothing
Set fs=Nothing

Regards,
Ben
0
 
FalconUKAuthor Commented:
My flash movie wants to have access to the text file, so that it can read the values out its self.

Is there no way of using the Server.Map path function in the Flash LoadVariables function?
Do you need to have the text file in a public folder?

The only reason I want to do this is my ISP doesn't allow me to have write permissions on public folders, and so to have an easily editable news ticker file, it needs to be in a private folder.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
benlowryCommented:
If flash is going to access the file directly than it needs to be in a public folder.  Flash can only access the root of your web site and nothing outside of it.

You could do what I mentioned above and use an asp page to get the text file from a private folder and read it to Flash .. so you'd LoadVariable the asp page.
0
 
FalconUKAuthor Commented:
Do you mean using the ASP method you described to build a dynamic web page from my text file in the private folder, then passing the url of this asp page to the loadvaribales function?
0
 
benlowryCommented:
Okay,

There are 3 files in play:

your flash page
getnews.asp
news.txt

Your flash page is in a location accessible from the www.
getnews.asp is in a location accessible from the www.

Flash does a loadVariable on getnews.asp.

getnews.asp opens up news.txt as described earlier.  news.txt is located in a folder that isn't accessible from the www but IS accessible by getnews.asp.  getnews.asp then returns news.txt's content to the flash movie using the method described earlier.

0
 
FalconUKAuthor Commented:
Awesome, that works a treat.

A nice neat solution, thanks.

Chris.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now