Hi,
Recently posted about adding a ScrollPane for a foto gallery dynamically from an XML driven menu. My menu is in the main timeline and on clicking on one of its submenu buttons I want to load a ScrollPane to hold the pictures which obviously means that the AS for the dropping menu is in the _root timeline of the swf.
I was suggested to create a function to add the ScrollPane component but I'm having problems. The gallery that is supposed to load into my ScrollPane is completely actionscripted and I wonder if its function to scroll the thumbs on a rollOver mouse event could be the cause of any conflict that freezes the main menu in the movie which has another onRollOver event to drop down the submenus.
I've tried to refer to a closeSubMenu function in the _root timeline as soon as my thumbs appear on stage but I'm obviously far from knowing what the problem might be.
I'm not even really sure whether I'm making myself very clear or waht so I'm writing my site's adress to show the problem as well as the changes I've added to my last post's problem. Could it be a conflict problem with the mouse listening on different events? If so, any ideas on how to come around the problem?
http://webs.ono.com/jpdurba/
Code:function buildScrollPane():Void { this.createObject("ScrollPane", "cspScrollPane", this.getNextHighestDepth()); cspScrollPane._visible = false; cspScrollPane._x = -330; cspScrollPane._y = -190; cspScrollPane.setSize(804, 560); cspScrollPane.hScrollPolicy = "off"; cspScrollPane.refreshPane(); _root.closeSubMenu(); } buildScrollPane(); var myGalleryXML:XML = new XML(); myGalleryXML.ignoreWhite = true; myGalleryXML.load("gallery.xml"); myGalleryXML.onLoad = function():Void { gallery_x = myGalleryXML.firstChild.attributes.gallery_x; gallery_y = myGalleryXML.firstChild.attributes.gallery_y; gallery_width = myGalleryXML.firstChild.attributes.gallery_width; gallery_height = myGalleryXML.firstChild.attributes.gallery_height; myImages = myGalleryXML.firstChild.childNodes; myImagesTotal = myImages.length; thumb_height = myGalleryXML.firstChild.attributes.thumb_height; thumb_width = myGalleryXML.firstChild.attributes.thumb_width; full_x = myGalleryXML.firstChild.attributes.full_x; full_y = myGalleryXML.firstChild.attributes.full_y; }; function callThumbs():Void { createEmptyMovieClip("container_mc", getNextHighestDepth()); container_mc._x = gallery_x; container_mc._y = gallery_y; var clipLoader = new MovieClipLoader(); var preloader = new Object(); clipLoader.addListener(preloader); for (i=0; i<myImagesTotal; i++) { thumbURL = myImages[i].attributes.thumb_url; myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth()); myThumb_mc._x = thumb_width*i; clipLoader.loadClip("thumbs/"+thumbURL, myThumb_mc); preloader.onLoadComplete = function(target):Void { target.onRelease = function():Void { cspScrollPane._visible = true; callFullImage(this._name); }; target.onRollOver = function():Void { this._alpha = 75; }; target.onRollOut = function():Void { this._alpha = 100; }; }; } } myGalleryXML.onLoad = function():Void { gallery_x = myGalleryXML.firstChild.attributes.gallery_x; gallery_y = myGalleryXML.firstChild.attributes.gallery_y; gallery_width = myGalleryXML.firstChild.attributes.gallery_width; gallery_height = myGalleryXML.firstChild.attributes.gallery_height; myImages = myGalleryXML.firstChild.childNodes; myImagesTotal = myImages.length; thumb_height = myGalleryXML.firstChild.attributes.thumb_height; thumb_width = myGalleryXML.firstChild.attributes.thumb_width; full_x = myGalleryXML.firstChild.attributes.full_x; full_y = myGalleryXML.firstChild.attributes.full_y; callThumbs(); createMask(); scrolling(); }; function callFullImage(myNumber):Void { myURL = myImages[myNumber].attributes.full_url; cspScrollPane.contentPath = "images/"+myURL; } function createMask():Void { createEmptyMovieClip("mask_mc", getNextHighestDepth()); mask_mc._x = gallery_x; mask_mc._y = gallery_y; mask_mc.beginFill(0x000000, 100); mask_mc.lineTo(gallery_width, 0); mask_mc.lineTo(gallery_width, gallery_height); mask_mc.lineTo(0, gallery_height); mask_mc.lineTo(0, 0); container_mc.setMask(mask_mc); } function scrolling():Void { _root.onEnterFrame = function() { if (mask_mc._xmouse<(mask_mc._width*(1/3)) || mask_mc._xmouse>(mask_mc._width*(2/3))) { container_mc._x += Math.cos(((mask_mc._xmouse)/mask_mc._width)*Math.PI)*15; if (container_mc._x>mask_mc._x) { container_mc._x = mask_mc._x; } if (container_mc._x<(mask_mc._x-(container_mc._width-mask_mc._width))) { container_mc._x = mask_mc._x-(container_mc._width-mask_mc._width); } } }; }


Reply With Quote