Solved

LoadVariables Server.MapPath?

Posted on 2004-10-07
7
310 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
  • 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now