A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Dynamic image loading?

  1. #1
    Junior Member
    Join Date
    Sep 2000
    Posts
    3
    Anyone figure out how to load an image for a directory yet in FLASH MX?

    I was able to get an image to load with LoadMovie, but I have a MovieClip in Scene_1 which requires a dynamic image.. But when I try using the LoadMovie in the clip, it will not show when I run Test Movie.. ARGH!

    Anyone figure this out yet? have any ideas?

    Dennis

  2. #2
    Member
    Join Date
    Apr 2002
    Posts
    43
    Remember, that loadMovie in test movie mode allows resources to be loaded from the same folder as the .fla only. this could be why you can't see it in test mode.

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Posts
    3

    Dynamic images

    I have setup a sample image in the same folder as the fla. I right-clicked the MovieClip in the library and exported it so I can reference it with actionscript.. still no go..

    Dennis

  4. #4
    www.intensewd.com
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    450
    What if you create a php script (or something) that reads the contents of a directory and returns the files as variables to flash?

    <?
    $i = 0;

    if ($dir = @opendir("../site")) {

    while (($file = readdir($dir)) !== false)
    {
    print ".&file$i=".$file;
    $i++;
    }
    closedir($dir);
    }

    ?>

    Put this in a blank text file, save it as .php

    change the ("../site") to whatever you want, or specify the folder in flash (make sure you use POST as method when you loadvariable if you specify it in flash), then in flash:

    loadvariables("readdir.php", _root, "POST");


    This script will read each file in the directory and turn it into a variable flash can use (file0, file1, file2 etc). You might want to tidy it up (file0=., file1=..).

  5. #5
    Senior Member
    Join Date
    Jan 2001
    Posts
    105
    Will this PHP script work using a Flash projector or only through a server/internet?

  6. #6
    Member
    Join Date
    Apr 2002
    Posts
    43

    Image Loading

    1) What kind of image is it? Encoding specs? Can you mail me a copy of the sameple image you are using? It could be the image. Also check your extension. Some image editors add the jpeg extension to the end of files. Most peeps don't see this cause they have "hide extensions of known file types" enabled. Check your FLA publication settings. IE ... Check to see if the JPG or PNG you are trying to import is of a greater color depth than exporting FLA. This probably isn't the case but who knows. I actually haven't yet messed around with this feature in MX.

    2) Start with a blank FLA three frames long. In frame 3 put a "stop()" command, and create one blank symbol of the movie type with an instance name "holder". It doesn't matter what size. Center it in the stage and type this snip of actionscript in the first frame of the main timeline:

    -------------------------------------------------------
    // will load an image into holder.
    {
    // Replace this string with the name of your image.
    // Note: ensure it is in the same folder as the FLA
    // for testing and on your server, the same folder as
    // the swf.
    var imagePath = "myImage.jpg";
    holder.loadMovie(imagePath);
    }
    --------------------------------------------------------
    Try this is in test and publication mode and please let me know what the result is.







    [Edited by CommandLogic on 04-16-2002 at 02:44 AM]

  7. #7
    Senior Member
    Join Date
    Jun 2000
    Location
    London
    Posts
    293

    Re: Dynamic images

    Originally posted by megarry
    I right-clicked the MovieClip in the library and exported it so I can reference it with actionscript..
    Dennis
    Are you using attachMovie to set the MC on stage then loadmovie into this? could you clarify or post code!

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