Skip to main content
November 16, 2007
Answered

automatically updating links in Flash AS2.0

  • November 16, 2007
  • 21 replies
  • 2458 views
Hi all,
I made a website for a client a while ago, and he came back now wanting the ability to update his Monthly Newsletters.

This is out of my ability to do. I need some help with creating a function which (hopefully) will read all files in a specified folder, and automatically create links in the flash movie it's self, to open each file inside the specified folder.

Is this even possible?

If not... can anyone suggest other ideas on achieving this?

thanx to all in advance for any help.
This topic has been closed for replies.
Correct answer kglad
try:

21 replies

kglad
Community Expert
Community Expert
December 7, 2007
you could have an incorrect path (when accessing files external to your swf) or you could have failed to set permissions on an executable file (if you are accessing any from your swf).
December 7, 2007
All files are in the same directory (relative path) including the folder (newsletters) which the PHP reads and sends to Flash.
I dont think this is where the problem is.

The permissions...i dont know for sure. Im using Filezilla to FTP files to the server, which gives me details of permissions on each files. I dont know how accurate these are tho.
The permissions are the same for all files, ( -rw-rw-rw- ) which im thinking means read and write permissions to the directory.

But i dont know much about server side tech, and servers in general. Are there some other permissions that are worth looking into?

The SWF file where the code is going into, is set up abit differently to the test file i was using. I originally thought this might cause the problem.
But i made copies of the files needed (from the site) to the temp directory i was using to test the PHP reading script. and it works perfectly. So the problem cant be there either.

I dont know what else to try.
kglad
Community Expert
Community Expert
December 6, 2007
you're welcome.
December 7, 2007
Hi kglad,
I have finally finished this little project, along with CSS for some rollOver effects.
But i ran into another problem, i hope you have some Idea of what could be causing it, and a remedy.

The problem is this... Up until a couple of hours ago, i have been testing this project on the servers at work, in a temp directory i made.
Once i got it to work, i moved the files to the clients directory, and now it's not working anymore.
Im getting a "undefined" message in the textBox.

The same servers, only a different directory. and it stops working.
Any Idea of what could be happening here?

Sorry for the hassles!
December 6, 2007
Hi kglad
sorry i didnt reply for afew days. I hope you didnt think i was ungrateful

Thanx for all your help. i'll start looking into CSS again. I gave up on that when i was introduced to Flash. =)
Guess if i had known that I can integrate multiple languages with Flash, i would have kept at it.

Thanx again for all your help. You've been great.=)
kglad
Community Expert
Community Expert
December 1, 2007
the flash help files won't have anything about what you can accomplish with stylesheets. flash supports standard css which does allow for rollover effects (or hover effects). check css for proper coding.
November 30, 2007
ahh, ok, i see that html in Flash is quite limited. but all the main tags are there, i suppose.
Thanx for that list.


I had a quick read through styleSheet in the help docs, its pretty straight foreward. but i dont see anything about changing the style of a text that is rolled over. Only a textField as a whole.

So i guess the only thing i can do here, is to try and create a separate textField for each link that is sent to flash. Then use mouse events to add or remove styles to the rolled over field.

Is this right? or am i missing something?
im not all with it at the moment, too damn tired =(
kglad
Community Expert
Community Expert
November 30, 2007
in the flash help files under textfield, check the styleSheet property and sample code.

flash has a very limited set of html tags that it can understand. here's the list:

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001040.html
kglad
Community Expert
Community Expert
November 29, 2007
your textfield should be html enabled and you should assign its htmlText property to have your links function correctly. you're doing that correctly and you shouldn't change that.

you can assign rollover characteristics by using css and assigning a styleSheet to your textfield.

i'm not sure why you want to manipulate the strings in your php file or in flash. what are you trying to accomplish?
November 30, 2007
Well, see when Flash displays the text, it displays it as the file name plus extension.
I was thinking of removing the extension.
but it's not that important i guess.

Also, how can i add CSS to Flash??
I had no idea that was even possible.

Because i set that TextField to html. Does that mean "anything html" i type in there, will be displayed like in a browser?
What limitations are there?
Could I create, say, a HTML Form, and it will work like a normal browser?
kglad
Community Expert
Community Expert
November 28, 2007
you're welcome. and good luck!
November 29, 2007
Hi kglad,

I got it all to work, but now i need some more of your wisdom if thats ok. =)

Here is the SWF
The only way i knew how to get flash not to display the whole link tag ( <a href="bla blah"/> ) was to use htmlText() for the text box.
But now im affraid i dont know if its possible to animate the text in any way?

I was wondering if there is another way of getting the links to appear in text boxes, without showing the whole <a href> tag? I want to have abit more control over the links, like to have a rollOver and rollOut action.

Is this too much too hard?

Also, you said something about using strings to change the link name im getting from PHP. Is that part hard to do?

here is the whole code as is now..
kglad
Community Expert
Community Expert
November 26, 2007
if there's more than one file, you have a problem: $file is being re-initialized on each loop.

if you want an array of the pdf files, either change the array name used to store your explode results or change the name of the array of pdf files.
November 27, 2007
Im afraid i dont know what you mean.
you want me to just change $file to another name.. egg.. $nLetter ?

I dont know anything about PHP. this code is from reading abit on php.net and simply copying code.
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 27, 2007
try:

November 26, 2007
ok... from your post, im getting the feeling that my complaint about the 3 different links im getting, is actually what the code does...and is supposed to happen..

so maybe im doing this thing wrong??

the ONLY links i want, is the links to the actual PDF.
i thought the php code gets the directory, then adds the file name, and the file extension after that... sends all of it as a string to flash.
so what i SHOULD be getting is..
newsletters/newsletter_1.pdf

if this code doesnt do that, then im doing this wrong. =(

And to answer your question...YES, there will be a new file added almost every month.
I want the php script to check the newsletters folder for all files with the extension PDF. Then take the names of those files, and send those names to Flash. Flash then makes a link (getURL) linking straight to each PDF files.

Does this php script not do that?