Advanced Search

Page 1 of 6 123 ... LastLast
Results 1 to 10 of 55

Thread: Call lightbox from a flash file with buttons?

  1. #1
    Join Date
    May 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Call lightbox from a flash file with buttons?

    I may be trying to do something that is impossible?

    I want to have full control of the design of my html-based homepage, therefore I am using flash files in the centre area of my hp. However, the next phase is to call my lightbox galleries from a flash file that have several buttons. I succeeded in doing so from just one button via html code. The question is, can I do this as well from a flash file with the getURL command?

    I have a test site here www.kaaresmith.dk/_stills.html that shows the one button thing I've done.

    I had hoped I could just accomplish what I want by drawing hotspots in Dreamweaver, but unfortunately that's not possible on swf's.

    Hope I made myself clear!

    Kaare

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

    Default

    It's not impossible...it's quite possibe actually.

    In fact, I'm planning to add a lightbox 2.0 and flash interaction on my website (i'm in the process or redesigning it and I keep changing the design every other day).

    I'm going to assume that you have Lightbox setup in your document per the Lightbox documentation.

    1) Insert the following "Delegate" somewhere between the head tags of your document:
    Code:
    <script type="text/javascript">
    function LightboxDelegate(url,caption) {
    var objLink = document.createElement('a');
    objLink.setAttribute('href',url);
    objLink.setAttribute('rel','lightbox');
    objLink.setAttribute('title',caption);
    Lightbox.prototype.start(objLink);
    }
    </script>
    2) Add the correspoding linkage in your actionscript

    Code:
    PictureMC.onRelease = function() {
       getURL("javascript:LightboxDelegate(image1.jpg','caption1')")
    }

    Disclaimer: I'm typing this directly into the forum so there might be sytax errors but it should work. Post back if you have any issues.

    HTH

  3. #3
    Join Date
    May 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I forgot to mention that I need several pictures to show from one button. Do I make several javascripts then with different elements as in below:

    <script type="text/javascript">
    function LightboxDelegate(url,caption) {
    var objLink = document.createElement('a');
    objLink.setAttribute('href',url);
    objLink.setAttribute('rel','lightbox[sport]');
    objLink.setAttribute('title',caption);
    Lightbox.prototype.start(objLink);
    }
    </script>

    <script type="text/javascript">
    function LightboxDelegate(url,caption) {
    var objLink = document.createElement('b');
    objLink.setAttribute('href',url);
    objLink.setAttribute('rel','lightbox[concerts]');
    objLink.setAttribute('title',caption);
    Lightbox.prototype.start(objLink);
    }
    </script>

    I'll try it out myself later today, so I'll get back to this issue myself, but thanks so far!

    K

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

    Default

    I'm not sure what exactly you mean here. Is it even possible to run two seperate instances of the lightbox at once?

    I'm not really that familiar with the lightbox (i decided not to go that route so didn't look into it much, told u my design changes a lot).

    In any case, if it's possible...then your logic would be right. If you can't get it work, I would post in the JS forum and see if someone can help you because the issue would be with two JS scripts not overlapping. The flash linking is pretty straightforward.

  5. #5
    Join Date
    May 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi again,

    it is indeed possible to have several lightbox galleries on the same page, that's where the [] are used.

    This is the javascript I typed in my header:

    <script type="text/javascript">
    function LightboxDelegate1(url,caption) {
    var objLink = document.createElement('a');
    objLink.setAttribute('href',url);
    objLink.setAttribute('rel','lightbox[iceland]');
    objLink.setAttribute('title',caption);
    Lightbox.prototype.start(objLink);
    }
    </script>

    <script type="text/javascript">
    function LightboxDelegate2(url,caption) {
    var objLink = document.createElement('a');
    objLink.setAttribute('href',url);
    objLink.setAttribute('rel','lightbox[hans]');
    objLink.setAttribute('title',caption);
    Lightbox.prototype.start(objLink);
    }
    </script>

    This is the code in the flash button:

    on (release) {
    getURL("javascript:LightboxDelegate1('billeder/iceland/_MG_0725.jpg' , 'Seydisfjordur')");
    }

    on (release) {
    getURL("javascript:LightboxDelegate2('billeder/hans/hans_01.jpg' , 'Hans Nielsen, dwarf')");
    }

    Strangely enough, the caption I enter in the flash file is necessary, but it is the title written in the html document that counts:

    <a href="billeder/iceland/_MG_0725.jpg" rel="lightbox[iceland]" title="Seyðisfjörður, Iceland"></a>
    <a href="billeder/iceland/_MG_0714.jpg" rel="lightbox[iceland]" title="Seyðisfjörður, Iceland"></a>

    <a href="billeder/hans/hans_01.jpg" rel="lightbox[hans]" title="Hans Nielsen, dværg"></a>
    <a href="billeder/hans/hans_02.jpg" rel="lightbox[hans]" title="Hans Nielsen, dværg"></a>
    <a href="billeder/hans/hans_03.jpg" rel="lightbox[hans]" title="Hans Nielsen, dværg"></a>
    <a href="billeder/hans/hans_04.jpg" rel="lightbox[hans]" title="Hans Nielsen, dværg"></a>

    But HEUREKA! It works!

    http://www.kaaresmith.dk/test.html

    Thanks a zillion, Medyman!

    Cheers, Kaare

  6. #6
    Join Date
    May 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Argh, hold on..

    Tested the site on my wife's pc with IE 6 and I just get a grey screen there - do you have any idea, how to solve that, or should I make a new post in the Java forum? It works on Firefox on the PC as well...

    K

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

    Default

    Yes, seek a javascript expert. It has to be something with the Javascript (which I know very little about).

  8. #8
    Join Date
    Jun 2007
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Hey guys! This is awesome! Totally what I was looking for!

    Medyman - do you have any idea if you can make this work on images loaded dynamically from an XML file? So that it loads the picture that showing when you click on the moviclip?

    Is it possible? could be as simple as replacing 'image1.jpg' with something else that calls the image? or is it more complicated than that? Any help would be brilliant!

    I'm somewhat new at this, and I got the lightbox working, but it would change my world if i could this! heh

    Quote Originally Posted by Medyman View Post
    It's not impossible...it's quite possibe actually.

    In fact, I'm planning to add a lightbox 2.0 and flash interaction on my website (i'm in the process or redesigning it and I keep changing the design every other day).

    I'm going to assume that you have Lightbox setup in your document per the Lightbox documentation.

    1) Insert the following "Delegate" somewhere between the head tags of your document:
    Code:
    <script type="text/javascript">
    function LightboxDelegate(url,caption) {
    var objLink = document.createElement('a');
    objLink.setAttribute('href',url);
    objLink.setAttribute('rel','lightbox');
    objLink.setAttribute('title',caption);
    Lightbox.prototype.start(objLink);
    }
    </script>
    2) Add the correspoding linkage in your actionscript

    Code:
    PictureMC.onRelease = function() {
       getURL("javascript:LightboxDelegate(image1.jpg','caption1')")
    }

    Disclaimer: I'm typing this directly into the forum so there might be sytax errors but it should work. Post back if you have any issues.

    HTH

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

    Default

    Why don't you try it and see...

    Yes, that is how you would change which image came up in the lightbox when you clicked it...

    Change "image1.jpg" to w/e image you wanted to show up and change "caption1" to whatever you want the caption to be.

    HTH

  10. #10
    Join Date
    Jun 2007
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Do you have any idea how to do that with images loaded dynamically from an XML file? I tried a few things but didn't work. Any ideas? Here's the code....
    Code:
    function thumbnails_fn(k) {
    	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
    	tlistener = new Object();
    	tlistener.onLoadInit = function(target_mc) {
    		target_mc._xscale = target_mc._yscale = 75;
    		target_mc._x = hit_left._x+(target_mc._width+5)*k;
    		target_mc.pictureValue = k;
    		smoothImageLoad(thumbnails[k], target_mc);
    		target_mc.onRelease = function() {
               getURL("javascript:LightboxDelegate('images/eyes1.jpg',' ')");
            };
    		target_mc.onRollOver = function() {
    			this.swapDepths(thumbnail_mc.getNextHighestDepth());
    			this._alpha = 50;
    		};
    		target_mc.onRollOut = function() {
    			this._alpha = 100;
    		};
    	};
    	image_mcl = new MovieClipLoader();
    	image_mcl.addListener(tlistener);
    	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
    }
    Quote Originally Posted by Medyman View Post
    Why don't you try it and see...

    Yes, that is how you would change which image came up in the lightbox when you clicked it...

    Change "image1.jpg" to w/e image you wanted to show up and change "caption1" to whatever you want the caption to be.

    HTH

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
  •