dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: loading remote jpg's

  1. #1

    loading remote jpg's

    Hey Gang,

    Is there a way to load external jpg's from a remote location, so a user can access jpg's on our server from an swf on theirs? Must the jpg's reside in the same dir as the swf?

    Best regards...
    Lance

  2. #2
    hehe I dont know the answer but, just warning you dont ask about preloadin them cuz you will never get a straight answer take it from me cuz i have been there done that.

    Im sure it can be done with like _root.folder.something but I hope someone has a better explaination for ya. sorry i couldnt help more

  3. #3
    _global.chosenson="flash"; chosenson's Avatar
    Join Date
    Jul 2002
    Location
    BIG APPLE
    Posts
    716
    It is actually very easy to accomplish. > See attachment < (The scripting includes comments describing what was done and why)

    I also have a thought about this;
    hehe I dont know the answer but, just warning you dont ask about preloadin them cuz you will never get a straight answer take it from me cuz i have been there done that.

    Im sure it can be done with like _root.folder.something but I hope someone has a better explaination for ya. sorry i couldnt help more
    If you don't have an answer, why reply? Sorry you couldn't help more! You helped?!!!

    I have found that if you don't get a [good] answer, it is probably due to not asking the right question, not explaining the problem correctly/fully.

    Am I complaining? Yes. This isn't directed to just one person, but to all those that post nothing of any help, just a post.
    If you have a question, need some help, email me:chosenson

    It's always the simplest things that escape the complex mind!

    always be just

  4. #4
    Spartan Mop Warrior Loyal Rogue's Avatar
    Join Date
    Apr 2003
    Location
    The Pit of Despair
    Posts
    513
    Originally posted by chosenson
    Am I complaining? Yes. This isn't directed to just one person, but to all those that post nothing of any help, just a post.

    You mean like this?
    ::
    "Just go make web and stfu already." - jAQUAN

    "Twitter is a public display of verbal diarrhea that comes out in small squirts." - Gerbick

  5. #5
    Spartan Mop Warrior Loyal Rogue's Avatar
    Join Date
    Apr 2003
    Location
    The Pit of Despair
    Posts
    513
    Originally posted by Panguino
    just warning you dont ask about preloadin them cuz you will never get a straight answer take it from me cuz i have been there done that.
    Maybe you didn't ask the right way...?


    Seriously, you can have a preloader for an externally loaded jpeg into a MC.
    The empty clip will return a size of 4 bytes when you check using getBytesTotal()
    Set up a loop that keeps checking the getBytesTotal(), if the value is below 10 then keep playing the "loading" animation.
    If the value is above 10, then the picture is finished loading and you can goto a frame beyond your preloader loop.

    Code:
    picLoaded = emtptyClip.getBytesTotal();
    if (picLoaded > 10) {
            gotoAndPlay("showpicture");
    } else {
            gotoAndPlay("loading");
    }
    Last edited by Loyal Rogue; 01-13-2004 at 12:04 AM.
    ::
    "Just go make web and stfu already." - jAQUAN

    "Twitter is a public display of verbal diarrhea that comes out in small squirts." - Gerbick

  6. #6
    _global.chosenson="flash"; chosenson's Avatar
    Join Date
    Jul 2002
    Location
    BIG APPLE
    Posts
    716
    You mean like this?
    YES!!!
    If you have a question, need some help, email me:chosenson

    It's always the simplest things that escape the complex mind!

    always be just

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    ...If the value is above 10, then the picture is finished loading and you can goto a frame beyond your preloader loop.

    Guess you ment... If the value is above 4 then something is loading in that movie clip, but that it won't necessarilly be finished loading when it's just over 10... What if the picture is 200kbs?

  8. #8
    Spartan Mop Warrior Loyal Rogue's Avatar
    Join Date
    Apr 2003
    Location
    The Pit of Despair
    Posts
    513
    Originally posted by oldnewbie
    ...If the value is above 10, then the picture is finished loading and you can goto a frame beyond your preloader loop.

    Guess you ment... If the value is above 4 then something is loading in that movie clip, but that it won't necessarilly be finished loading when it's just over 10... What if the picture is 200kbs?

    In my searching, it seems that the big problem everybody has with jpeg preloaders is that getBytesTotal() doesn't give you a progression of the content thats loading, but waits until the whole jpeg is finished loading before it changes value.
    What I gave is just a workaround to that problem.
    You can see this preloader code in action at http://www.meolistudio.com/meolixml/meoliflash.html when viewing the photographs in the portfolio.
    Do you know of a percentage preloader that gets around this problem with jpegs?
    ::
    "Just go make web and stfu already." - jAQUAN

    "Twitter is a public display of verbal diarrhea that comes out in small squirts." - Gerbick

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    And what about getBytesLoaded() ?

  10. #10
    Spartan Mop Warrior Loyal Rogue's Avatar
    Join Date
    Apr 2003
    Location
    The Pit of Despair
    Posts
    513
    Oops, I misspoke.

    So are you saying that getBytesLoaded() will give you a progressive result of a jpeg that is loading into an empty movieclip that you can then use to make a percentage preloader?
    I was under the impression that only worked with swfs, not jpegs.
    Do you have an example I could see?
    TIA
    ::
    "Just go make web and stfu already." - jAQUAN

    "Twitter is a public display of verbal diarrhea that comes out in small squirts." - Gerbick

  11. #11
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Why on earth, couldn't I use getBytesLoaded(), when loading a .jpg in the same manner I load a .swf?

    http://blake.prohosting.com/~tektips/jpgpreload.swf
    Last edited by oldnewbie; 01-13-2004 at 06:06 PM.

  12. #12
    Spartan Mop Warrior Loyal Rogue's Avatar
    Join Date
    Apr 2003
    Location
    The Pit of Despair
    Posts
    513
    Thanks oldnewbie.
    I don't have Flash on my work computer, so I was going off of previous posts without being able to test anything.
    You just resolved multiple threads on other Flash forums too.
    ::
    "Just go make web and stfu already." - jAQUAN

    "Twitter is a public display of verbal diarrhea that comes out in small squirts." - Gerbick

  13. #13
    Thanks for your replies. I could have sworn I had tried it the same way as in chosenson's attachment, apparently not.... oldnewbie, nice example

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