A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Loading JPG from URL

  1. #1
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784

    Loading JPG from URL

    My question is fairly simple. In a database I have the URL to a jpg, or other format of picture. I load in that URL as a string, but how do I load that picture into a movieclip in my swf?
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

  2. #2
    Member
    Join Date
    May 2007
    Location
    North Carolina
    Posts
    95
    I think you just use loadMovie


    imageMC.loadMovie("../myFolder/myImage.jpg");

    or in your case

    imageMC.loadMovie(stringVar);

  3. #3
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784
    That's what I am trying, but it doesn't appear to be working...
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

  4. #4
    Member
    Join Date
    May 2007
    Location
    North Carolina
    Posts
    95
    post your code?

  5. #5
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784
    Not really a whole lot I can show you code wise. I am importing the URL in from a database using 'varsIn' and the variable photo. The path to the movieClip I want the picture in is box1.name.picture.picture_in

    so this is what I have

    Code:
    varsIn.onLoad = function (success) {
         if(success) {
               box1.name.picture.picture_in.loadMovie(this.photo1);
         } else {
               //nothing
         }
    }
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

  6. #6
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    is photo one tracing something besides "undefined"?
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  7. #7
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Does everything trace out correctly ? The success flag and both the filename ( this.photo1 ) and the holder movieclip ?

    Remember with load vars the scope goes to the actual load vars object, so you may have to drop a nasty _root in front of the mc name if you're not using Delegate to sort the scope out.

    Squize.

  8. #8
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784
    Hm... for some reason it works now. I changed what picture I was linking to and it works properly now... I was linking to a .png would that have anything to do with it?
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

  9. #9
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    Quote Originally Posted by ImprisonedPride
    Today, 05:03 PM
    Quote Originally Posted by Squize
    Today, 05:04 PM
    I suppose this means I'm quicker on the draw than you are. Though I suppose from the rumors I have to chalk it up to your age.

    .png loads fine for me, though I did not test from a database... but it works fine.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  10. #10
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784
    hm... not sure what the deal was then... Thanks anyways.
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

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