A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Loading JPEGs from text file

  1. #1
    Junior Member
    Join Date
    Apr 2001
    Posts
    5
    I am working on a Flash feature that needs to load JPEGs from a text file and then fade from one JPEG to another. I can load the text file in and read the variables. However, once I try to use a variable to call a JPEG from an instance:

    onClipEvent(data) {
    loadMovieNum(variable, instance)
    }

    , the main timeline ceases playing so I can't show anything but the first JPEG loaded. Any ideas?

  2. #2
    Flashkit Waterboy
    Join Date
    Oct 2000
    Posts
    120
    Not sure exactly whats wrong with your code, but maybe looking at one I did would help? Hope it does. http://www.marshmonkey.com/ian/photos.fla

  3. #3
    Junior Member
    Join Date
    Apr 2001
    Posts
    5

    thank you

    Originally posted by BuddyLee
    Not sure exactly whats wrong with your code, but maybe looking at one I did would help? Hope it does. http://www.marshmonkey.com/ian/photos.fla
    thanks for the file -- that's a nice piece. Unfortunately, part of the problem is that the JPEG names have to come from a text file because I won't know what they are named. Your script uses numbers to call the JPEGs, but in my case they may be called 5878xJEGL.jpg or 342hhhhsjsaa.JPG -- I won't know ahead of time.

    I'm working with a content management system/advertising engine that is generating the image URLs and putting them in a text file for me. I need to assign each URL to a variable in Flash and then call the image with the variable name.

    Thanks again, though.

  4. #4
    Flashkit Waterboy
    Join Date
    Oct 2000
    Posts
    120
    well you should just be able to replace my
    Code:
    _root.n+1
    with whatever variable you load that random url into. Unless I'm missing something obvious here, it should be just that simple.

  5. #5
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    do you want the movie to automattically grab the names of the jpg files within that directory? or will the names of the jpgs be in the text file?
    if the names are in the text file, just make a variable equal to the name of the jpg.
    if you want the movie to grab the names of the jpgs in a particular directory, dynamically, you will have to use some sort of server side scripting, such as PHP. with php you can grab the file names in a directory and then filter out all but the .jpg and then save those names to a text file and read from the text file, or you can just send those names straight to flash.

  6. #6
    Member
    Join Date
    Apr 2002
    Posts
    41
    I know exactly what your talking about, I battle the same problem in my Flash project. I don't have a solution either.

    My pictures load from a text file aswell, and once the images loads every ongoing loop, involving the load command stops, so I had to make work arounds in the code.

    I guess if a loadMovie jpeg can stop a legit script loop, it can also stop a time line!?

    I too would like to know, if this problem holds a solution.

    SaCCo

  7. #7
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    Originally posted by SaCCo
    I know exactly what your talking about, I battle the same problem in my Flash project. I don't have a solution either.

    My pictures load from a text file aswell, and once the images loads every ongoing loop, involving the load command stops, so I had to make work arounds in the code.

    I guess if a loadMovie jpeg can stop a legit script loop, it can also stop a time line!?

    I too would like to know, if this problem holds a solution.

    SaCCo
    what?

  8. #8
    Flashkit Waterboy
    Join Date
    Oct 2000
    Posts
    120
    did you try my suggestion? This shouldn't be that big of a problem, I'm sure there is an easy solution. If your still stuck, show me exactly what your .txt looks like.

  9. #9
    Member
    Join Date
    Apr 2002
    Posts
    41
    My point was that, loading a jpeg externally via text file can cause the Flash player to stop what its doing.
    And this not only goes for timelines. it goes for scripts aswell.

    For you it stops the timeline when you load your jpegs!

    For me it stops my script loops. (I dont use time line jumping to execute scripting. its all in one frame)

    I just didn't knew It could also stop a running timeline untill you wrote it!

    Btw. As a matter of fact, I was alos trying to do a image fade in/out. with a "for loop". but contrary to any logic, the fade loop stoped when it loaded the image, so the new image never faded in.

    SaCCo

  10. #10
    Flashkit Waterboy
    Join Date
    Oct 2000
    Posts
    120
    strange, I've never had anyproblems with loadMovie stopping the timeline. Of course it will pause processing the code until the loadMovie function returns, but that shouldn't cause a big problem.
    http://www.marshmonkey.com/ian

  11. #11
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    i never had a problem either; strange.

  12. #12
    Junior Member
    Join Date
    Apr 2001
    Posts
    5

    loadMovie now okay EXCEPT

    Originally posted by BuddyLee
    strange, I've never had anyproblems with loadMovie stopping the timeline. Of course it will pause processing the code until the loadMovie function returns, but that shouldn't cause a big problem.
    http://www.marshmonkey.com/ian
    Apparently the problem was that you cannot use loadMovie with an external variable (one from a file) unless the loadMovie function runs in the same frame number (different layer, but same frame) as the loadVariable function in the actions layer.

    Now the problem is that every time Flash comes to frame 1 it loads the images again. I need to think of a clever way to avoid this. Just so everyone can see what I've got so far, all the files can be grabbed here:

    http://www.themechanism.com/dropoff/FlashFeature.sit

    This is a pretty useful application for content sites who want to have a Flash feature on the home page and need to be able to update it frequently (without Generator)

  13. #13
    Member
    Join Date
    Apr 2002
    Posts
    41
    Hey, come to think of it, I have to say that my loadMovie problem only occured in my current flash scene which also causes me other strange unlogical problems, So its properly due to some weird problem with my site, and not falsh in general.

    Sorry for any misleding information!?

    -SaCCo


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