A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30

Thread: Loading Jpegs

  1. #21
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917

    Re: yeah it is

    Originally posted by nev0
    Originally posted by aversion
    'contents' is a movie clip though right?

    contents is a movie clip

    ######
    the new movie seems to be loading from the mid point of contents to the bottom right... is there no way of restricting the "window" size of the new movie?

    I made a mask at contents but that didn't seem to be the point.... i guess the whole thing is replaced by the english.swf movie...
    [Edited by nev0 on 03-31-2002 at 05:01 PM]
    flash will load the new swf into the top left corner of the contents movie clip and if you don't state a level for the movie to load onto then it will over write whatever was in the clip before.



  2. #22
    Senior Member
    Join Date
    Oct 2000
    Location
    California
    Posts
    149

    Re: Re: Re: yeah it is

    You would still have to edit a text file in that case...I'm wondering if MX can evaluate how many jpgs are in the directory. Then you wouldn't have to edit the text file.

  3. #23
    Orange, Fuzzy, with spots Cakkafracle's Avatar
    Join Date
    Apr 2000
    Posts
    147
    i'm working on something right now...

    you need to be able to run php, but it works like a dream. it'll read the contents of a folder to a string that you pass back to flash...

    try this(i'm still working on it so it might be buggy, check every 30 mins or so

    http://cakkafracle.no-ip.com/Flash/loadimages/


    i want to buff this up, but essentially i have one php file that lets me first read the folders, then loads the contents of each folder

  4. #24
    Senior Member
    Join Date
    Oct 2000
    Location
    California
    Posts
    149

    Re: Re: Re: yeah it is

    But you still would have to edit the text file to change the image count...Can MX get the value directly? What about a PHP or XML script that counted the number of files in a directory and passed that value to Flash. Then you wouldn't have to edit the Flash movie or text file. The thinking would be that if the images directories had constantly changing amounts of images you would have to edit a text file constantly. If Flash, PHP or XML can do it automatically that would be SWEET!
    Make sense?

  5. #25
    Senior Member
    Join Date
    Oct 2000
    Location
    California
    Posts
    149

    Re: Re: Re: Re: yeah it is

    sorry didn't see your last post...
    Your link looks rockin! Would you post your PHP code?
    Thanks!
    MX ROCKS!

  6. #26
    Orange, Fuzzy, with spots Cakkafracle's Avatar
    Join Date
    Apr 2000
    Posts
    147
    Thanks..
    the reason alot of the thumbNails aren't showing is cuz they're saved as progressive jpgs..

    Its a pain but I have to go convert allll my files to non progressive

    Code:
       $tempDir = "/var/www/html/Webpages/flash/loadimages/images/$folder"; // change this path to point to the address of the folder you want to target
       $dirHandle=opendir($tempDir);
       while ($file = readdir($dirHandle)) {
          if($file == "." || $file == ".." ) {
          } else {
             if($file!="."){
                $i++; 
                $folderString .= "&variable".$i."=".$file;
             }
          }
       }
       $folderString.="&counter=".$i."&done=1&null=1";
       closedir($dirHandle);
       print($folderString);
    Counter is the number of folders/images... depending on what level you're looking at

    this script should spit you back a string formatted nicely for flash to read

    &variable1=folder1&variable2=folder2 etc...

    This script is only usefull if your webserver has php installed...


  7. #27
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917
    nice function there, i will try implementing this instead of reading a text file variable. Though i also included related variables of each image, i have one variable for each image with the image name and one with a short description for each variable. Plus i don't have to edit the text file directly because i can use a web interface to write all of these variable to the file.

    here's a list of filesystem functions which might be useful for people in dealing with this kind of thing:

    http://www.php.net/manual/en/ref.filesystem.php


    [Edited by aversion on 03-31-2002 at 11:18 PM]

  8. #28
    Orange, Fuzzy, with spots Cakkafracle's Avatar
    Join Date
    Apr 2000
    Posts
    147
    I'm glad you find it useful. I'd like to turn all this into a component so generating list of images is kinda drag and drop.


  9. #29
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917
    the ideal situation would be to be able to upload images to a sever through a web interface and be able to input associated information, such as an image name, author, description, stuff like that.

    This information can then be read by flash from a text file, or db, and using a php function such as yours flash can loop through the specified directory and grab the images, loading the filenames into an array which can be used to load the images when they are called.

    I'm pretty much done with all of this but I am getting hung up on trying to get a preloader to work for each image as it loads.. I think my problem has to do with this http://board.flashkit.com/board/show...hreadid=289032 so i'll spend tomorrow looking at that. I know my code should work, i'm using getBytes rather than the preloader component because my swf is still less than 2k and the component knocks it up to 7k!

    if anyone has any tips on how to preload images this way let me know


  10. #30
    Member
    Join Date
    Oct 2000
    Posts
    93
    Originally posted by ferretFace
    Hello!
    This thread showed me you can dynamically import JPGs into a Flash movie... something I've been struggling with for months now! I'm hoping I can pick your brains a bit more.

    I'm trying to make up a comic archiving system where you click buttons to navigate back and forth through the archive.

    I have a image called 'test200201.jpg'
    I use loadMovie("test200201.jpg", "image"); "image" being a place holder where the image goes. That much works.

    I've tried to make the number part into a variable so I could use buttons to increment the name of the jpg I want to load into place... like this

    foo = 200201;
    loadMovie("test"add foo".jpg", "image");

    and then my button would be foo = foo + 1 ...right?
    But I can't get as far as 'add foo' to work.

    Can something like this work, or am I crazy for thinking so?

    Not sure if you figured this out but this might be useful-

    foo++ (same as saying foo+=1 or foo=foo+1)

    Is this your exact code:
    "loadMovie("test"add foo".jpg", "image");"?
    This will not work. You didnt connect the ".jpg" correctly, and you should use "+" instead of "add" if you are using flash 5 ("add" will still work but "+" is recommended). So it should be: loadMovie("test"+ foo + ".jpg", "image");
    and if everything else is set up correctly it should work. I've used this method a thousand times, and you're on the right track.



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