A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: loading jpgs dynamically

  1. #1
    Member
    Join Date
    Jan 2002
    Posts
    95

    loading jpgs dynamically

    I would like to be able to incorporate an image that has either been uploaded or that is from a database into a flash movie. How would I go about doing this?

    What would happen in the case where the image is extremely large or extremely small - can you tell Flash to shrink/enlarge the dynamic image to a specified size?

    I must apologize in advance as I am by no means an actionscript expert.

    I appreciate your help

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    In MX you can use loadMovie() to load jpgs:
    code:

    some_mc.loadMovie("external.jpg");


    and after the jpg finishes loading, you can change it's size either with the _width and _height properties of the movie clip:
    code:

    some_mc._width = w;
    some_mc._height = h;


    or with the _xscale and _yscale properties in the same way...

  3. #3
    Member
    Join Date
    Jan 2002
    Posts
    95
    Thanks!

    To test it out, I loaded a jpg into an MC and then placed the MC where I want the jpg to appear. However, the jpg seems to go directly to the middle of the stage. How do I get around this?

    Also, I can't seem to figure out how to change the size of the jpg either. If the jpg is loaded in frame 1, where should I put the _height/_width script? -in the MC or on a new layer in the main timeline?

    Thanks again

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    take a look at this example

    just place the fla in the same folder as the jpg called external.jpg
    Attached Files Attached Files

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