A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Is it possible to load an external jpg into an mc in the library (Actionscript 2.0)?

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Posts
    378

    Is it possible to load an external jpg into an mc in the library (Actionscript 2.0)?

    Hi,

    I was wondering if you can load an external jpg into a movie clip which is in the library?

    The reason I am asking is because I have a transition between loading images and the transition has several instances of one movie clip being used for different tweens.

    The problem is that when the image loads, all instances have to be in frame 1 otherwise the jpg won't load into them and because I am using tweens the instances are on all different frame numbers.

    I want to be able to load the jpg into this movie clip but in the library so it updates all of the instances of this movie clip on the stage and further down the timeline.

    Is there a way of doing this or an alternative method I can use?

    Cheers.

    WB

  2. #2
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    No, you can't alter library Classes at runtime.

    You could use a bitmapdata object to draw into the transition MCs, though., or maybe into a child of the MCs so they can be animating on the timeline. You just need to make sure that the child you are drawing into is on stage when you draw.

    say you have a library mc "MyMC" that has a child named "holder" on stage. if you create a bunch of instances named "myMC0", "myMC1"...

    PHP Code:
    var container:MovieClip createEmptyMovieClip("container"getNextHighestDepth());
    var 
    mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("YourImage.jpg"container);

    function 
    onLoadInit(mc:MovieClip) {
        
    trace("onLoadInit: " mc);
        
    drawLoadedImage(mc);
    }

    function 
    drawLoadedImage(f_source:MovieClip){
        for (var 
    010i++){
            
    this[myMC i].holder.bitmapData = new BitmapData(100100,false0x000000);
            
    this[myMC i].holder.bitmapData.draw(f_source);
        }


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