As3 image gallery question

Hello

I'm trying to set up a simple Gallery of images with alpha transition using as3.  But a problem with that. After each transition the image alpha, the stage becomes empty. The code I used for image Gallery is the sequel. Can someone help me. I try this for a week. but I still have a hope to make this work. So please help me.

import flash.display.Loader;
import flash.display. *;
import of gs. TweenLite;

const TIMER_DELAY = 2000;

var totImages:Number;
var: index number = 0;

var imgArr:Array = new Array();

var currentContainer:MovieClip = holder0;
currentContainer.alpha = 0;


var transTimer:Timer = new Timer (TIMER_DELAY);
transTimer.addEventListener (TimerEvent.TIMER, startTransition);

var imgLoader:Loader = new Loader();

var myXML:XML = new XML();
var XML_URL:String = "images.xml."
var myXMLURL:URLRequest = new URLRequest (XML_URL);
var myLoader:URLLoader = new URLLoader (myXMLURL);
myLoader.addEventListener ("complete", xmlLoaded);

function xmlLoaded(event:Event):void {}
myXML = XML (myLoader.data);
processXML (myXML);
}
function processXML (xml) {}
totImages = xml.children () .length ();
for (var i = 0; i < totImages; i ++) {}
var tempVar = xml... Item [i]... image;
imgArr.push (tempVar);
}
transTimer.start ();

currentContainer = holder0;
loadImage();
}
function loadImage() {}
var url = imgArr [index];
ImgLoader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, onProgressStatus);
imgLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, fadeInImg);
var fileRequest:URLRequest = new URLRequest (url);
imgLoader.load (fileRequest);
currentContainer.addChild (imgLoader);
}
function fadeInImg(e:Event) {}
TweenLite.to(currentContainer,3,{alpha:1,delay:2,onComplete:switchClip});)
}
function switchClip() {}
if(index < totImages) {}
index ++;
} else {}
index = 0;
}
if(currentContainer == holder0) {}
currentContainer = holder1;
} else {}
currentContainer = holder0;
}
currentContainer.alpha = 0;
MovieClip (this.root) .swapChildren (holder0, holder1);
loadImage();
}

Thank you and best regards,

Sreelash

Here's some code that should work for you. Note that this is a version stripped of the code class, so all by removing class related Articles, some bugs can be introduced. When the class code worked perfectly.


import flash.display.DisplayObject;
import flash.display.Loader;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.net.*;
import flash.utils.Timer;
import gs.TweenLite;

var xmlURL:String = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/images.xml";
// array of loaded images
// you don't have to reload them every time
// unless you want to free memory
// which will involve additional coding
// and more complex logic
var loadedImages:Array = [];
// array of images urls
var imageURLs:Array = [];
// image loader
var imageLoader:Loader;
// previously displayed image
var prevImage:DisplayObject;
// current image
var currentImage:DisplayObject;
// slide show timer
var showTimer:Timer;
// timer duration
var timerDuration:int = 3000;
// tween duration
var tweenDuration:int = 2;
// index of the current slide
var currentIndex:int = 0;

var myXMLURL:URLRequest = new URLRequest(xmlURL);
var xmlLoader:URLLoader = new URLLoader(myXMLURL);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(myXMLURL);

function xmlLoaded(e:Event):void
{
     // allow for GC
     e.target.removeEventListener(Event.COMPLETE, xmlLoaded);
     processXML(XML(e.target.data));
}

function processXML(xml:XML):void {
     var len:int = xml.children().length();
     // declare variable once
     var tempVar:String;
     for (var i:int = 0; i < len; i++) {
          tempVar = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/" + xml..item[i]..image;
          imageURLs.push(tempVar);
     }
     preload();
}

function preload():void
{
     // preload the rest of the images
     // in this case the logic is that
     // because slide show is automatic
     // it may make sense to have all of them
     // in memory - they are going to be there
     // eventually anyway
     var len:int = imageURLs.length;
     for (var i:int = 0; i < len; i++) {
          imageLoader = new Loader();
          imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPreloadComplete);
          // hold loader in the array - it will be reused
          loadedImages.push(imageLoader);
          imageLoader.load(new URLRequest(imageURLs[i]));
     }
}

function onPreloadComplete(e:Event):void
{
     // prepare for GC
     e.target.removeEventListener(Event.COMPLETE, onPreloadComplete);
     // if timer is not instantiated - show is not started
     // AND first two were preloaded - meaning they have content
     if (!showTimer && loadedImages[0].content &&   loadedImages[1].content ) startShow();
}

