This content has been marked as final. Show 35 replies
1) Store all the details(newsletter,Link) in the xml...
2) create the textfiled in flash (dymainc or static),
3) fetch the details from the xml and show in the text...
This is the possible way to show the dynamic newletter....
it's not possible without server-side scripting. but with server-side scripting it may be doable.
the server-side script would read the folder files (always doable), pass those names back to flash (always doable) and flash would then create the links (always doable). then comes the iffy part: how is flash supposed to display the file?
if the file is always a html page, no problem: that can be opened in another browser window. if it's a text document, no problem: that can be displayed in flash. but if it's a word document, there's a problem.
hi AScracker, thanx for the response.
Your method would require the client to edit the XML file... I dont know if he is capable of that, but i guess i can teach him. it's easy enough.
but how would i get Flash to make a link out of the info it fetches from the XML?
all the client's newsletters will be PDF format, so i'm thinking a getURL() link should work...right?
What sort of server side script would i use to get info about how many files and the file names located in a specified folder?
I'm not very good at other scripts, would this be easy enough for a newbie to do?
as for Flash to display the files.. i dont think thats important, nor is it possible, because the newsletters will be PDF format. If i can get them to open in a new browser, that would be just as good.
any scripting the server supports would work. most servers support php. does you clients?
if so, you could use php to read the file names that are in a designated folder, pass those names back to flash and then present those as links that are opened with getURL() (in as2). the user's would see the filenames (though you can use the flash string methods to make the names presented more user friendly).
I will have to check if his server support PHP.
For now, lets assume it does. How hard is it to write the php script to communicate with Flash?
my actionscript skills are moderate/almost advance. but i haven't ever done anything with communicating with outside scripts, other than XML (which was only 2 times)
My actionscripting is mainly used on design and animation, so i have verry/almost none knowledge of communication with servers, or other scripts.
I am abit familiar with strings, i think thats in my capability to learn.
it's not difficult. you should use loadvars to load the file names from your php file. you can search google for php help.
if you want to hire me to do the php and flash coding to interface send an email from my website.
if you try yourself and run into problems, post back here and i'll help free of charge.
I'll consider hiring you. but I dont know you, you might just take the money and leave me stuck... and on the other hand, i suppose you could say the same thing about me.
How much would you charge if you were to do the PHP script and Flash coding?
Also, where abouts are you from? Im in australia, the client too. I updated his newsletters 2 times, and charged him AU $50 each time. 2 days ago he send me an email asking if he can upload the newsletters himself. I havent gotten back to him yet, i've been looking for ways to do it...but im not much of a scripter.
i'm in the u.s.. but if you can't pay in u.s. dollars we can't get very far with the hiring. if you can pay in u.s. dollars, send an email.
if you have the time, you'll learn more by doing it yourself. if you want to get this done in the next day or two, hire someone.
I need to learn abit of Flash and Server-side integration. If you come across any good sites, please let me know.
i'll have to see what i can do about changing money after the weekend, banks arent open on sundays here.
Until then, i'll have a peak around and see what i can do about this php coding.
I had a read in Flash docs about loadVars() This seems pretty straight forward.
Do you know of any good sites on integration with Flash and PHP or ASP?
Here is what i have so far for the PHP script. I dont think this is how it's supposed to work tho. I read that <echo> is like trace() in Flash, to display in a browser, but im getting the whole code displayed from read() onwards..
Can you see what im doing wrong?
Is my syntax wrong?
use loadvars to call your php script and use two loadvars instances. one to send data and one to receive data (using the sendandload method). use an onLoad or onData method of your received loadvars instance to handle the data returned from your php script.
Hi kglad, here is where im at with this "reading directory" thing.
I had try at the actionscript part too... but no luck..=(
You said I should use 2 loadVars() instances...one to send and one to load. While this makes sense, do I really need to send anything?
All i want Flash to do is to "read" the contents of a folder, and turn them into links (getURL) kind of links.
Im not up to the creating links just yet...cuz i still havent gotten the php to send to Flash yet.
Here is the code, what am i missing?
I edited the php code with the one you gave me, but still no luck.
Also, when i view the php file itself, i get 3 links...
first link is the name of the last file in the directory.
second link is the name and extension of the last file in the directory.
third link is just the extension. I assume this is getting the last extension like the first two.
the first and second link obviously dont work...but the second link, with filename and extension, when i click on this it crashes Firefox.
Here is the link to the PHP file
And this is the SWF file
then check the first part of your php code. is that really what you want to do? is there ever more than one file in newsletters?
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..
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?
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.
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.
Thanx kglad, that is EXACTLY what i wanted. You're a legend.
now, it's still not sending the info to the text field in Flash. But i dont wanna bother you too much. i'll see if i can work this one out myself.
If not, i hope you dont mind, but im going to need more of your expert help
Thanx again, and wish me luck.
you're welcome. and good luck!
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..
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?
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?
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:
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 =(
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.
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.=)
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!
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).
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.