-
dynamic links
I want to have a link that is generated if a pdf file is in a particular directory. Something like:
if (file.pdf is present in ../pdf/) then
generate link in the swf file that will open the pdf in a new window
else
generate text that says 'no pdf file present'.
Is this possible? And can anyone give me any advice on how to go about this?
thanks!
-
you will need some server side scripting for this
(PHP, ASP, JSP whatever). if you're not taken aback by that, check out the filesystem object for ASP or the file_exists method for PHP.
-
You won't be able to do it easily in any type of coding.
-
you could say:
Code:
on (release) {
getURL("path/file.pdf");
}
you can use that script to open the file!
but not to ID it....
-
nah, That would open up a browser...hmm...try this: (put this into the frame's actions, and have a text field named 'results')
Code:
pdf_url = "file.pdf";
pdf_loadvars = new LoadVars();
pdf_loadvars.onLoad = function(success){
if(success){
_root.results = "You have the .pdf file, great job";
}
_root.results = "No .pdf file, sorry!";
}
}
pdf_loadvars.load(pdf_url);
Excuse my horrible spelling....you can blame my English teacher for that!
-
If I did it this way I think the pdf file would have to actually load before results would show up? It's a big file.
Originally Posted by cobrasniper555
nah, That would open up a browser...hmm...try this: (put this into the frame's actions, and have a text field named 'results')
Code:
pdf_url = "file.pdf";
pdf_loadvars = new LoadVars();
pdf_loadvars.onLoad = function(success){
if(success){
_root.results = "You have the .pdf file, great job";
}
_root.results = "No .pdf file, sorry!";
}
}
pdf_loadvars.load(pdf_url);
-
don't worry, just try it. it really works. the function is called onLoad. tiny glitch in cobra's script: he forgot the 'else'. the snippet should read:
Code:
pdf_url = "file.pdf";
pdf_loadvars = new LoadVars();
pdf_loadvars.onLoad = function(success){
if(success){
_root.results = "You have the .pdf file, great job";
}else{
_root.results = "No .pdf file, sorry!";
}
}
pdf_loadvars.load(pdf_url);
-
This works when the pdf file has text in it but not when the pdf is just made up of images.
It also works with a .txt file when there is text on the file but doesn't when the .txt file is a blank file.
Also, the pdf file has to load before the text will show up (I tested it with download simulation) which will make the site too slow because there are several files that are large.
It looks like it may have to be done with some server scripting or by passing the file name as a variable instead of checking for its existance.
Thanks for all your help and if you have any more ideas please let me know.
thanks.
-
sorry, i wish i could help some more, but im out of ideas, ill think up on it!
Excuse my horrible spelling....you can blame my English teacher for that!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|