function startShow():void
{
     // place first image on display list
     currentImage = loadedImages[0];
     currentImage.alpha = 0;
     addChild(currentImage);
     TweenLite.to(currentImage, 1, { alpha: 1 } );
     // start show timer
     showTimer = new Timer(timerDuration);
     showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
     showTimer.start();
}

function slideTransition(e:TimerEvent):void
{
     // in case sequence is important - don't change
     // current index yet but check against
     // separate variable
     var nextImage:int = currentIndex < loadedImages.length - 1 ? currentIndex + 1 : 0;
     // check if image was loaded
     // if it is not loaded - will wait until next timer event round
     if (loadedImages[nextImage].content) {
          // now we can change current index
          currentIndex = nextImage;
          // place it behind current image
          addChildAt(loadedImages[currentIndex], getChildIndex(currentImage));
          // swap them
          prevImage = currentImage;
          currentImage = loadedImages[currentIndex];
          // show transition
          showCurrent();
     }
}

function showCurrent():void
{
     // make sure they have proper alphas
     prevImage.alpha = 1;
     currentImage.alpha = 0;
     TweenLite.to(prevImage, tweenDuration, { alpha: 0 } );
     TweenLite.to(currentImage, tweenDuration, { alpha: 1, onComplete: removePrevious } );
}

function removePrevious():void {
     if (this.contains(prevImage)) removeChild(prevImage);
}

Tags: Adobe Animate

