PDA

View Full Version : calling a PDF file in Flash


AudryLucy
02-17-2003, 03:29 PM
I'm creating CD for a client of ours, using Flash MX... He has 7 brouchures in PDF's that he wants to call from a sub page in this CD. I have read the "exec" TechNote by Macromedia and have learned that an "exec" command will not do the trick, since "exec" is not capable of opening a specific file with an application. So, I am considering Jstart by Flashjester which is recommended in this TechNote.

Has anyone used this program before? Is it worth the 50 bucks? I am using a Mac G4... is this program compatible with the Mac Operating systems? I have visited their site and contacted their support department to find out. They have not written me back as of yet.

Is there a program that works like Jstart that will work on Mac OS, just incase Jstart won't?

Thanks for the advice,

Jenny

TheLostMarble
02-17-2003, 03:45 PM
have you tried just opening it like you would any other URL - using getURL("myfile.pdf", "_blank");

It would open in IE (or the user's default browser).

DiDi
02-17-2003, 03:56 PM
As far as I know JStart (and all others 3rd party tools/Flash projector enhancers) are PC ONLY... :(

If opening PDF files is all you need to do, than you won't need a comercial tool. You can achive it with applescript on Mac, and there are free tools for PC/Win systems for opening files. Check Resources section here:

Flash Projectors and Crossplatform CD Burning FAQ (http://usuarios.lycos.es/didinomade/ProjectorsBurningFAQ.htm) (be patient, it's free server and it may be down sometimes :()

Hope this helps ...

DD

PS: Among comercial tools, I would recommend SWF Studio and Flash Studio Pro over JStart, for they have more options and great support as I hear... :)

chicoP
02-17-2003, 08:04 PM
All yo need to use is the geturl comand. make sure that the path is correct.

AS well you will need the product from this link. because browsers will not pop up over the cd rom project unless you use a third party tool. and it will not work with MAC. but this tool is great, I use it

http://freemx.arsware.org/

tmhhmt
02-18-2003, 07:28 PM
i created a cd recently for a client with several pdfs. i spent DAYS trying to find something more elegant than 'get url' that would do something other than open the pdfs in a browser window but never found anything --- i have both a mac and pc so was willing to use anything on either platform but nothing worked properly or was worth the download time.

anyway -- the client didn't mind that the pdfs opened in the browser window because there was also a url/e-mail link on the same 'page' of the presentation so it seemed as though it were all done on purpose.

btw -- didn't need any third party software for opening the pdfs using 'get url' on a mac. creating the cd for mac was easy & worked perfectly -- on the pc had to be careful where i put the pdfs for the projector links to work but can't remember the details.

good luck.

chicoP
02-18-2003, 10:48 PM
Free mx will open the pdfs in acrobat. Go check it out and read the readme file. you will see how it works,

the Freemx is important, because if the person opens the CD rom and they already have a browser window open, the browser will never show up above the cd rom, the user will keep clicking, and then when they shut down the cd rom there will be a bunch of browser windows open on the desk top

avatar
02-19-2003, 07:06 AM
Hi AudryLucy,

Sometimes clients don't even mind, that calling the pdf opens a browser window.

If you or your client wants a more neat sollution I would check the link that DiDi posted here. It contains al the info you need.

nicknametaken
05-12-2003, 02:02 PM
Is there any freemx software for mac>? Anybody know how to open pdf files in flash mx for mac. If i use the geturl command it open the browser but doesn't open the pdf. I want to be able to do this in a swf and not projector

AudryLucy
05-12-2003, 02:55 PM
Originally posted by nicknametaken
Is there any freemx software for mac>? Anybody know how to open pdf files in flash mx for mac. If i use the geturl command it open the browser but doesn't open the pdf. I want to be able to do this in a swf and not projector

Hi,

I don't know of any freemx software for Macs...Everything I came across, when I was searching for software, was for PCs. When I emailed the companies they always said that "a Mac version was in the near future"...whatever. :rolleyes:

Because of this lack of Mac Software....I used a work around that you may be interested in.... I including a "link" to each PDF in an external text file, using HTML tags...These links will pull up the PDF files in a browser window (If you don't mind using a browser this is a great solution). You may have already tried this, but incase you haven't, here is an example of the text file that my dynamic text box draws from...I included a link to adobe.com so that the user could download The Adobe Acrobat Reader, if they did not have it already.
(**make sure that your PDF file is in the same folder as your swf ...its a common oversight) Hope this helps :)

Var1=<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13">If you do not have a copy of the Adobe Acrobat Reader, you may download a free version from this web site:</FONT></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="http://www.adobe.com/"> www.adobe.com</A></B></P><BR>

<P ALIGN="CENTER"><B><FONT COLOR="#FFFFFF" SIZE="15">Product Brochures List</B></FONT></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="gtbro.pdf" target="_blank">454GT Brochure</FONT></A></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="mini.pdf" target="_blank">ABB 489 Miniature Circuit Breakers Brochure</FONT></A></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="medvolt.pdf" target="_blank">ABB Medium Voltage Soft Start</FONT></A></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="pwr.pdf" target="_blank">Clean Power Brochure</FONT></A></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="gt3000.pdf" target="_blank">GT3000 Brochure</FONT></A></P><BR>

<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="harm.pdf" target="_blank">Harmonic Filter Pamphlet</FONT></A></P><BR>


<P ALIGN="CENTER"><FONT COLOR="#CCFFFF" SIZE="13"><A HREF="perfect.pdf" target="_blank">Perfect Harmony Brochure</FONT></A></P><BR>

nicknametaken
05-12-2003, 03:03 PM
This sounds like a good idea.. But I don't think I understand what you mean when you say you link to a pdf in an external text file. Where do you do this? I see the code that I can put into dreamweaver...but In flash what are the commands that I should use to launch this? Sorry if I am slow...I just am not understanding the execution you use.

AudryLucy
05-12-2003, 03:15 PM
Originally posted by nicknametaken
This sounds like a good idea.. But I don't think I understand what you mean when you say you link to a pdf in an external text file. Where do you do this? I see the code that I can put into dreamweaver...but In flash what are the commands that I should use to launch this? Sorry if I am slow...I just am not understanding the execution you use.

No problem. I need to know your level of experience so that I can explain a little better...Have you used dynamic text boxes before? The HTML tags are not used in Dream Weaver...You would use something like BBEdit or MicrosoftWord (and save the file as a text file) to create a list of PDF files. The HTML is used in this text file, to create links that Flash Recognizes in a dynamic text box within the swf...
Let me know if you have used Dynamic text, so I can explain the proceedure if you haven't used it before...I was guessing you had, so I didn't go into much detail in my last post. I would be happy to help you if you haven't.

nicknametaken
05-12-2003, 03:19 PM
I have not used dynamic text boxes before. I have been using flash for a couple years but am still learning the action script, as I usually use it more for animation than anything else. So any help and advice you could give me but be amazing!!
Cheers!

AudryLucy
05-12-2003, 03:49 PM
Originally posted by nicknametaken
I have not used dynamic text boxes before. I have been using flash for a couple years but am still learning the action script, as I usually use it more for animation than anything else. So any help and advice you could give me but be amazing!!
Cheers!


Hi,

I'm working on some instructions for you...I'll be maybe another 20-25 min.

Jenny


:)

nicknametaken
05-12-2003, 03:52 PM
Right on!! Thanks so much Jenny!
peace
b

AudryLucy
05-12-2003, 04:53 PM
[QUOTE]Originally posted by AudryLucy
[B]Hi,

Ok, lets see here...


I'll start with the text file first...Do you have BBedit, Microsoftword or something similar? I'll give you some instructions that aren't program specific...

1. Start by creating a new text file in a software program used for creating Text files. Flash will only recognize a text file with the extension .txt (so if you can, find a program that will allow you to save your document as a .txt

2. Always start a Text file with: Var1=

the number "one" can be whatever you want, but I always start with "one", just incase I have more than one dynamic text box in my swf...You don't want to confuse Flash... Using this naming scheme helps to stay organized and sane.

3. You don't have to format your text file, but it always looks nicer when you do...so, use HTML tags to make things neat (a GREAT book for learning which Tags will work in Flash is Colin Moock's "ActionScript: The Difinitive Guide" he has a new book now for FlashMx)

4. IF you don't know HTML, I'll give you "the play by play" (I'm not fluent in HTML... I just know what works in Flash MX, so be nice to me HTML GURUS)

5. ...Start with <P> to begin your paragraph...If you want to specify a font color or font size...then follow the <P> with:
<FONT COLOR="#FFFFFF" SIZE="15"> type your text after this and end the paragraph or whatever it is your typing, with: </FONT></P> and follow it up with: <BR> if you want a page break.

6. On to the PDF link... Start a new paragraph with <P>
and tell it to be a specific font size or color (don't forget the quotation marks around the color...if you make any mistake at any point of the text file, it may not work in the swf )<FONT COLOR="#FFFFFF" SIZE"12"> and then type thie following <A HREF="mypdf.pdf" target="_blank">click here for a PDF file
</FONT></A></P><BR>

And There you go...Save the text file as "pdf.txt" (just for the purpose of this tutorial, you'll see this file name below in the actionScript...just a note, make sure you remember the exact name of the text file, it won't work if you miss type it or use the wrong text file name) Save this file, you just created, in the same folder as your SWF and FLA file.

Next, Il'll explain the Dynamic text box within the swf.


If you buy The book I suggested (ActionScript The Definative Guide...this part of the tutorial is on page 381).

Creating a Dynamic Text Field:

Create a new file in flash:

1. Select the Text tool.

2. Click and drag a rectangle on the Stage in FlashMX. The outline that you create will define the size of the new text field. specify a font in the properties box, if you do not intend to do so in the text file.

3. If you are using Flash MX...use the properties box and tell the text field to be a "dynamic text field". In the properties box, also tell it to be "multilined". To the right of the menu where you selected "multilined" you'll see three icons...one is an "Ab" one is "<>" and the last one is an icon for "show boarder"...click the "<>" icon.

This will tell the dynamic text to recoginze your HTML tags in the text file, if you don't click this icon, your text file will not work. Now, at the bottom right of the properties box you'll see "Var:"

We named our Var (in the text file)..."Var1" so, type it just as you typed it in the text file, in the the properities pannel...... Var1

Give the dynamic text box an instance name like:
"pdfs" (without the quote marks)
this is so we can be tell the external text, in ActionScript, where to appear in the swf.

4. Go to the "Window" in the menu bar at the top of your screen, and select the "Components". The Components pannel will pop up....Open that pannel and drag the scroll bar from the pannel onto the stage. Drop the scroll bar on the left, top cornner of your dynamic text box...It should stick to it like a magnet and adjust itself to the size of your text box.

Now, highlight the scrollbar (by clicking on in it) and type the instance name of your dynamic text box in the scrollbar properties box...(it will pop up when you click on the scrollbar). This will tell the scrollbar to attached itself to and control that particular text box...if you forget to do this, your text will not scroll.

5. Now for the actionScript.....
click the KEYFRAME that your text box exists in. Type this script:

loadVarsText = new LoadVars();
loadVarsText.load("pdf.txt");
loadVarsText.onLoad = function(success) {
if (success) {
_root.pdfs.htmlText = this.Var1;
} else {
trace("not loaded");
}
};
stop();





6. _root. pdf.htmlText=this.Var1;
This line of script is the target....you may alter the first part of the script if you have a movie clip that the dynamic text file exists in. If the dynamic text exists on the root level...then no problem, it will find its target and it will work.
Make sure your text file, PDFs and the swf are in the same folder...and
test your movie...
Your when you click on the link in the text box, the browser will pull up the PDF...You must have the Acrobat Reader on you machine, in order to see the PDF.

If it doesn't work, here some trouble shooting tips:

1. Check the name of your text file within your actionScript...make sure its spelled the same way in the actionScript.

2. Check the Var, make sure you have the correct Var name within the actionScript and that you have defined the Var in the properties of the dynamic text box.

3. Make sure your swf, PDF and the text file exist in the same folder.
make sure the name of your pdf file, is correctly spelled in you text file.

4. Check your HTML tags in the text file. Sometimes the tiniest mistake will cause the swf not to display the dynamic text...I can't count the number of times a stupid mistake like this has kept me busy searching for the mistake in a text file with tags....its sometimes difficult to find...If you can, have a programmer look over it with you...sometimes they see things right off the bat, that we may over look. A fresh set of eyes is always helpful.

5. Make sure your scrollbar is attached to the text field...the text field's instance name must be defined in the scrollbar properties.

6. Make sure the "<>" icon has been selected in the dynamic text field's properties.

I think that covers everything...You might want to print this...Its a novel, I know...but its pretty detailed. The book I suggested is GREAT. You can order it online just about anywhere...

I hope this helps you. If there is something you need for me to explain better, let me know. I'll try to help....I'm usually the one posting questions on this forum...its nice to finally be able to help someone else rather than being the one always asking!

Laters, Jenny;)

nicknametaken
05-12-2003, 06:13 PM
Jenny,
First of all....Thank you sooooo much for all of your help and kindness. It amazes me, how so many cool people take the time to help others in need. You are truely a great soul.
So I did everything you said to do and launched my swf file and it called the txt file and everything seemed great! But then the same **** happened again. It launched my browser but it doesn't load the pdf file! uGGgh.

It is so weird. I had this problem when I was simply using the geturl command. I could get it to load a html doc in my folder but not the pdf doc. It looks like it is loading. At the bottom of the browser I can see it searching and loading it ...but It doesn't load....It just sits on my default home page.

Just to be clear...I don't have to export this movie as a projector right? It's a swf?

I will continue to try and troubleshoot this...but if you can think of anything off the top of your head...otherwise...THANKS SO MUCH.

I will have to check out your website and company when I finish with this.
b

AudryLucy
05-12-2003, 06:40 PM
Originally posted by nicknametaken
Jenny,
First of all....Thank you sooooo much for all of your help and kindness. It amazes me, how so many cool people take the time to help others in need. You are truely a great soul.
So I did everything you said to do and launched my swf file and it called the txt file and everything seemed great! But then the same **** happened again. It launched my browser but it doesn't load the pdf file! uGGgh.

It is so weird. I had this problem when I was simply using the geturl command. I could get it to load a html doc in my folder but not the pdf doc. It looks like it is loading. At the bottom of the browser I can see it searching and loading it ...but It doesn't load....It just sits on my default home page.

Just to be clear...I don't have to export this movie as a projector right? It's a swf?

I will continue to try and troubleshoot this...but if you can think of anything off the top of your head...otherwise...THANKS SO MUCH.

I will have to check out your website and company when I finish with this.



b










b,

If you can, try it on a P.C. I pulled up the file that I was working on, when I started the first thread of this post months ago... and tried it on my Mac, and it doesn't work on my machine either...I forgot the Mac / PC issues of the solution. In the end, it didn't matter because our client uses PCs exclusively and this was not an issue that they had with our CD. Acrobat, on a PC, opens up in a browser window...it doesn't work on a Mac.

Try it on a PC if you can...and see what happens. Sorry, I should have remembered to tell you about that...its been so long since that project, I didn't remember all the particulars. I don't know the details of your project, but if it happens to be for a sales CD or something similar, the majority of computer owners (outside of the design world) are PC users :( and the fact that your CD only works on PCs, obviously, will not matter to them. I'm sorry about that. It totally slipped my mind :( . Let me know if you are able to test it on a P.C. and if you have any luck.


Jenny


p.s. if you visit our site, please don't judge it too harshly, it hasn't been updated regularly...its three years old and we are in the process of redesigning it as a completely dynamic, Flash web site...It should be live in another month or so (I've got client projects to finish first and have been working on ours at home). The old one is ok I guess. It just doesn't "sing" as they say.

nicknametaken
05-12-2003, 06:52 PM
I will try it on a pc but I do need it to be cross platform...becuase it is a medical cdrom and God knows what os they will be working on. But thanks again for all of your help...the info and script you gave me will come in handy on another project for sure!!! And I will pick up that book you mentioned too!
Reeespect/
b

AudryLucy
05-12-2003, 06:54 PM
Originally posted by nicknametaken
I will try it on a pc but I do need it to be cross platform...becuase it is a medical cdrom and God knows what os they will be working on. But thanks again for all of your help...the info and script you gave me will come in handy on another project for sure!!! And I will pick up that book you mentioned too!
Reeespect/
b
No problem. You'll do great. Study that book...it really improves skill.
Later, Jenny

durie
11-29-2005, 05:21 AM
yo Audry Lucy

I have been using recently been using fscommands to open all sorts of files like .mov adn flash.exe files....

if you would like the code let me know, i just don;t have acess to it atm...

all it does is you put the fscommand on a button and it runs the .bat file and the .bat file opens the document that you want.
I do use a pc (heap of junk) but I have had the project run on my brothers mac.

later duire

RubyDo
12-30-2006, 01:43 PM
Thought to tell you about the last thing I usedů

http://www.adobe.com/products/flashpaper/

The flash paper appears as plugin in acrobat & word so that it transforms the pdf/doc into swf searchable & working perfectly.

Using the action script code described below it can be loaded into a movie clip & yes it work properly & valid on windows & macintosh
http://www.adobe.com/devnet/flashpaper/articles/import_flpaper2_02.html (http://www.adobe.com/devnet/flashpaper/articles/import_flpaper2_02.html)