The way i set it up, the scrollPane content path is pointed to the linkage identifier of a movie clip in the library. That movie clip has code in the first frame to create empty movie clips that load the content I want (in this case, an array of jpegs from the web server). As you create the empty movie clips that load the content, you should be able to assign each of them an onRelease, onRollover, onPress, etc., to do whatever you want them to do. My code may be more complex than what you need -- if your buttons are statically embedded in a movie clip, just code them as you ordinarily would, and tell ScrollPane (via its content path) to attach the entire clip.

Here's what I have right now, but it's not loading and distributing all the jpegs quite right just yet (works fine locally but not perfectly over the web). It loads all the jpegs, one at a time, from an array declared elsewhere in the movie. Distributes the jpegs into two rows as they're loaded, and assigns event actions to each one. When there are no more jpegs to load, it turns off a Loading message and builds a scrollbar as needed. If assigning actions this way, you should just call functions that call press1(), rollover1(), press2(), etc., so you can name them dynamically. You can define what press1(), press2(), etc. do, elsewhere in the movie, so you have in effect built a lookup table of functions.

Here's my code. I'd love it if anyone can explain why the jpegs line up beautifully when running locally, but get jumbled and overlapped when loading from a webserver (even after they're cached!):

/*****************************************/
stop();
// x position for first thumbnail:
var xPos = 5;
// variable to count up while creating loader clips:
var i = 0;
// set the spacing between the thumbnails:
margin = 12;
// set the y coords for the top and bottom rows:
row1Y = 11;
row2Y = 122;
//
//
loadThumbs = function () {
        this.createEmptyMovieClip("holder" + i, this.getNextHighestDepth());
        // store name temporarily:
        currentHolder = this["holder" + i];
        // create movieClipLoader to handle loading:
        this["myLoader" + i] = new MovieClipLoader();
        // load thumbnail images into the holder:
this["myLoader" + i].loadClip("images/" + _global.stock[i] + "T.jpg", currentHolder);
        // create a listener for the movieClipLoader to monitor load status:
        var myListener = new Object();
        // on load init for each jpeg, space it correctly into two rows:
        myListener.onLoadInit = function() {
                currentHolder._x = xPos;
// drop every other thumbnail into the second row (% = modulo in Flash):
                // note first i=0, so i%2 would != 1:
                if (i % 2 == 1) {
                        currentHolder._y = row2Y;
// after placing an element in the second row, increment the xPos for the next element:
                        xPos += currentHolder._width + margin;
                } else {
                        currentHolder._y = row1Y;
                }
                // establish event actions for the thumbnails:
                currentHolder.onRollOver = function() {
                        hintOn(stock[Number(this._name.substr(6))]);
                };
                //
currentHolder.onRollOut = currentHolder.onDragOut = currentHolder.onReleaseOutside = function () {
                        hintOff();
                };
                //
                currentHolder.onRelease = function() {
                        trace(stock[Number(this._name.substr(6))]);
                        loadLargeImage();
                };
                // recurse this function if there are more thumbnails to load:
                if (i < stock.length - 1) {
                        i++;
                        loadThumbs();
                } else {
// turn off the "Loading" display and built the scrollbar:
                        _root.loadingMssg._visible = 0;
                        /// trace("done loading");
_root.thumbsPane.scrollBar._width = _root.thumbsPane.bg._width * _root.thumbsPane.bg._width / _root.thumbsPane.holder._width; if (_root.thumbsPane.scrollBar._width > _root.thumbsPane.bg._width) {
                                _root.thumbsPane.scrollBar._width = 0;
                                _root.thumbsPane.scrollBg._visible = 0;
                        } else {
                                _root.thumbsPane.scrollBg._visible = 1;
                        }
                        _root.thumbsPane.scrollBar.onPress = function() {
startDrag(this, false, 0, this._y + .5, _root.thumbsPane.bg._width - this._width, this._y + .5);
                                this.onEnterFrame = function() {
_root.thumbsPane.holder._x = -(this._x * ((_root.thumbsPane.holder._width - this._width) / this._width));
                                };
                        };
                        _root.thumbsPane.scrollBar.onRelease = function() {
                                stopDrag();
                                delete this.OnEnterFrame;
                        };
                }
        };
        this["myLoader" + i].addListener(myListener);
};
// finally, call the loadThumbs function:
loadThumbs();
//
/******************************************************/

Good luck,

Marc

At 04:15 AM 11/26/2005, you wrote:

Sorry to but in...but thought since your conversation seemed to imply a working knowledge of ScrollPane use: Maybe you can give me a code line hint or example to allow my buttons in my scrollPane to Load swf.s?
Any help ? Dennis


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to