Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: Flash and Lightbox

  1. #21
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    The output window displayed this.
    "images/undefined"

  2. #22
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by nate51 View Post
    The output window displayed this.
    "images/undefined"
    As expected. See, the scope of the XML object doesn't go beyond the object itself. That's why in my example you see the use of arrays. What is the best thing to do when working with XML in a robust application like this, is to add the data to variable arrays or other variables so that you can manipulate the data afterwards.

    You're doing everything within the onLoad() event. There is nothing wrong with it, but for clarity of code I suggest you move the code outside. Also, you're declaring a lot of variables that don't come into use. Lastly, you're calling a "title" attribute from your XML which doesn't exist.

    I'm assuming you'll add the title in -- otherwise your caption in Lightbox will read "undefined";

    So, anyway...cleaning up your code, I get this:
    Code:
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    var totalImages:Number = new Number();
    var count:Number = 0; // Variable that counts how many movieclips have rendered thus far
    var yPos:Number = 30;  // Initial _y coordinate of the first row
    var spacing:Number = 55;
    
    xml.onLoad = function(success) {
    	if (success) {
    		totalImages = this.firstChild.childNodes.length;
    		loadImages();
    	}
    };
    
    function loadImages() {
    	for (i=0; i<totalImages; i++) {
    		var thmbPath:String = xml.firstChild.childNodes[i].attributes.thmb;
    		var holder:MovieClip = this.createEmptyMovieClip("holder"+i, this.getNextHighestDepth());
    		var thumbnail:MovieClip = holder.createEmptyMovieClip("thumb", 1);
    		
    		holder.id = i;
    		thumbnail.loadMovie(thmbPath);
    		
    		holder.onRelease = function() {
    				trace("javascript:LightboxDelegate('" + xml.firstChild.childNodes[this.id].attributes.src + "','" + xml.firstChild.childNodes[this.id].attributes.title + "')");
    				getURL("javascript:LightboxDelegate('" + xml.firstChild.childNodes[this.id].attributes.src + "','" + xml.firstChild.childNodes[this.id].attributes.title + "')");
    		}
    		
    		if (count == 8) {  // if count = 8, we're at the end of the row
    			count = 0;  // reset count to 0
    			yPos = yPos + 70;  // incease the _y coordinate for the next row (100 = height of element plus padding)
    		}
    		holder._x = count*spacing // set _x coordinate
    		holder._y = yPos;  // set _y coordinate
    		count++; // increase count by 1
    	};
    }
    
    xml.load("wedding.xml");
    When you click a thumbnail, it'll trace the LightboxDelegate call (and probably launch a blank browser window). When you embed it, it should work as intended with Lightbox++.

    HTH

  3. The Following User Says Thank You to Medyman For This Useful Post:

    nate51 (06-12-2008)

  4. #23
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Alright, this is starting to work now, thanks so much for sticking with it and helping me with this, the only issue I am confronting now is the bottom bar with the image description and the close button does not fit the picture, it seems to stay one generic size.

    Click Here Go to portfolio and select one of the last 3 pictures you will see what I mean.

    I assume this is a javascript issue now.

    *Corr
    Ok the last AS I had a better understanding of and things were a bit more clear and easier for me to edit (i.e. I could move the thumbnails and apply drop shadows as they were in a MovieClip, this new system seems to set the thumbnails in the top left corner and they don't work off the thumbnail Movie Clip I had.

    Is there anyway to still edit the thumbnail position and possibly add effects?
    Last edited by nate51; 06-12-2008 at 03:46 PM.

  5. #24
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hey Nate,

    I'm not able to replicate that in Fx 2 and IE7 on a PC. The popup box is resizing for me.

  6. #25
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Medyman View Post
    Hey Nate,

    I'm not able to replicate that in Fx 2 and IE7 on a PC. The popup box is resizing for me.
    I'm getting it perfect now too, maybe it was a cache issue or something.

    But do you happen to know of a way I can control the thumbnails with a MovieClip? instead of the freespace method it's in right now?

  7. #26
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Nevermind,

    What I did was made a MC and placed the AS in it, now I am able to reposition the mc containing the AS and apply drop shadows and everything still works.

    Medyman, you are a huge asset to this community, I cannot thank you enough for your assitance and education on this matter.

    -- Nate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •