A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: using loadMovie to load in jpg's

  1. #1
    red eyed coffee fiend
    Join Date
    Jan 2002
    Location
    NJ
    Posts
    46

    using loadMovie to load in jpg's

    hey guys,
    i'm stuck with adding new features to some old code for a client.

    when the jpg's are loaded into the movie, the onClipEvent(data) are satisfied and it goes the next frame:
    code:
    loadMovie(_root.whatQuestion, _root.question_mc);
    loadMovie(_root.whatAnswer, _root.answer_mc);



    so the jpg's are loaded into question_mc, and answer_mc. now the client wants the jpg's all to be the same size and have white backgrounds!! (the jpg's being loaded in are all completely different shapes & sizes). i tried putting a white background in the question_mc, but when you load something into movieClip it erases anything in there. i'm stuck.

    question is: how can i put a white background into a movieClip, and then load a jpeg on top of it??

    if you have any idea please let me know

    thanks
    - monkeybrainz
    i work at initec
    ________________________________
    our design: JETFUELED design
    our hosting: JETFUELED hosting

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Location
    Slovenia
    Posts
    193
    I think this should do it:

    1. Create a rectangle in the library with the "rectMask" id. The size is not important, but make sure you align the rectangle so that its upper left corner has the position x=0 and y=0 - just to simplify matters...

    2. Put this code into the container movie clip

    code:

    // Attach the mask into the container
    // you must attach the mask only once
    attachMovie("rectMask","theMask",999);

    // Set the position of the mask
    // put in whatever suits you best
    theMask._x=100;
    theMask._y=50;

    // Set the height and the width of the mask
    // again, choose the dimension that is the
    // best for your liking
    theMask._width=200;
    theMask._height=150;

    createEmptyMovieClip("thePicture", 1);

    // Set the mask for the picture container
    thePicture.setMask(theMask);

    // Now you can load any picture into the
    // "thePicture" container (movie clip)
    loadMovie("a_sample_pic.jpg",thePicture);



    I haven't tried out the code, neither have I checked the syntax, so I don't guarantee that it will work. Ask questions if it doesn't.

  3. #3
    red eyed coffee fiend
    Join Date
    Jan 2002
    Location
    NJ
    Posts
    46
    thanks for your quick reply MatejKo! i'll try this and let you know how it works out

    - monkeybrainz
    i work at initec
    ________________________________
    our design: JETFUELED design
    our hosting: JETFUELED hosting

  4. #4
    red eyed coffee fiend
    Join Date
    Jan 2002
    Location
    NJ
    Posts
    46
    ok i'm trying out the code but i'm not sure where you mean by the container movie:
    2. Put this code into the container movie clip
    thank you - monkeybrainz
    Last edited by monkeybrainz; 06-18-2004 at 02:42 PM.
    i work at initec
    ________________________________
    our design: JETFUELED design
    our hosting: JETFUELED hosting

  5. #5
    Senior Member
    Join Date
    Jul 2002
    Location
    Slovenia
    Posts
    193
    It means anywhere

    You can put it in the first frame of your timeline... but be careful, the code must execute only once! Of course, you can create another movie clip in the library named "pictureContainer" - you would simply add the code into that movie clip's first frame and drag it onto the stage...

    Note: The container movie clip is the clip that contains the picture to be viewed. Usually you would want to make the viewed picture a separate movie clip, so that you can open it anywhere, attach it elsewhere, duplicate it somewhere etc.

  6. #6
    red eyed coffee fiend
    Join Date
    Jan 2002
    Location
    NJ
    Posts
    46
    i got it!
    thanks so much MatejKo!!!!

    -now off to drink beer and forget everything i know
    i work at initec
    ________________________________
    our design: JETFUELED design
    our hosting: JETFUELED hosting

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