PDA

View Full Version : scrollPane depth issues: content pops out


miiek
04-21-2005, 07:56 PM
I've got a scroll pane loading another swf which is loading some dynamic content. Every once in a while, the content jumps up a few levels out of the scrollPane. The scroll bars still show up, everything works, it's just on top of the frame of the scrollPane.

Here is my code. One variable is passed in which is "pid". If you'd like to try the script you can use pid=164; for reference. I don't think that my problem lies within this code though, I think it's just a buggy scrollPane component.

Thanks in advance for your help. I'll post up some links to fla's if anybody wants them.

To see my problem in action: Mickey Mantle Autographs (http://www.mickeymantleautographs.com) Use the menu on the right side to navigate to: Mickey Mantle>Photographs. This is the point where my scrollPane will get messed up. It may take 10 or so times of clicking on the Photographs button to get the content to jump out.


var loaderCounter:Number = 0;
var products_xml = new XML();
var thumbPath:String = "";
var description:String = "";
var xmlUrl:String = "http://www.mickeymantleautographs.com/page.php?pid="+pid;
var yPosition:Number = 10;

var my_fmtPROD:TextFormat = new TextFormat();
my_fmtPROD.font = "CenturyGothic";
my_fmtPROD.size = 16;

var my_fmtPRODDesc:TextFormat = new TextFormat();
my_fmtPRODDesc.font = "CenturyGothic";
my_fmtPRODDesc.size = 14;

products_xml.ignoreWhite = true;
products_xml.load(xmlUrl);

this.createEmptyMovieClip("products_mc", 0);

products_xml.onLoad = function(success:Boolean) {
for (var n = 0; n<products_xml.firstChild.childNodes.length; n++) {
products_mc.createEmptyMovieClip("products_mc"+loaderCounter, products_mc.getNextHighestDepth());

thumbPath = products_xml.firstChild.childNodes[loaderCounter].attributes.Picture;
prod_title = products_xml.firstChild.childNodes[loaderCounter].attributes.Title;
prod_desc = products_xml.firstChild.childNodes[loaderCounter].firstChild.nodeValue;

products_mc["products_mc"+loaderCounter].createEmptyMovieClip("productThumb_mc"+loaderCounter, products_mc["products_mc"+loaderCounter].getNextHighestDepth());
products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter].createEmptyMovieClip("thumbHolder_mc"+loaderCounter, products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter].getNextHighestDepth());
products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter]["thumbHolder_mc"+loaderCounter].loadMovie(thumbPath);
products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter]._x = 10;
products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter]._y = yPosition;
products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter]["thumbHolder_mc"+loaderCounter]._xscale = 100;
products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter]["thumbHolder_mc"+loaderCounter]._yscale = 100;

products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter].onPress = function() {
getProd(products_xml.firstChild.childNodes[this._name.charAt(15)].attributes.pID, pid);
};

products_mc["products_mc"+loaderCounter]["productThumb_mc"+loaderCounter].addEventListener("complete", listenerObject);

products_mc["products_mc"+loaderCounter].createTextField("producttitle_txt"+loaderCounter, products_mc["products_mc"+loaderCounter].getNextHighestDepth(), 170, yPosition, 380, 150);
products_mc["products_mc"+loaderCounter]["producttitle_txt"+loaderCounter].wordWrap = true;
products_mc["products_mc"+loaderCounter]["producttitle_txt"+loaderCounter].embedFonts = true;
products_mc["products_mc"+loaderCounter]["producttitle_txt"+loaderCounter].text = prod_title;
products_mc["products_mc"+loaderCounter]["producttitle_txt"+loaderCounter].setTextFormat(my_fmtPROD);

products_mc["products_mc"+loaderCounter].createTextField("productDesc_txt"+loaderCounter, products_mc["products_mc"+loaderCounter].getNextHighestDepth(), 170, yPosition+18, 380, 150);
products_mc["products_mc"+loaderCounter]["productDesc_txt"+loaderCounter].wordWrap = true;
products_mc["products_mc"+loaderCounter]["productDesc_txt"+loaderCounter].embedFonts = true;
products_mc["products_mc"+loaderCounter]["productDesc_txt"+loaderCounter].text = prod_desc;
products_mc["products_mc"+loaderCounter]["productDesc_txt"+loaderCounter].setTextFormat(my_fmtPRODDesc);

loaderCounter = loaderCounter+1;

yPosition = yPosition+160;
}
fixPane();
};

miiek
04-21-2005, 11:24 PM
i've tried setting the size of the scrollpane after the content was finished loading. this isn't helping.

ulisse
04-23-2005, 10:27 AM
I have same problem as you have on my project. I believe this may help: http://www.actionscript.org/forums/showthread.php3?t=61171&highlight=scrollpane+dynamic

I am trying to do something as described in that thread, assuring that all my content is definetely loaded in my contentHolder before refreshing scrollpane with refreshPane();

I will keep you informed if it will work...
bye
ulisse