A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: External .jpg in a Scrollpane Problem. 99% There!

  1. #1
    Junior Member
    Join Date
    May 2004
    Posts
    21

    External .jpg in a Scrollpane Problem. 99% There!

    Hi,

    I'm trying to have an external jpeg load into a scrollpane. Everything is working fine, I've even got a preloader for the jpeg. Only thing is that the loaded jpeg doesn't fit get masked by the scrollpane, and the scrollpane doesn't give a scrollbar to move the jpeg.

    Here is the code I've used...

    Code:
    champscroll.loadMovie("http://www.sportstv.eu.com/ChampionshipList.jpg");
    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;
    	if (percentage < 99.9) {
    		loadingBar._alpha = 100;
    		bar2box._alpha = 100;
    	}
    	if (percentage == 100) {
    		delete this.onEnterFrame;
    		loadingBar._alpha = 0;
    		bar2box._alpha = 0;
    	}
    }
    loadingBar and bar2box are parts of the preloader. champscroll is the scrollpane and ChampionshipList.jpg is the external jpeg, obviously.

    Does anyone have any ideas? I've tried to use redraw and refreshPane after the above code but they didn't work.

    Thanks for any help.

  2. #2
    Junior Member
    Join Date
    Feb 2006
    Posts
    19
    Don't use a scrollpane from the component menu. Create it with actionscript. Here is the code. Acutom it for your own use (the x and y coordinates) :



    /**
    Requires:
    - ScrollPane in library
    - NumericStepper in library
    */



    this.createClassObject(mx.controls.NumericStepper, "my_nstep", 10, {minimum:10, maximum:100, stepSize:10});
    my_nstep.value = my_nstep.maximum;

    this.createClassObject(mx.containers.ScrollPane, "my_sp", 20);

    // here you should put the coordinates of the scrollpane location
    my_sp.move(35, 80);

    // here you should put the scrollpane size
    my_sp.setSize(740, 445);
    my_sp.contentPath = "http://www.sportstv.eu.com/ChampionshipList.jpg";

    var nstepListener:Object = new Object();
    nstepListener.change = function(evt_obj:Object) {
    my_sp.content._alpha = my_nstep.value;
    }
    my_nstep.addEventListener("change", nstepListener);

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