Solved

LoadVariables Server.MapPath?

Posted on 2004-10-07
7
351 Views
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,
Chris.
0
Comment
Question by:FalconUK
[X]
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
7 Comments
 

Author Comment

by:FalconUK
ID: 12249166
Can anyone help?

Chris.
0
 
LVL 2

Accepted Solution

by:
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)
Response.Write(f.ReadAll)
Set f=Nothing
Set fs=Nothing

Regards,
Ben
0
 

Author Comment

by:FalconUK
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.
0
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.

 
LVL 2

Expert Comment

by:benlowry
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.
0
 

Author Comment

by:FalconUK
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?
0
 
LVL 2

Expert Comment

by:benlowry
ID: 12289502
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
 

Author Comment

by:FalconUK
ID: 12296222
Awesome, that works a treat.

A nice neat solution, thanks.

Chris.
0

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