Similar Questions

  • W/scrolling CF image gallery question

    It is probably the less of a concern for anyone at this stage, but instead of documentation and best practices, I thought I'd ask anyway.  Maybe someone from Adobe will be able to answer.  I think I have eaten every tutorial available on the internet and have not come across this yet.

    As far as I can tell that the variables are not readily available at FC (although MXML might solve that), so I don't know how to build it.

    I am designing a photo gallery, in which images can be the object of a scroll, fainted in out, or something by clicking a button NEXT and PREVIOUS.

    The problem is to know what image is visible at any given time.

    I was able to do this by creating a separate State for each image, then "onclick" - switch to the next (or previous) State.  It does not work perfectly, auto-generated code to make the transition is a little off and then when I go to manually tweak, I just make it worse.

    I guess: is the best way to do it or there at - it a simpler way?

    OR I try to use CF to inappropriately?  Initially, I saw FC as an alternative to learning Flash (I tried for months - seriously), but I realize that the main purpose of the CF appears to be like a high design tool and Flash Builder is intended to inject functionality and add design FC in the workflow.

    We should not see FC as an endpoint?

    Hi there - in the current version of the CF, using States, transitions and interactions you do is the main method we have for the construction of what you try to build. Over time, we want to add more capacity to "generalize" the parts of your design so that they can be reused without manually manage all cases - data lists are a prime example of this, but they do not solve your use case in their current form.

    We have also got a lot of comments on the management of the timeline and looking for ways to make it easier to manage multiple timelines and effects.

    Thank you!

    NJ

  • I need to create an image gallery

    I'm looking for a tutorial that explains how to create a simple AS3 image gallery driven by an XML file.

    The gallery that I need is really simple:

    -a horizontal bar placed on the bottom, containing vignettes that scrolls left and right according to the mouse pointer

    -clicking on a thumbnail of the full image shall be placed above the bar of the thumbnails

    -buttons prev and next image

    -by clicking on the button that opens the Gallery I must be able to pass a variable to the Gallery to load the appropriate xml file (I've got 6 different categories to show)

    That's all I need.

    Do you know where I could find a tutorial?

    use:

    XML.img.@Thumb

    XML.img.@Full

    XML.img.@desc

  • Image gallery light box...

    Hello

    Trying to fit a box light image gallery. I wish that the thumbnails on the screen with captions to be the piece main miniature intro for each category - so thumbnails on screen represent the categories instead of each contained photo. Hope that makes sense!

    It is each cycles miniature category in the other. But, even worse, when I add the other photos in each category - rather than being hidden until the breast of the light box, are also appear as thumbnails on the homepage screen. I would like that they hidden in the cycle of the category.

    Please see my example... How can I hide instance < figure > 2 & 3 of the homepage?

    < section class = "col-lg-4 4-md-col col-sm-6 collar-xs-6" >

    < div class = "thumb-pad9" >

    < div class = "thumbnail maxheight" >

    < figure > < a href="img/sports/swimming.jpg" > < img src="img/sports/swimming.jpg" alt = "Swimming" > < / has > < / figure >

    < figure > < a href="img/sports/tennis.jpg" > < img src="img/sports/tennis.jpg" alt = "Tennis" > < /a > < figure >

    < figure > < a href="img/sports/golf.jpg" > < img src="img/sports/golf.jpg" alt = 'Golf' > < / a > < / figure >

    < div class = "caption" >

    < a href = "#" > category of photographs of Sports < /a >

    < / div >

    < / div >

    < / div >

    < / item >

    So more items to follow for the different categories of photos.

    Ideas or do you know if the online references to one that works the way I describe?

    Thank you very much!

    Had a breakthrough! The main correction I was looking for was to eliminate have rows them of thumbnails... but to keep only a handful of thumbnail to make only 2 rows on the screen in the form of images of coverage for each separate category of images. All I had to do was remove the game secondary code that references the miniatures and the device of light therapy cycles through them perfectly + the greater part of the pictures hidden stay hidden on the homepage - only visible in the Viewer.

    -C' is what I was mainly after; didn't several rows of images. Yay!    Can I pay more later the part where they need will not be executed in the other later.

    Here is another question from code. For some of the JPGs, I want to the clickable to open a PDF document.

    example of how code currently exists for each img... say it is a brochure of several page called Hotel NYC. How can I change the action to achieve this?

    Thank you!

  • HP Photo and imaging Gallery vs HP Photo Creations

    Thank you for the messages in 2011, no wonder I don't think HP Photo and Imaging Gallery, I liked!  It was installed with my HP printer, but now that I have another laptop, the printer will not install this program, but has installed HP Photo Creations, they are certainly not the same thing... as of now, I don't like.  I'm happy for some of the tips.  I printed the pages.  Does anyone know of a program I can do also?

    Hello

    Both programs come from third-party suppliers. From time to time the contracts/agreements between publishers to sellers will expire and according to the contract, a supplier can provide OLD version (s) for its customers. The latest version of HP Photo Creations has many improvements.

    Hope it makes sense.

  • suggestions of jQuery image gallery

    Hello

    Can someone suggest a simple and pleasant to use with dreamweaver CC jquery image gallery?

    I'm looking to do something simple that is on a page.

    With a previous and Next button, caption, perhaps picture number.

    Look no no not a viewer.

    Thank you

    Google for cycle2 - go to the demos page, for starters, l think that there is an example of previous/next, more there are instructions for adding a legend

  • How can I Prepliez my mobile of lightroom image gallery?

    I don't want my image gallery on my tablet to include in the mobile collection of images from LR. How can I disable it?

    I discovered what it was. It was a combination of LR pulling images from my phone and Tablet and there being a summary or a collection of images related to synchronize. I did not see this "Summary" or "across the group" front. It is new with published current updates. I would like to only it if we had the ability to disable this display of collection/group.

    Thanks for all the answers. Each of them has helped limit.

  • Need help with tutorial images Gallery.

    Hi all

    No response from Apex listener Forum... moved here...

    Headset - 2.0.2.133.14.47 apex

    Apex - 4.2.2.00.11

    When you run the image gallery application according to the tutorial, page just show a blank screen with no image upload button.

    Use 22.0 Firefox and Chrome 28.0.1500.72.

    Firebug does not display a script error.

    Has recreated the tutorial on apex.oracle.com with the same result as above.

    http://Apex.Oracle.com/pls/Apex/f?p=4550:1:F4550_P1_COMPANY:HANAMIKE

    Workspace: HANAMIKE

    User name: [email protected]

    Password: yesla


    Using the user name = resteasy_admin password = resteasy_admin on apex.oracle.com.

    Had changed the JS tutorial below:

    var workspace_path_prefix = "resteasy";     = > var workspace_path_prefix = "hanamike";


    Another strange problem was when to try the RESTFUL according to the tutorial service when you click on the button 'TEST', has detected the error 404

    Problem on behalf of space of overtime in the URL as below:

    http://Apex.Oracle.com/pls/Apex/hanamike/hanamike/gallery/images/

    Had to manually change:

    http://Apex.Oracle.com/pls/Apex/hanamike/gallery/images/


    Note that the version of the listener on apex.oracle.com is:

    APEX_LISTENER_VERSION2.0.3.165.10.09


    Thanks in advance.

    Zack


    Post edited by: Zack.L

    Hi Zack,

    Please provide the credentials to connect to your workspace.  I took a quick glance to your RESTful Service and applications associated and noticed that he was missing something - the "Upload Image" button! It seems therefore that the section "Create the gallery app" is not a step to create an HTML region, with the model "Button region without title" of the region and with its region defined as source:

    Download Image

    You will see in the JS that there is a reference to #upload - btn, but there is no object on your page.  I created a copy of your application, which includes this new area of HTML, and you'll see I downloaded an image as a demo.  I contacted the team APEX listener re missing instructions, for which I hope will be fixed in the next version.  My apologies for the confusion, but I hope that you are on the right track now.  Regarding the behaviour you noticed with the URL generated by the 'Test' utility, thanks for that bring to our attention.  I'll do some additional research it and log a bug if necessary.

    Kind regards

    Hilary

  • Create an image gallery full screen with MSO - breaks the other buttons?

    Hi - I am trying to create an image gallery full screen to be accessible from any available via a button.  The ultimate goal is to use my layout as a presentation tool and allow the presenter to have a "Photo Gallery" button on each page, then they would be able to access an image full screen at any time.  Most of my layouts have other buttons, content drop down, etc.  I thought that I had a great idea: create a multi-state of the first State being blank object, and each subsequent State would have an image and also a black box from full screen to a transparency of 50%.  The problem is that now my other buttons are no longer works.  I confirmed that the existing buttons will work if they are willing to be in front of the MSO image gallery, but this isn't a good solution.  Am I missing something or is there an another workaround?  Thank you!

    John

    You must put the buttons within each State of the DSO.

    It isn't really a viable long-term model, you should probably rethink it is also not good from the point of view app performance because it requires the loading of images full screen for each State in memory.

    Neil

  • Reactive blockable image gallery

    Hello

    I want sensitive photos like this

    http://jjexporters.com/collection.html

    Let me know if it jquery plugins available for free download.

    Thank you.

    Checkout

    1. http://codingdroid.com/making-a-awesome-filterable-portfolio-with-jQuery-isotope/
    2. uery.html http://www.jqueryscript.net/gallery/Creating-A-Responsive-Filterable-image-gallery-with-JQ
    3. http://mazeofminds.com/533/filterable-portfolio-powered-by-jQuery/

    These links should give you some progress in taking such a gallery

  • What is the best product for the use of... image gallery to crop, color correct, then re-touching etc.

    What is the best product for the use of... image gallery to crop, color correct, then re-touching etc.

    Hi gardenzio2,

    You can try using Adobe Photoshop

  • Text of the position under CSS image gallery

    I do a basic css image gallery that I learned from W3

    the CSS and HTML is listed below

    I've set up and it works fine, I just want to put some text in the Gallery, I'm not legends sense or under images or something like that... I'm done with the image gallery I want to start a new paragraph.

    I tried just to start a new after the Gallery of images with the < p > tags and it lines up right next to the image gallery. I used the < br > tag and still snaps at his side. I can operate using about 6 < p > tags with them, but I know there must be an easier way, then that, just get under the inbetween image gallery.

    Anyone know how?

    Thank you

    < html >

    < head >

    < style type = "text/css" >

    div.img

    {

    margin: 2px;

    border: 1px solid #0000ff;

    height: auto;

    Width: auto;

    float: left;

    text-align: center;

    }

    IMG div.img

    {

    Display: inline;

    margin: 3px;

    border: 1px solid #ffffff;

    }

    div.img a: hover img

    {

    border: 1px solid #0000ff;

    }

    div.DESC

    {

    text-align: center;

    Police-weight: normal;

    Width: 120px;

    margin: 2px;

    }

    < / style >

    < / head >

    < body >

    < div class = "img" >

    < a target = "_blank" href = "klematis_big.htm" >

    < img src = "klematis_small.jpg" alt = "Clematis" width = "110" height = "90" / > "

    < /a >

    < div class = "desc" > add a description to the image here < / div >

    < / div >

    < div class = "img" >

    < a target = "_blank" href = "klematis2_big.htm" >

    < img src = "klematis2_small.jpg" alt = "Clematis" width = "110" height = "90" / > "

    < /a >

    < div class = "desc" > add a description to the image here < / div >

    < / div >

    < div class = "img" >

    < a target = "_blank" href = "klematis3_big.htm" >

    < img src = "klematis3_small.jpg" alt = "Clematis" width = "110" height = "90" / > "

    < /a >

    < div class = "desc" > add a description to the image here < / div >

    < / div >

    < div class = "img" >

    < a target = "_blank" href = "klematis4_big.htm" >

    < img src = "klematis4_small.jpg" alt = "Clematis" width = "110" height = "90" / > "

    < /a >

    < div class = "desc" > add a description to the image here < / div >

    < / div >

    < / body >

    < / html >

    Add the following code after the last image


    GRAMPS

  • Hierarchical navigation for the image gallery?

    I am trying to create an image gallery of six buildings that users navigate by clicking on the buttons on a map of London. I have two pictures of each of the six buildings. I would like to cycle or cross-fade two images for each of the buildings when users click a button on the map.

    I can get every button on the map for a link to an image - I can't have images to navigate or fade in their separate group once they have done this.

    Is this possible? I'm relatively new to Fireworks and have tried to use symbols, States, and layers, but have not been able to find a solution (maybe it's that I'm missing something).

    Thanks in advance!

    Ok. Create an animation of each picture you want to fade and export it as an animation, you need to do is at the same time. Once you have done this, you can specify animation as image to change in the wizard of Image of Swap. To "Display the image exchanged", choose the Image file and navigate to the location of the registered animated version. Note that the file size of your end for this project will be prohibitive if create you it that way. I strongly suggest you do instead in Adobe Flash.

  • Problems using transitions tweener in image gallery

    Hello

    I'm trying to use the tweener engine to create fade in and out transitions for an image gallery. Thumbnails and original image fade to the top once loaded:

    largeLoader_mc.source="portfolio/large/01Cover.jpg ';
    Tweener.addTween (largeLoader_mc, {alpha: 0, time: 2});

    It works very well. However when I try later to create a fade out / in transition between the images in a function that is called when the user clicks on a thumbnail, the interpolations don't work not (the image always updated very well):

    thumbLoader.addEventListener (MouseEvent.CLICK, loadMainImage);
    function loadMainImage(event:MouseEvent):void {}
    Tweener.addTween (largeLoader_mc, {alpha: 0, time: 2});
    largeLoader_mc.source = thisLargeImage;
    Tweener.addTween (largeLoader_mc, {alpha: 1, time: 2});
    currentTitle_txt.htmlText = thisTitle;
    currentBlurb_txt.text = thisBlurb;
    }

    If I trace the alpha of largeLoader_mc, just 1. largeLoader_mc is an instance of the loader UI component.

    Thanks in advance - any help much appreciated

    I think.

    You can tell the fade on the action once completed to dispatch a new event that could be the appearance.

    The process would be something like this:

    fade in image-> image to swap in alpha = 0-> fade in the image

    This way you do not apply the opposite effect at the same time, I think that is the problem in your script.

    Here is an example of the TweenEvent.MOTION_FINISH:

    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;
    Import fl.transitions.TweenEvent;

    var myTween = new Tween (my_mc, "x", Strong.easeInOut, 100 300, 1, true);

    myTween.addEventListener (TweenEvent.MOTION_FINISH, onFinish);
    function onFinish(e:TweenEvent):void {}
    myTween.yoyo ();
    }

    There is a good tutorial here:

    http://www.republicofcode.com/Tutorials/Flash/as3tweenclass/

    It will be useful.

  • How to create my own image gallery

    I develop an image gallery system based on the web and the search for the right technology to develop.  I am owner of complete Microsoft development environment (aka Silverlight), I am also owner of Adobe Production Premium CS4 (aka Flash CS4). As targeting the environment Linux/BSD is vital to my business model, trust me on this one, Silverlight is not the ideal solution. I know there isn't that Monolight, but this is not ordinary. But as we know, the Flash works on Linux very well, which makes it the ideal solution. In fact Flex is a better option, but I'm working with what I already own.

    All the stuff I see on Flash are really basic stuff of graphic designer. I was wondering if anyone knows of a decent tutorial that would help me to start developing a gallery of images with Flash CS4. 

    Sam

    (that and the help documentation... they are really the only tools I've ever had to use when I need to know something)

Maybe you are looking for

  • Send the Page to the device does not work in Firefox 29

    I got the tab send to add-on device installed for Firefox 4, look forward to the day that he would be included in synchronization. He had always worked for me until I upgraded to Firefox 29. Now, when I right click and select "send this page to devic

  • Downloads blocked

    RE: Downloads blocked I try to download a driver for my laptop and get the following message: "Cannot start Service EHR - this driver has been blocked by a load." My computer is a HP Pavilion dv7 1232nr with Vista Home Premium 64 bit operating system

  • Satellite L555 - 10M - deleted Partition D and HARD drive recovery

    Hi all I deleted my D partition on my laptop also drive HARD recovery. Now my Question is how to retrieve an Image on this Partition? I have a recovery CD and I can start it but it s only a picture for Windows 7 32 bit.If I boot from CD then a warnin

  • Problem with the sum of the elements of cluster

    Hello I have a problem (maybe very simple to solve). I have a cluster with 3 integers inside. I'm building a table of these elements (after unbundling my cluster) and I want to make the sum of all these parts. However, my result is not satisfactory.

  • Cannot install printer on Windows 8.1

    I can't install my printer HP Deskjet all-in-one J610 series on my computer that has Windows 8.1.  A message appears that says can only install to Windows 7.  Please can you tell me how to overcome this problem.  Thank you.