I guess Loader will work fine for you, but you might want to have a look at the loadInit method of the MovieClipLoader class. That will allow you to do what you want also - you just size your holder clip to whatever you like - the trick is that you need to wait until the new clip is fully loaded and instantiated - exactly what loadInit does for you.
Hi There, I have an instance of an empty movie clip object (imageLoader) to which I load a .jpg image from an external file, as per the attached code . . . But I have a problem in that I do not know the dimmensions of the .jpg image before I load it and in some cases this results in a large image covering most of my screen, including some of the text on the screen, I simply can't have this as it looks crap for a start! So, my question is this . . . How do I force the image pulled in from the external file, and/or the movie clip object, to be no larger than a certain size (i.e. H: 177 pixels x W: 177 pixels)? function startLoading() { var VoucherNo:String = this._parent.Connect_Check.VoucherNo; var iNumOfTracks:Number = this.AlbumDetails.firstChild.childNodes.length; //27 childNodes var a:Number = Number(iNumOfTracks - 5); var xmlArtist:XMLNode = this.AlbumDetails.firstChild.childNodes[a].childNodes[0].firstChild.nodeValue; var Artist = xmlArtist.toString(); var t:Number = Number(iNumOfTracks - 6); var xmlTitle:XMLNode = this.AlbumDetails.firstChild.childNodes[t].childNodes[0].nodeValue; var Title = xmlTitle.toString(); var imagePath:String = ("C:\\local audio\\" + VoucherNo + "\\" + Artist + "\\" + Title + "\\folder.jpg.jpg"); if(imagePath.lastIndexOf(":") != 1) { var i:Number = Number(imagePath.lastIndexOf(":")); var newImagePath = imagePath.substr(0, imagePath.lastIndexOf(":")) + imagePath.substr(imagePath.lastIndexOf(":") + 1); trace(newImagePath); trace(i); } else { var newImagePath = imagePath; trace(newImagePath); } var mImageLoader:MovieClipLoader = new MovieClipLoader(); mImageLoader.loadClip(newImagePath, imageLoader); }
I've solved this myself by using the "Loader" component to load the image to, inside of an empty Movie Clip. The Loader component has a parameter property called "scaleContent" which you set to "true". This automatically resizes any image pulled in to the size of the Loader component as you yourself have scaled it on your screen. Brilliant! Simply brilliant!
Don't see what you're looking for? Try a search.
|