dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to make a button load a jpg?

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Posts
    13

    How to make a button load a jpg?

    Hopefully someone can help me out with this?

    I have a movie clip on the main stage that within it has a button that upon rollover, plays a fade in/out animation. This part is fine.

    I would like have the movie clip on a layer called movie 1 when clicked on, load a jpg into a blank movieclip on a seperate layer called moviebox. How could I do that?

    Thanks in advance!
    Last edited by antipodeansson; 09-23-2003 at 06:59 PM.

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Only MX can load jpgs and only non progressive ones.

    // On a button
    on(release){
    _root.moviebox.loadMovie("myImage.jpg");
    }

    The image should be in the same folder as the Flash file when testing in Flash.
    (moviebox movieclip should be on the main timeline).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Junior Member
    Join Date
    Sep 2003
    Posts
    13

    Still Stuck

    hi

    thanks for the reply ... what is a progressive jpg?

    I've gone ahead & created a button on the main timeline that has this action:

    on(release){
    _root.moviebox.loadMovie("introbox.jpg");
    }

    My image was located in the same folder as the flash file and still won't load ... not too sure what's going on here?!

    I've attached my fla in case that helps?
    Attached Files Attached Files

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Its your button that acts weird, probably because of the movieclip on the first frame. I made a new button and then the jpg loaded fine.

    Note though that external files load with their top left into the middle of the target mc.

    When saving a jpg you have the option to save it as a progressive jpg. In a html page that would mean it will show as its being loaded. Flash does not support that.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Member
    Join Date
    Jun 2002
    Location
    au
    Posts
    116
    i usually do it by creating a container for a MC.. and then dynamically load the jpg in that.

    i used this technique for a childrens toy catelogue. http://www.earlylearningcentre.com.au . if you are looking for a tutorial regarding dynamic images.. there is a good one at http://www.kirupa.com then all you do is create an on release function for your button.

    eg.
    code:

    on (release)
    {
    loadMovie("swf file that has the container.swf", level)
    }



    for the swf with the container that holds the image

    code:

    _root.createEmptyMovieClip("container", level);
    container.loadMovie("image.jpg");
    container._x = 0; // this positions the images x co-ordinate.
    container._y = 0; // this positions the images y co-ordinate.



    hope this helps...

    remember you can't save the jpg as progressive.. flash MX doesn't support it.

    eChimp!!

  6. #6
    Junior Member
    Join Date
    Sep 2003
    Posts
    13
    Thanks everybody for their help!

  7. #7
    Junior Member
    Join Date
    Sep 2003
    Posts
    13
    ok - I've managed to create a button that loads a jpg in an empty movieclip container.

    on the over state of the button I have a movieclip play when the cursor rolls over it.

    the problem is getting the cursor to roll over and click on the button properly. how can I click on the button besides just the edges of it??

    I've attached my fla.
    Attached Files Attached Files

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The clickable area of a button is defined by what is in the HIT STATE of the button. Just make a shape , as big as the whole button there.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

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