Hello I have a problem.
This is a scolling menu xml menu. That I would like to do is that when I don´t have the mouse over on the menu, the hold menu shall scroll in a speed of 2. I have the code for it, but the problem is when I do the mouse out to the left or to the right. I can’t slow down the speed of the menu, it just add on the speed. When I do the mouse out in center of the menu I get the right speed. So the speed shall always be 2 when I do the mouse out, not that it add on speed of 2. Hope someone understand my bad English. (The function for speed when I do the mouse out is in bold)
Please help!!!
var thumb_spacing = 500;
var numThumb:Number;
function GeneratePortfolio(portfolio_xml){
var portfolioPictures = portfolio_xml.firstChild.childNodes;
numThumb = portfolioPictures.length;
for (var i = 0; i < numThumb; i++)
{ var currentPicture = portfolioPictures*;
var currentThumb_mc = this.root_mc.menu_mc.createEmptyMovieClip("thumbnail_mc"+i,i);
currentThumb_mc._x = i*thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_container",0);
currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);
currentThumb_mc.createTextField("description_txt",10,90,0,300,100);
currentThumb_mc.description_txt.autoSize = "left";
currentThumb_mc.description_txt.border = false;
currentThumb_mc.description_txt.multiline = true;
currentThumb_mc.description_txt.wordWrap = true;
currentThumb_mc.description_txt.html = true;
currentThumb_mc.textfile = currentPicture.attributes.description;
currentThumb_mc.link = currentPicture.attributes.url;
loadText(currentThumb_mc);
createLink(currentThumb_mc);
}
}
function loadText(mc:MovieClip)
{ var lv:LoadVars = new LoadVars();
lv.onData = function(src:String):Void {
if (src != undefined) {mc.description_txt.htmlText = src;}
else {mc.description_txt.htmlText = "Unable to load text.";}
}
lv.load(mc.textfile);
}
function createLink(mc:MovieClip){
mc.onRelease = function(){
getURL(mc.link,"_blank");
}
};
// xml object for xml content (defines sources for selections)
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success){
if (success){GeneratePortfolio(this);}
else {trace("Error loading XML file");}
}
// load
portfolio_xml.load("bodegashop.xml");
//Start of menu move
root_mc.onRollOver = panelOver;
var b = stroke.getBounds(_root);
**var speed = 2;**
function panelOver() {
if (numThumb > 1){
this.onEnterFrame = scrollPanel;
};//root_mc
delete this.onRollOver;//Make the onRelease function work
}
function scrollPanel() {
for (var i=0;i<numThumb;i++){
var xdist = _root._xmouse-250;
root_mc.menu_mc["thumbnail_mc"+i]._x += Math.round(-xdist/20);
//trace("tmb "+i+" "+root_mc.menu_mc["thumbnail_mc"+i]._x);
if (root_mc.menu_mc["thumbnail_mc"+i]._x>=450 && xdist<0){
root_mc.menu_mc["thumbnail_mc"+i]._x -= numThumb*thumb_spacing;
}else if (root_mc.menu_mc["thumbnail_mc"+i]._x<=-400 && xdist>0){
root_mc.menu_mc["thumbnail_mc"+i]._x += numThumb*thumb_spacing;
};
** if(_ymouse<b.yMin && _xmouse>+250) {
root_mc.menu_mc["thumbnail_mc"+i]._x -=speed;
} else if(_ymouse<b.yMin && _xmouse<+250) {
root_mc.menu_mc["thumbnail_mc"+i]._x +=speed;
}
if(_ymouse>b.yMax && _xmouse<+250) {
root_mc.menu_mc["thumbnail_mc"+i]._x +=speed;
} else if (_ymouse>b.yMax && _xmouse>+250){
root_mc.menu_mc["thumbnail_mc"+i]._x -=speed;
}
if(_xmouse>b.xMax) {
root_mc.menu_mc["thumbnail_mc"+i]._x -=speed;
} else if (_xmouse<b.xMin) {
root_mc.menu_mc["thumbnail_mc"+i]._x +=speed;
}
}
**};