Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


LoadVariables Server.MapPath?

Posted on 2004-10-07
Medium Priority
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 1000 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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


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 October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

636 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