Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: Flash and Lightbox

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

    Default

    I suspected it was that too, but I placed the image in almost every directory I have and it still isnt able to find it.

    My AS is as follows (for the button part)
    Code:
    this.thumbHolder.onRelease = function() {
    			getURL("javascript:LightboxDelegate(\'images/" + images[this.id] + "\',\'" + captions[this.id] + "\')", "");
    This is a line from the XML
    Code:
    <image src="weddings/image01.jpg" thmb="thumbnails/weddings/image01.jpg"/>
    It's weird because I know it's so close and it's most likely something super small that's messing up I just cannot put my finger on what it is.

    *Edit
    Also the directory structure for the images is
    images/weddings/image01.jpg
    Last edited by nate51; 06-05-2008 at 01:30 AM. Reason: Forgot dir structure for images

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

    Default

    Replace your onRelease function with the below and see what it outputs.

    Code:
    this.thumbHolder.onRelease = function() {
    	trace("images/"+images[this.id]);
    }
    I'm not sure what other code you've changed other than your onRelease, so I can't say more than that at this point. Please post the rest of the code you've changed from what you've posted above.

    If you haven't changed it, then that's the problem. The images[this.id] syntax is related to the example I posted. You're using different techniques to import your XML.

    images[this.id] relates to the image path and captions[this.id] relates to the caption for the image. I don't see any part of your XML for a caption. Maybe you don't want to include this, I'm not sure. If you don't want to include it, then you can just leave it blank or pass an empty string.

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

    Default

    This is my AS to import the XML and make the thumbnails link to full size images.
    Code:
    myPhoto = new XML();
    myPhoto.ignoreWhite = true;
    var count:Number = 0; // Variable that counts how many movieclips have rendered thus far
    var yPos:Number = 0;  // Initial _y coordinate of the first row
    myPhoto.onLoad = function(success) {
    	//portfolioTag = this.firstChild;
    	numimages = this.firstChild.childNodes.length;
    	spacing = 51;
    	for (i=0; i<numimages; i++) {
    		this.picHolder = this.firstChild.childNodes[i];
    		this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
    		this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
    		this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
    		this.thumbHolder.title = this.picHolder.attributes.title;
    		this.thumbHolder.main = this.picHolder.attributes.main;
    		this.thumbHolder.onRelease = function() {
    			getURL("javascript:LightboxDelegate(\'images/" + images[this.id] + "\',\'" + captions[this.id] + "\')", "");
    
    		}
    		if (count == 8) {  // if count = 4, 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)
    		}
    		
    		this.thumbHolder._y = count*spacing // set _x coordinate
    		this.thumbHolder._x = yPos;  // set _y coordinate
    		count++; // increase count by 1
    	};
    };
    myPhoto.load("wedding.xml");
    is the "this." code causing a conflict? Since it appears as "this.thumbHolder".

    I hope this wont cause me to have to scrap this script and start with another one.

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

    Default

    is the "this." code causing a conflict? Since it appears as "this.thumbHolder".
    No, using the "this" keyword is a relative term. This always means the object that you're applying events/actions to. You can use it any number of times. Here there are within different contexts. I will say that almost all of your "this" decelerations are unnecessary. Removing them would clean up your code and make decipher relative paths easier.

    The error is that there are you're calling variables that don't exist. Have you tried the trace that I asked? Is it tracing only "images/"? In the getURL function, you're referencing two arrays (images and captions) when they don't exist anywhere in your code. I suspect you're confused by my implementation of XML.

    My personal preference is to separate out the data in the XML and assign them to arrays. This way I have the information to play/manipulate whenever I want in the entire applicate. If you do it all in the onLoad, as you're doing, it'll only be available in that function. This might/might not be a concern of yours though.


    So, to fix it I would suggest replacing the images[this.id] in the getURL with:

    Code:
    this.picHolder.attributes.src
    and since you don't have a caption in your XML, just leave the caption blank or to be on the safe side, pass a blank string.

    this.thumbHolder.onRelease = function() {
    getURL("javascript:LightboxDelegate('images/" + picHolder.attributes.src + "','')", "");
    }

    I haven't tested this, but in theory it should work. You might have problems with the picHolder.attributes.src being available within the onRelease function. You'll have to lay around with using this._parent etc, until you can access it.

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

    Default

    I did try the trace option I forgot what it gave me, I just tried it now and it gave me this "Wrong number of parameters; trace requires exactly 1."

    I am starting to understand how things are working here, but I tried your new example which made sense to me, but it still is just getting stuck on the loading.

    I tried playing around with the _parent command but it still didn't change anything.

    I thinned down the site and uploaded what it is doing so far, maybe this will help more, the swf file html and xml files are all there.
    Click Here

    Here is a working version in html
    Click Here

    I am drawing blanks.

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

    Default

    I did try the trace option I forgot what it gave me, I just tried it now and it gave me this "Wrong number of parameters; trace requires exactly 1."
    What, exactly, are you putting in the trace?

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

    Default

    Quote Originally Posted by Medyman View Post
    What, exactly, are you putting in the trace?
    Ok bare in mind I am new to the trace option never used it before but I had it like this.
    HTML Code:
    this.thumbHolder.onRelease = function() {
    			trace("javascript:LightboxDelegate(\'images/" + images[this.id] + "\',\'" + captions[this.id] + "\')", "");
    
    		}

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

    Default

    Ok try replacing that with:
    Code:
    this.thumbHolder.onRelease = function() {
    	trace("images/"+this.picHolder.attributes.src);
    }
    What do you get now?

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

    Default

    When I check the code (check syntax) it doesnt give me that error anymore.

    I saw someone use this before like a year ago and I cannot figure out how to display what functions are happening when you do them (window to display the actions) I am assuming that's why we are using the trace option so we can see where it is looking for the picture?

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

    Default

    I saw someone use this before like a year ago and I cannot figure out how to display what functions are happening when you do them (window to display the actions) I am assuming that's why we are using the trace option so we can see where it is looking for the picture?
    That screen you're talking about is the debug screen. It comes in handy but is not necessary here.

    So, what did the trace display in the Output panel?

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
  •