A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Load image in movie clip

  1. #1
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305

    Load image in movie clip

    Hello everyone, probly a simple one, but I cant get it to work... what is the script to load one image into a movie clip? Just one image, nothing else.. Thanks in advance
    Steve

  2. #2
    Degenerate and baise art thou. docree's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    390
    If on the clip...

    onEnterFrame{;
    this.loadMovie(imagename or var);
    }

    OR

    From another clip or the root....

    onEnterFrame{;
    _root.target.loadMovie(imagename or var);
    }

  3. #3
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Brilliant, cheers... oh, I'd missed out one of the ';' that may have caused a problem.. Thanks again mate

  4. #4
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Oh No!! Its still not working for me... can someone take a look at this for me and tell me where Im going wrong please? Thankyou
    Last edited by thesween; 08-13-2007 at 07:36 PM.

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Ok first if you put a clipevent in the clip itself you need to put it thus:

    onClipEvent(enterFrame){

    }

    But note that clip event is for something you want to happen EVERY FRAME of the movie. Not what you want here for loading an image.

    Secondly this would be better put in the root timeline thus:

    mc2.loadMovie("lyrics.PNG")

    and it would be executed when the movie starts.

  6. #6
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Remember using PNG as the externally loaded graphic format will require a Flash 8 player to view.

    http://www.informit.com/guides/conte...eqNum=343&rl=1

  7. #7
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    horay!!! I understand now, cool... and it works for me hahaha Thank you very much for your help. Problem is, I start getting into it and then don't touch KM for weeks then I forget how to do loads of things.

  8. #8
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Loading into a mc using code inside the mc still doesnt work for me... hmmmmm, putting the code in the root does though. Ive had a look at the link Chris, cheers for the info mate

  9. #9
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Originally, you weren't putting the actions "in" the clip but "on" it. You were using a clip event which is not the optimal place to script for what you need to do in this particular example. To use the script specifically in that clip you should double click the clip onstage, choose "frames" from the properties window so you enter it's timeline and then script in it's timeline just as you would the _root. This way it gets initiated as soon as it is placed in your _root timeline and can also be removed from _root by just removing it's instance instead of having to use a _root script to empty the clip contents.

    This places your original script in the second frame of the mc29 clip which is fired simply by being placed on frame 1 of the _root. I deleted the white box which defined the outline of your clip and instead let the loaded image decide the width/height and instead I focus on placing the empty mc29 clip on an X/Y value that accomodates my 416x416 koolmoves logo which recreates the size you were using for the white box.

    http://sandbox.blogdns.com/examples/lyrics2.html

    I'm running the beta and since I test pretty constant my "BIN" subdirectory is using the betas contents since I get so many. If you get errors opening my FUN file....you should be able to disregard it and still edit it. If not...let me know.
    Last edited by Chris_Seahorn; 04-12-2006 at 11:42 AM.

  10. #10
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Aha! I am beginning to understand this ALOT more now! Im getting excited! Hahaha Thanks again Chris, it works perfectly, You've just helped me out loads so I can get my website finished and it should load up alot quicker. As soon as its done I'll put it up here so you can see all the help and tips youve given have gone somewhere

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