barryg Posted November 28, 2009 Share Posted November 28, 2009 I'm currently clicking on a photo on a site and using a javascript window.open to display an enlargement in its own window. What I would like to do is use a javascript "Lightbox" effect written in AS3 as a class. I know as a minimum a tween would be used. I'm currently using tweenLite for a number of alpha effects. Anyone have any suggestions to get started. Link to comment Share on other sites More sharing options...
trispo Posted November 29, 2009 Share Posted November 29, 2009 I assume your photo on your site is displayed with flash player, right? Then you'd add a MouseEvent.CLICK event listener to that sprite displaying the photo and in the handler function create a loader instance that loads the larger version. photo.addEventListener(MouseEvent.CLICK, onPhotoClick); function onPhotoClick(event:MouseEvent):void { var loader = new Loader(); loader.load(new URLRequest("url_of_your_larger_photo"); addChild(loader); } That should display your larger photo. If you want a nice border and a close button you have to do extra work. I can post an simple example if you want. Link to comment Share on other sites More sharing options...
barryg Posted December 2, 2009 Author Share Posted December 2, 2009 Yes, I would like to see an example if you don't mind posting it. Thanks Link to comment Share on other sites More sharing options...
trispo Posted December 2, 2009 Share Posted December 2, 2009 Hi, I've put together a little example. I hope this explains enough what you have to do. Personally I would create a custom class for the Lightbox which makes it easy to reuse it. Look at it and let me know if you have problems understanding it. trispo PS: The image used is "borrowed" from google images. It is not mine and may not be used in your projects without asking the copyright owner. Link to comment Share on other sites More sharing options...
barryg Posted December 4, 2009 Author Share Posted December 4, 2009 Thank you for the example. I'll look at it in the next of days and yes I will convert it into a custom class. Link to comment Share on other sites More sharing options...
Kuldip D Gandhi Posted February 1, 2013 Share Posted February 1, 2013 Hi All, Can you please post Lightbox Example again? Thanks, Kuldip Link to comment Share on other sites More sharing options...
Carl Posted February 4, 2013 Share Posted February 4, 2013 We had some forum upgrades which may have temporarily made attachments inaccessible. I'm seeing the attachment for the lightbox here. Please try again. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now