View Full Version : Browsing local files with Flash MX

05-29-2005, 08:56 PM
Hi. I am developing a site using Flash MX / Javascript where the user clicks the Browse button, chooses a file from their local directories, uploads it and then does a few other things. This works 100% perfectly the first time through ...
The problem I have is that if, after completing their first upload, etc, they wish to do a second one the Browse button won't open the window to show their local directory.

The index Html has two frames.
One frame loads an Html that contains the Flash swf and Javascript function.

The Browse button in Flash has the following code:


The Javascript function is:

function call_form_field1(){

The second frame in the index Html contains the following:

function set_variable1(value) {

<form name="form" action="commonSend.cfm" method="post" enctype="multipart/form-data">
<input type="file" name="file1" onFocus="set_variable1(this.value)">

"filename1" being the Flash Variable of the file the user has selected.

I have tried keeping the Browse button 'live' throughout the Flash movie and also tried calling the second choice "filename2" (with appropriate functions) but the Browse button will still not open the local directory window.
Am I missing something simple here or can I only call these functions once from Flash without reloading the whole fame or frameset again? Any suggestions would be gratefully received. Thanks.

05-29-2005, 10:15 PM
From the sound of it, it sounds like the problem is in the flash somewhere and without seeing the code it's hard to say what the problem might be. The way I ususally set up things like this in Flash is I have an init(); function that sets off everything. So when you click the expander to show the files you call the init() function that does everything. Once you are done with whatever is in that function you may need to set all of your variables back to their original state. Then you can call the init() function again. As I'm talking about it, it seems like that may be your problem. You may be changing some variable that is not getting reset and therfor not allowing the menu to expand again. For example, you may have a variable like menuStatus with two states, menuStatus = "closed"; and menuStatus = "expanded". It starts off as "closed", but then when you expand it it changes to "expanded". Then when you are done if you don't change it back to "closed" when you go to expand it again it may think it alread is expanded and won't go again.

I hope this helps some. What you are talking about is something that I have thought about creating myself but never have the time. If you would be willing to share I would be indebted to you.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum