PDA

View Full Version : ScrollPane Hell. External Jpeg into Flash 8


aussie01
04-12-2006, 05:23 PM
Hi

I'm trying to have an external jpeg load into a scrollpane called 'champscroll'. The jpeg loads fine but doesn't fit inside the scrollpane or have scrollbars on the side. Help!

I've put the code I'm using on the frame below.



//LOADS AN EXTERNAL JPEG INTO THE CHAMPSCROLL SCROLLPANE
champscroll.loadMovie = "http://www.sportstv.eu.com/ChampionshipList.jpg";

//PRELOADER FOR SCROLLPANE
loadingBar._xscale = 1;
loadingBar.onEnterFrame = function(){
kBytesLoaded = this._parent.champscroll.getBytesLoaded() / 1024;
kBytesTotal = this._parent.champscroll.getBytesTotal() / 1024;
percentage = Math.round(kBytesLoaded / kBytesTotal * 100);
this._xscale = percentage;

//MAKE THE PRELOAD BAR VISIBLE IF PERCENTAGE IS LESS THAN 100%
if (percentage < 99.9) {
loadingBar._alpha = 100;
bar2box._alpha = 100;
}

//MAKE THE PRELOAD BAR DISAPPEAR WHEN FINISHED
if (percentage == 100) {
delete this.onEnterFrame;
loadingBar._alpha = 0;
bar2box._alpha = 0;
}
}



Any help greatly appreciated.

Xeef
04-12-2006, 05:37 PM
not realy can folow you !

the scrollpane hase no "loadMovie" methode !
as everting in Flash is a movieClip and movieClip has "loadMovie"
you can use it and it loads
but whit this you overwrite the scrollpane !

lookup in the help -->
ScrollPane.contentPath

carriker
04-13-2006, 08:47 PM
You don't want to try the loadMovie method with the ScrollPane directly, you would want to create a movie clip and give it a linkage identifier in your library like "ImageLoader" or something similar. Then set the ScrollPane's contentPath parameter to "ImageLoader", then load the image into the movie clip with the following line of code:


champscroll.content.loadMovie("http://www.sportstv.eu.com/ChampionshipList.jpg");


If that is still giving you problems you might try doing the same thing but using the MovieClipLoader class instead of just loadMovie. That way you can add a listener to tell you when the image is finished loading and then call champscroll.invalidate(); which would force the ScrollPane to redraw itself.

Hope this helps,

--carriker