Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Browsing local files with Flash MX

    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:
    getURL("javascript:call_form_field1();");

    The Javascript function is:
    function call_form_field1(){
    parent.form_frame.form.file1.click();
    parent.form_frame.form.file1.focus();
    }

    The second frame in the index Html contains the following:
    function set_variable1(value) {
    parent.flash_frame.movie.SetVariable("filename1",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.

  • #2
    New Coder
    Join Date
    Feb 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •