PDA

View Full Version : Button launch troubles


squirrelnuts
08-03-2006, 01:13 AM
Hey there. I am trying to make a 3 button menu run off a cd. one button will launch a pdf, one will open a website, and one will open an executable. The problem is i cant seem to get any button to work.

Button 1

on (release) {
fscommand ("exec", "open_pdf.bat");
}


Button 2

on(release) {
getURL("http://www.example.com", "_blank");
}


Button 3

on (release) {
fscommand ("exec", "AdbeRdr708.exe");
}


Both the .bat and.exe are in the fscommand folder. What am i doing wrong?
By the way is there any program that will allow me to export this with out appearing in a window when the .swf is run?

Thanks!

Navarone
08-03-2006, 01:45 PM
I don't think you can open a batch file with the fscommand exec method. But I could be wrong. Your other fscommand exec function is trying to open the Adobe Acrobat Reader. Unless you have the Adobe Reader on the cd rom, you will need to specify the path to the reader. (C:\Program Files\Adobe\Acrobat 6.0\Reader\AdbeRdr708.exe) Somewhere on the Northcode website http://www.northcode.com/index.php they have a free utility for opening pdfs from a cd-rom.


The getURL will only work if you have internet access. Assuming that you do, you would need a valid URL.

All that being said, what exactly do you mean when you say you cant get them to work?:)

squirrelnuts
08-03-2006, 03:21 PM
If you download this file http://www.actionscript.org/tutorials/beginner/exec_docs/2005_working_example.zip
it will work. It demonstrates how you can use a batch file to open files with the fscommand.

I want to open a pdf. So i modified the batch file to open one.
I with my open_pdf.bat file on the fscommand folder i have the following code:
start ../handbook.pdf

It works out side of the flash file. If executed from folder it will open up said pdf.
As long as the system has acrobat installed on the machine the file will open, because the extentsion should be a registered extension with the OS.

For the getURL functions i have a valid website. As well as insternet access.

The executable resides in the fscommand folder on the cd. This file will launch the acrobat installer when button is clicked.

My problem is that when the flash is compiled, or even when i test the flash in publish preview the buttons dont work. When i click the buttons they do nothing. I haven't seen the getURL or fscommand work once.

Navarone
08-03-2006, 03:43 PM
Try using the example to open a pdf. Set it up just like your own flash file is and see if it works (maybe you tried this already) It's possible the tutorial may only work for jpg images. ;)

There is nothing wrong with the getURL code with your website address. I assume you have internet access on your pc/mac?

squirrelnuts
08-03-2006, 03:59 PM
I already modified the example to open a pdf, and it works out side of flash. do i need to add code the buttons in order for these things to work?

Navarone
08-03-2006, 04:12 PM
Ok, it would appear that this only works outside of flash. So no amount of xtra code will make it work from within the flash environment. I assume you renamed the batch file itself?

The reason your Acrobat link is not working, is because the acrobat exe is not in the fscommand folder. From the flash help files:
if you use the fscommand exec command to call an application, the application must reside in a subdirectory named fscommand.

squirrelnuts
08-03-2006, 04:14 PM
the acrobat file is in the fscommand folder.

Navarone
08-03-2006, 04:20 PM
ok, thats good but the fscommand button action will not work from within the flash environment. All I can suggest at this point is to double check all your spelling in flash and in the batch file. If the example file worked for you and your flash file does not, then something you did isn't correct.

I don't see any problems with your code.:)

squirrelnuts
08-03-2006, 04:27 PM
if the fscommand doesnt work then what function should i replace it with?

Navarone
08-03-2006, 04:41 PM
Try the following to open a pdf:

getURL("pdfs/something.pdf", "_blank");



This will open a pdf in a browser window. This will also work even if you are running from a CD

There maybe some third party programs that work with flsh that will let you open pdfs or exe's with the parent program, but I don't know of any.

fscommand will work, it just won't work when you try testing your movie from with in flash.

squirrelnuts
08-03-2006, 04:53 PM
ok, a new development. i go the getURL and the insatll button to work. but only by discovering a little area under the button that make a pointy findger/hand thing appear. why does it only appear in a small area under the button?

Navarone
08-03-2006, 06:25 PM
Ah..., this has to do with how you made your buttons. Did you use the button symbol? Did you put your text inside the button or outside on top of it? If you put it on the inside of the button, make sure your text is above all of your hit states.

squirrelnuts
08-03-2006, 06:33 PM
i put the text on top. i did make them button sysmbols though. how do i get the text into the button so that you can click any where on the button?

Navarone
08-03-2006, 06:37 PM
Just open up your button symbol and add a new layer and in the first blank key frame type in your text with the text tool and make sure the text frames go all the way across the up/down/and hit states. That should do it!

squirrelnuts
08-03-2006, 07:15 PM
what is a hit state?

Navarone
08-03-2006, 07:41 PM
Looks like your pretty new to flash?:) Go to your flash help files, and click on the little search button (magnifing glass icon), and type in 'Creating buttons'. It will tell you all about buttons. Or go the

Basically you have an Up, Over, Down and Hit. These are referred to as "states" in the button symbol. So for example, if you want to have the button change background color when you mouseOver, you would change the color of the shape or graphic in the Over keyframe. To make the button click able you put a shape or graphic in the Hit frame. Got it? :D

squirrelnuts
08-03-2006, 07:43 PM
yea i am new to falsh. Ill give it a shot. Thanks for all your help.

squirrelnuts
08-08-2006, 12:13 AM
ok. i did as you said and edited the but with the hit up down and all that fun stuff, but it still only gives me the one pixel. here is a link to the file if you want to take a look. http://squirrelnuts.org/fla/button.fla

Navarone
08-08-2006, 12:58 PM
Is there some reason why you are using the label in one layer of your button and static text in the other? :)

Navarone
08-08-2006, 01:07 PM
Check this link out to get the button fundamentals
http://www.tutorialized.com/tutorial/Creating-buttons-in-Flash/12633

Navarone
08-08-2006, 01:07 PM
Check this link out to get the button fundamentals
http://www.tutorialized.com/tutorial/Creating-buttons-in-Flash/12633

squirrelnuts
08-08-2006, 04:32 PM
no there is no reason. i just had it there before so i know what is what.

Navarone
08-08-2006, 04:34 PM
Did you review the tutorial? Do things make any more sense to you?:)

squirrelnuts
08-08-2006, 04:36 PM
i havent had a chance to read it yet but ill post back when i do.

squirrelnuts
08-08-2006, 05:53 PM
i've read the tutorial, but i feel like i've done every thing it has asked, and it still doesnt work properly. im including a revised fla link for your viewing pleasure.
http://squirrelnuts.org/fla/button2.fla

What exactly am i doing wrong?

Navarone
08-08-2006, 06:09 PM
Remove the layer called 'button_code'. And insert a blank key frame for the hit frame in the 'pressed' layer.

Your button frames should look like the attached image. I can't send back the fla because I am using Flash MX 2004 Prof.

If you don't need the label get rid of it. I believe the onClick event for the label is interfering with the rollover effect of the button. Did you want your text to be a different size when you rolled over or clicked the button? I am still trying to understand why you need the label.:)

squirrelnuts
08-08-2006, 08:06 PM
that worked great, thanks alot. i dont need the label now, i used them before back when i only had the action script and no graphics on the buttons. how do i get the text to change on roll over. i have removed the labels.

Navarone
08-09-2006, 12:49 PM
Your on your own here 'cause thats not hard to figure out if you think about it. You have four key frames, Up, Over, Down and Hit. If you rollOver your button what do you think you sould do?

Theres two books I would recommend you purchase, the first is Action Script for Flash MX, second Macromedia Flash MX Advanced for Windows and Macintosh. Both are excellent resources.

Good luck!:)

squirrelnuts
08-09-2006, 05:07 PM
Thanks alot! I really appreciate all your help.