A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Thumbnail scrollbar is on the right hand side.How to start at x=0 + go left to right?

  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    73

    Thumbnail scrollbar is on the right hand side.How to start at x=0 + go left to right?

    I rearranged a vertical scrollbar code to get a horizontal scrollbar. The only problem is that now it takes the x coordinate of the last thumbnail (I think) and goes right to left, meaning that the 1st thumbnail will not be at x=0.

    How can I get it to start with the first thumbnail is at x=0 and go from left to right?

    I've attached the .fla, xml and thumbnails.
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Jul 2008
    Posts
    73
    Mmm, this one's got me stuck. The scroll's length is controlled in the xml but I can't figure out how to position it on the left as it's hard wired into the code. Can anyone help to work it out?

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    73
    Here are the code parts that I've been trying to alter. Am I looking at the right code?

    Code:
    myGalleryXML.onLoad = function() {
    	_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
    	_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
    	_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
    	_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
    
    	_root.myImages = myGalleryXML.firstChild.childNodes;
    	_root.myImagesTotal = myImages.length;
    
    	_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
    	_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
    
    	_root.full_x = myGalleryXML.firstChild.attributes.full_x;
    	_root.full_y = myGalleryXML.firstChild.attributes.full_y;
    
    	callThumbs();
    	createMask();
    	scrolling();
    	callfirstimage();
    };
    Code:
    function callThumbs() {
    	_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
    	container_mc._x = _root.gallery_x;
    	container_mc._y = _root.gallery_y;
    	container_mc._alpha = 50;
    	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 = _root.thumb_width*i;
    		clipLoader.loadClip(+thumbURL,myThumb_mc);
    Code:
    function createMask() {
    
    	_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
    
    	mask_mc._x = _root.gallery_x;
    	mask_mc._y = _root.gallery_y;
    
    	mask_mc.beginFill(0x000000,0);
    	mask_mc.lineTo(_root.gallery_width,0); 
    	mask_mc.lineTo(_root.gallery_width,_root.gallery_height); 
    	mask_mc.lineTo(0,_root.gallery_width);
    	mask_mc.lineTo(0,0);
    
    	container_mc.setMask(mask_mc);
    }
    And this is the xml part of the code
    Code:
    <gallery thumb_width="63" thumb_height="60" gallery_width="1000" gallery_height="60" gallery_x="0" gallery_y="605" full_x="0" full_y="0">
    It was altered from a vertical scroller http://www.republicofcode.com/tutori...limagegallery/

    Can anyone think of a good workaround if not?

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    convert the String to a Number?

    _root.gallery_x = Number(myGalleryXML.firstChild.attributes.gallery_ x);

    gparis

  5. #5
    Member
    Join Date
    Jul 2008
    Posts
    73
    Hey GParis. Didn't work.

  6. #6
    Member
    Join Date
    Jul 2008
    Posts
    73
    Could you explain a bit more as I'm not sure if I implemented it correctly. Would it only need to be altered in the myGalleryXML.onLoad function code?

Tags for this Thread

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