Ok - so I have tried the following:

this.createEmptyMovieClip("img_mc", 999);
var my_mcl:MovieClipLoader = new MovieClipLoader();

mclListener.onLoadComplete = function(target_mc:MovieClip,
status:Number):Void {
    trace("onLoadComplete: " + target_mc);
};

my_mcl.addListener(mclListener);

my_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg";,
img_mc);

and while the clip loads I am not getting a trace... that's really what
I need....

Ted

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gabino
Travassos
Sent: Tuesday, July 08, 2008 11:24 AM
To: Flash Coders List
Subject: Re: [Flashcoders] tracing height

----- Original Message ----- 
From: "Lehr, Theodore M (N-SGIS)" <[EMAIL PROTECTED]>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Tuesday, July 08, 2008 8:56 AM
Subject: [Flashcoders] tracing height


>I have:
>
>
>
> _root.imageMovie.loadMovie(stepImageArray[0]);
>
> sizeImage();
>
>
>
> function sizeImage () {
>
>    trace(_root.imageMovie._height);
>
> }
>
>
>
> But I keep getting 0 I am guessing because the trace is fired before 
> the
> image is loaded... how can I make sure this function does not fire 
> until
> the image is loaded. I tried:
>
>
>
> _root.imageMovie.onLoad = function() {
>
>
>
> }
>
>
>
> But that does not seem to fire at all....
>
>
>
> My ultimate goal is to control the size of the image that is being
> loaded to make sure it is not too big....
>
>
>
> Thanks!

Hi Theodore,

There might be better ways than what I am using, but this works. For 
each image I create a new movieclip which onEnterFrame resizes the 
target loadMovie image to a set size, and then removes itself so it 
doesn't keep working needlessly.

This is cut and pasted from a project where images are sourced from XML,

so it might have some extraneous ...


   mrand=Math.round(Math.random()*3000);
     tname='img'+mrand;
     _root.createEmptyMovieClip(tname, imagedepth); imagedepth++;
     _root['img'+mrand].createEmptyMovieClip('md', imagedepth);
 
_root['img'+mrand].md.loadMovie(images.childNodes[i].attributes['imgloc'
]);
     _root['img'+mrand]._x=images.childNodes[i].attributes['x'];
     _root['img'+mrand]._y=images.childNodes[i].attributes['y'];
     trace(images.childNodes[i].attributes['imgloc']);

     // image sizer
     mrand=Math.round(Math.random()*3000);
     sizer=tname+'sizer'+mrand; imagedepth++;
     _root.createEmptyMovieClip(sizer, imagedepth); imagedepth++;
     _root[sizer].pushw=images.childNodes[i].attributes['w'];
     _root[sizer].pushh=images.childNodes[i].attributes['h'];
     _root[sizer].clipname=tname;
     //trace(images.childNodes[i].attributes['w']);
     _root[sizer].onEnterFrame=function(){
      trace(this.clipname + ' ' + this.pushw + ' ' + this.pushh);
      _root[this.clipname]._width=this.pushw;
      _root[this.clipname]._height=this.pushh;
      //trace(this.clipname); // img0sizer
      if(!init){ init=1; }
      if((this.pushw)&&(this.pushh)&&(init>30)){
        // counts to 30 frames and quits, should be enough
       this.removeMovieClip();
      }
      init++;
     }



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to