A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Loading content of a local folder

  1. #1
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132

    Loading content of a local folder

    Hi

    I'm developing yet another Flash appliction and this time it's going to run localy as well as web. The problem here is that at one stage the user photos will be loaded onto the stage and I want this to load from a folder on local hard drive but I can't seem to find anyone, as PHP is a server side script I dont think i can use it.


    Any help is appreciated

    thanks

    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Just create a folder on your harddrive and place the images in there and use: movieclip.loadMovie("nameoffolder/image.jpg");
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132
    thanks for the reply, i do know that, but my problem is that, I dont know whats going to be inside the folder the user will put their photos in there for use inside the application so I need to load them in, but I have no information whatsoever about the image files.

    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You need to know the path and name of the files.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132
    so you mean there is no way for flash to read the content of a folder on the local harddrive??

    so what would you suggest, is there anyway to show a load file dialogue box to load files from local drive, to use in the application? I've already done this but for use on the web and uploading to the web using PHP.


    thanks for the help

    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Flash would not know any names unless you feed them. The only way to know is if the user opens the folder and clicks on the file to show, but then you need to add the folder name separately (look for filereference in the help files).
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132
    ya, thats what i was just trying, thanks for your help anyway, Flash needs to introduce more functionality with local drives!

    I'll post the solution if I get to work for others to use here


    thanks

    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  8. #8
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    I know that php can scan the folder for files:
    PHP Code:
    <?php
    $a
    =opendir(".");
    while(
    $b=readdir($a))if(strpos($b,".")!==0)if(strpos($b,".swf")!=false)if($b!="arrayCollect.swf")echo $b."\n";
    closedir($a);
    ?>
    I got this script earlier when I was trying to do something like what you are doing. I got this from a way earlier post of mine and someone gave me this script.

    I think that this is the actionscript that I got to go with it.
    code:
    for (var i in d=c.split(",")) {
    var e = this.createEmptyMovieClip(d[i], i);
    e.createTextField(0, 0, 20, i*20, 200, 20);
    e[0].variable = "_name";
    e.onPress = function() {
    this.createEmptyMovieClip(0, 0).loadMovie(this._name);
    };
    }


    Enjoy.
    .

  9. #9
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132
    thanks swak

    but as far as i know PHP is a server side script so it needs to be run on the server for it to function, but in my situation everything is local, so wont be able to run PHP code.


    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  10. #10
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    Then you have two options. Either look at the program zinc. Zinc compiles swfs into actual programs so that you can save. A simple solution is having a text file that has a list of the things you want loaded.
    .

  11. #11
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132
    thanks, yes i have seen that program, but for this project i just took a different approach, which is fine so far, have to see what other say.

    i just created a a folder called User and all the pictures are inside there, and in the instruction I ask the users to copy their image files over to this folder then load the ones they want from there!

    thanks again

    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  12. #12
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    How do you load it then?
    .

  13. #13
    Senior Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    132
    using the FileReferenceList to open the browse box and they select the images, but it has to be from that folder otherwise, obviously, it won't load up. also im using the loadClip(); than the loadMovie(); function so that I can catch errors if they select a file outside of that folder.


    Ameretat
    Adobe Certified Associate in Rich Media Communication Flash CS3

    My Company: Helix Creative My Main Project: CreativeChain

  14. #14
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    I was thinking of trying the fileReferenceList as well to do the same kind of thing. Good job taking the initiative. I didn't think of fileReferenceList because I need to experiment with it.
    .

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center