LoadVariables Server.MapPath?

Posted on 2004-10-07
Last Modified: 2012-06-21
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,
Question by:FalconUK
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Author Comment

ID: 12249166
Can anyone help?


Accepted Solution

benlowry earned 250 total points
ID: 12275742
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)
Set f=Nothing
Set fs=Nothing


Author Comment

ID: 12276147
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.
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.


Expert Comment

ID: 12283562
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.

Author Comment

ID: 12287477
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?

Expert Comment

ID: 12289502

There are 3 files in play:

your flash page

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.


Author Comment

ID: 12296222
Awesome, that works a treat.

A nice neat solution, thanks.


Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question