Photo Gallery ....disable a previous button once it reaches img zero

I have made a simple photo gallery that reads from external XML file. The gallery allows the user to see the next image by clicking the next button as well as the previous image by clicking the previous button.
I need a bit of code that would disable the previous button when its at the first image, and disable the next image once the user is on the last image.
This is what I have thus far:
var xmlRequest:URLRequest = new URLRequest("wImgData.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML;
var imageLoader:Loader;
var rawImage:String;
var rawH:String;
var rawW:String;
var imgNum:Number = 0;
var checkSec:Timer = new Timer(1);
var numberOfChildren:Number;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);
next_btn.addEventListener(MouseEvent.CLICK, nextImgF);
prev_btn.addEventListener(MouseEvent.CLICK, prevImgF);
master_mc.buttonMode = true;
function xmlLoadedF(event:Event):void{
    checkSec.start();
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);
    imgData = new XML(event.target.data);   
function packagedF():void{
    checkSec.start();
    checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
    rawImage = imgData.image[imgNum].imgURL;
    numberOfChildren = imgData.*.length();
    rawW = imgData.image[imgNum].imgW;
    rawH = imgData.image[imgNum].imgH;
    imageLoader = new Loader;
    imageLoader.load(new URLRequest(rawImage));
    master_mc.addChild(imageLoader);
    imageLoader.x = (stage.stageWidth - Number(rawW)) /2;
    imageLoader.y = (stage.stageHeight - Number(rawH)) /2;
function checkerF(event:TimerEvent):void{
    if(imgNum == 0){
        packagedF();
    }else if(imgNum < numberOfChildren){
        imageLoader.unload();
        packagedF();
    }else{
        imageLoader.unload();
        imgNum = 0;
        packagedF();
function nextImgF(event:MouseEvent):void{
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);
    imgNum++;
function prevImgF (event:MouseEvent):void{
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);
    imgNum--;

All you need to do is remove the listeners in the event handlers for the buttons. I'll use previous as an example.
function prevImgF (event:MouseEvent):void{
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);
    imgNum--;
     if(imgNum == 0){
          //at first
          prev_btn.removeEventListener(MouseEvent.CLICK, prevImgF);
You'd do the same to the next button's listener when the imgNum == the number of images. You'll also need to add the previous listener back to the button when they press next.

Similar Messages

  • I need a flash tutorial on Iphone style Scrolling Photo Gallery using Next/previous Buttons

    Here i have attached two sample Fla files of  iphone style scrolling photo gallery using next Previous buttons. Smoothscroller.fla is the  original file download from internet and thumbscroll.fla is the one i m trying to make. But i m getting the actionscript error in the movieclip symbol 2 frame 2 actionscript frame. Can anyone work out on my file & send me the easiest tutorial of flash so that i can complete my portfolio project.
    Mail me ur tutorials at : [email protected]

    Just Google for the Spry photo gallery and you might find
    http://cates-associates.net/tutorials/Tutorial-CS3-Spry.html
    or even a few others.
    Happy Sprying
    Ben

  • Photo Gallery - Next or Previous Button

    Hi,
    I am new to Action Script and I have a small issue that I
    can't seem to figure out...
    Probably very easy for you guys... ;)
    (1)
    I have a Photo Gallery here, kinda like a Photo show and
    under the picture is a 'Next' and 'Previous' button.
    Now when the user will click on e.g. the 'Next' button I want
    the pic shown to change into the next picture.
    I have all my pics in a movieclip all with labels s1, s2, s3
    etc. ....
    I already have the code setup to go to the appropriate
    movieclip but I don't know how to tell Flash via Action Script to
    go to label "s" + 1.... meaning:
    if the picture with the label "s2" is shown right now and the
    user clicks on the 'Next' button Flash need to go to the mc with my
    pics in it and then to the label "s3" --> "s2" + 1
    How do I do that ?
    (2)
    Another thing I was thinking about:
    Let's say I have 7 pics in the photo gallery and user is
    seeing pic # 7 right now (label "s7") and he clicks the 'Next'
    button I need to tell Flash to jump to label "s1" (to the first
    pic) because there is no eigth picture...
    How is that done ?
    Note: I am using Flash 9 CS3 so either AS2 or AS3 is
    welcome...
    Any help is appreciated and I thank you in advance for that
    Mike

    quote:
    Originally posted by:
    CanonBoy
    if you go to here:
    http://www.sapphiremonkey.com/picDemo.zip
    you can download a simple Flash 8 document I made to show you
    the code.
    Kelly
    Kelly,
    thanx for your reply....
    I think we're very close but here's some more info - I
    probably should have stated that earlier... sorry ! ;)
    the thing is a little more complicated and I just wanna make
    sure I use ur code at the right spots:
    So here are the three main objects we're dealing with:
    (1) movieclip next_btn --> contains rollover and rollout
    effects for the Next button as well as an invisible button holding
    the action script for that button
    (2) movieclip 'rollover_mc' --> which will bring a nice
    rollover effect between the pics
    (3) movieclip 'pics_mc' --> contains my pictures in a
    simple timeline with labels s1, s2, s3 etc. and stop actions at
    each frame for each pic
    --> (1) and (2) are on the same level, (3) is nested
    inside of (2)
    when the user clicks (1) the 'Next' button (label: next_btn)
    the cursor in the timeline of (2) the 'rollover_mc' movieclip will
    proceed and produce nice rollover animation from one pic to the
    next pic, having (3) in the midst of the animation go from one pic
    to the next.... at least that's the idea.... ;)
    so the action script for the 'Next' button (label: next_btn)
    right now is:
    on(rollOver){
    gotoAndPlay("m1"); --> rollover effect for the next
    button
    on(releaseOutside, rollOut){ --> rollout effect of the
    next button
    gotoAndPlay("m2");
    on(release){
    this.pics_rollover_mc.gotoAndPlay("p1");
    --> p1 is the label of the frame where the cursor will
    jump to and start the rollover animation --> that works ;) haha
    while the animation is rolling over to the next pic and it is
    just covering the actual picture that was just shown, the cursor
    (runnning through the timeline in the (2) 'rollover_mc' movieclip)
    will hit a key frame with an action script in it...
    and in that action script I need to tell Flash to go to (3)
    the movieclip with my pics in it (label: pics_mc which is nested in
    that timeline) and go from let's say "s2" PLUS ONE to label "s3"
    (the next pic in the series)...
    right now the code in that keyframe is:
    this.pics_mc.gotoAndPlay("s2")
    which means it only shows (after the animation) Pic2 (label:
    s2)
    now the code that you gave does make sense to me but where do
    I need to put which parts ?
    here's your code again:
    stop();
    _global.n = 1;
    _root.next_mc.onRelease = function() {
    n = n+1;
    if (n == 5) {
    n = 1;
    _root.pics_mc.gotoAndStop("s"+n);
    For example, the establishing code for the variable n....
    where do I need to put this code so it is globally valid ?
    I pasted it into the action keyframe of my next_btn, so the
    code looked like this:
    on(rollOver){
    gotoAndPlay("m1");
    on(releaseOutside, rollOut){
    gotoAndPlay("m2");
    _global.n = 1;
    _root.next_btn.onRelease = function() {
    n = n+1;
    if (n == 5) {
    n = 1;
    _root.pics_mc.gotoAndStop("s"+n);
    and it gave me the following error message:
    **Error** Symbol=1.2 next_btn, layer=invisible_btn,
    frame=1:Line 7: Statement must appear within on handler
    _global.n = 1;
    **Error** Symbol=1.2 next_btn, layer=invisible_btn,
    frame=1:Line 8: Statement must appear within on handler
    _root.next_btn.onRelease = function()
    my (amateurish) opinion is that the part
    _root.pics_mc.gotoAndStop("s"+n); has to go into the action
    script keyframe that the cursor will hit when running through the
    timeline in the (2) rollover_mc movieclip
    therefore if u wanna start the animation when u click the
    button u would have to change your code that u paste into the
    next_btn keyframe:
    on(rollOver){
    gotoAndPlay("m1");
    on(releaseOutside, rollOut){
    gotoAndPlay("m2");
    _global.n = 1;
    _root.next_btn.onRelease = function() {
    n = n+1;
    if (n == 5) {
    n = 1;
    _root.pics_rollover_mc.gotoAndPlay("p1");
    I did that but it still gives me the above error message....
    Thanx for your help in advance ! ;)

  • At Photo Gallery is there a button to transport viewer back to my website?

    I don't yet have iLife '08 but my question is:
    RE: Photo Gallery
    I am assuming that in my iWeb website I must place URLs of each photo page that I make.
    Question:
    Once the person is there at the Photo Gallery, is there a button that can get him BACK to my
    Website???????
    — Lorna in Southern California

    In iWeb '08 you select the template "My Albums". When you drop an album of photos onto this page, a new page is created with the photos on it, a slideshow option and button to return to the main albums page. You don't have to create any links.

  • How can I disable the previous button in the first page and the next button in the last page?

    Hi all,
    I have created a new skin for a webhelp by modifying the layout and the buttons. However, I am not able to find a way where in we can
    disable the previous button ini the first page of the webhelp and hte the next page in the last page of the webhelp. If both the next and previous button is visibile in the first and last page, it is sort of misguiding the user.
    I am using Robohelp 9.
    Please advice.
    Thanks,
    Parag

    I think you are mixing Previous and Next in a browse sequence and the Previous and Next that you get in the browser itself.
    In a browse sequence, they are automatically disabled at the start and finish. When in the first topic in the sequence only Next will be enabled, when in the last topic only previous will be enabled.
    Previous and Next in the browser are working on the topics your user has viewed which is not the same thing.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Tutorial for a Spry photo gallery with thumbs and buttons ???

    Anyone know of a a tutorial for building a Spry photo gallery with both thumbnails and next, previous, stop and play buttons(functions)  ???
    Like the ones on Adobe's Photo Gallery demos; http://labs.adobe.com/technologies/spry/demos/pe_gallery.html
    Adobe show the source for their Photo Gallery Demos, but that doesn't help me much ... I need a prober tutorial that tells me how to do : ) 
    The only tutorial that I've been able to find, is one for Dreamweaver 8, without buttons - I'm looking for a updated version.
    I appreciate any help very much. Thank you.

    Just Google for the Spry photo gallery and you might find
    http://cates-associates.net/tutorials/Tutorial-CS3-Spry.html
    or even a few others.
    Happy Sprying
    Ben

  • Trying to disable my Submit button once if i click submit

    Hi
    I am tryign to diable my Save button once if i click save button,
    i written the code as follows, but its disablign once if i click save and immediately its enabling again.
    this is my java script code.......
    document.getElementById("xx").disabled=true;           
         frm.submit();     
    <input type="button" id="xx" value="SaveAccount" onclick="doProcessForm();"/>
    plz help me.
    Thanks
    Venaktesh

    Well, it seems like once you get the response back, the submit button is enabled again and it wud happen unless you explicitly disable it again in some onload method..(if you want it to get it permanently disabled for further clicks)..
    So, you need to have a hidden field like below in your form
    <INPUT TYPE="hidden" NAME="FirstTime" value="<%=FirstTime%>">and in the function, where your form gets submitted, change it to value
    document.getElementById(FirstTime).value = "N";and in the onload function depending on the value of FirstTime, enable/disable the submit button.

  • Previous Button applying previous adjustments to multiple photos for some reason

    So yesterday I was editing tons of photos, using the Previous Button once at a time to add the previous photo's adjustments to the next selected photo and everything was a great.
    Today I hit Previous and the selected photo AND every photo after it gets adjusted.
    What could I have possibly hit to change the behavior of the button?
    Thanks!

    No, to the left of the Sync button is a button that says Previous. It's a pretty popular feature. If you only have one image selected it becomes an active clickable button and applies any adjustments from the last photo you messed with to the currently viewed photo. Sort of like a single one at a time sync. It randomly stopped behaving the way it's supposed to (after 48 hours or so of working the right way) and started working more like the Sync button and I'm trying to find out what could have changed and get it back to working right.

  • Photo gallery with buttons and php.

    I am relatively new to actions script, very new to as3, and brand new to php. I have tried very hard to figure all of this out via tutorials, studying the code, etc but now I'm running out of time to get this done so I need some help.
    I am trying to make a photo gallery that functions as follows:
    -the php gathers all of the filenames from a folder and returns it to flash
    -an array of buttons is loaded onto the stage (one for each photo)
    -flash then loads the first image into a movie clip.
    -when the user clicks on button[i], image[i] loads in the movie clip.
    -i also plan to incorporate what might happen if the number of photos exceeds the number of buttons that can fit nicely on the stage, like an arrow to go to another set of buttons. I haven't tried coding this yet since I was just trying to get the thing to work in general first. If anyone has ideas about this, let me know.
    Please don't make fun of me too much. I know it's probably a mess.
    Thank you so much in advance for your help.
    Here's the php:
    <!--
    Author:      Adam Ehrheart
    Site:      http://adamehrheart.com
    Blog:      http://flashcamp.net
    Date:      4.21.08
    -->
    <?php
    #   Use "." if the get_files.php file resides in the same directory as files being read
    #   Otherwise you can change the path to whatever you like
    #   eg:
    #   Same Directory:
    #   $path = ".";
    #   Other Directory
    #   $path = "products/images/"
    $path = "Photography/";
    #   Choosing what directory to read
    if ($handle = opendir($path)) {
       #   Temporary array to hold image files
       $imageFiles = array();
       #   Creating loop and assigning current file to $file temp variable
       while (false !== ($file = readdir($handle)))
          #   Checking wheter or not the file is invisible and starts with a "."
          $fileCheck = substr($file, 0, 1);
          #   Checking to make sure the files is either a (jpg, JPG, png, PNG)
          $fileType = substr($file, -3);
          #   Making sure file is not invisible
          if($fileCheck != ".")
             #   Making sure file is readable and dynamically loadable by Flash
             if($fileType == "jpg" || $fileType == "JPG" || $fileType == "png" || $fileType == "PNG")
                #   Adding File to the image array
                if($path != "."){
                array_push($imageFiles, $path . $file);
                }else{
                   array_push($imageFiles, $file);
          #   Sorting the files alphabetically
          sort($imageFiles);
       #    Creating XML File output to be read by Flash
       echo "<?xml version=\"1.0\"?>\n";
       #   Root Node
       echo "<image_list>";
       #   Creating child nodes for each image
       foreach($imageFiles as $value)
          #   Pulling the Width and Height values for each file and adding them as attributes for the image node
          list($width, $height) = getimagesize($value);
          #   Creating the image node
          echo "<image width=\"$width\"" . " height=\"$height\">" . $value . "</image>";  
       echo "</image_list>";
       #   Closing the readdir function
       closedir($handle);
    And here's the as3:
    //php photo section
    import flash.events.Event;
    import flash.net.*;
    //load the php file
    var myRequest:URLRequest = new URLRequest("Photography.php");
    var myLoader:URLLoader = new URLLoader();
    //define images variable as an xml file
    var images:XML = new XML();
    images.ignoreWhite = true;
    images.addEventListener ('load', myLoader);
    //define the images variable as an xml as the php file result
    myRequest.data = images;
    //outputting the filenames
    function onLoaded(evt:Event):void {
      trace("here we get the data back: "+myLoader.data);
    //when the data is loaded, begin myRequest
    myLoader.addEventListener(Event.COMPLETE, onLoaded);
    myLoader.load(myRequest);
    //array to call the images
    var imageArray:Array //= NewArray();
    var listLength:Number;
    var il:XMLList = images.data  //xml.images;
    listLength=il.length();
    var i:Number
    var photo_btn:Array = new Array();
    for (i = 0; i < listLength; i++); {
    imageArray[i] = il[i].pic //xml.images[i].pic;
    if (photo_btn[i].mouseDown == true) {
    img_loader.load(imageArray[i])
    if (i == 0)  {
    photo_btn[i].y = 422.7;
    photo_btn[i].x = 411.5
    else if (i > 0 && i < 24); {
    photo_btn[i].y = 422.7;
    photo_btn[i].x = (photo_btn[i-1].x + 18.6);
    if (i > 24 && i < listLength); {
    photo_btn[i].y = 442.7;
    photo_btn[i].x = (photo_btn[i-1].x + 18.6);
    img_loader.load(imageArray[0]);

    As for AS3 part of it, I am not sure your code really works. There are syntax and logical errors there.
    I think you need to take it step by step and accomplish several task in the following sequences:
    1. Write code that loads XML correctly;
    2. Write code that enables buttons;
    3. Write code that will load images on button clicks.
    The code below shows in principal what needs to be done in order to load XML and make the data in this XML available for further consumption. Also, by accomplishing this step you will iron out all the PHP vs Flash wrinkles including your XML.
    Please note, I don't know your XML structure so all the parsing issues you need to resolve yourself.
    Once you get handle on it - we, hopefully, will talk about steps 2 and 3.
    import flash.display.Loader;
    import flash.events.*;
    import flash.net.*;
    var images:XML;
    var myRequest:URLRequest;
    var myLoader:URLLoader;
    // list of image urls that will come from loaded XML
    var imageList:XMLList;
    myRequest = new URLRequest("Photography.php");
    myLoader = new URLLoader();
    myLoader.addEventListener(Event.COMPLETE, onFileLoaded);
    // suggested handler for unexpected errors - avoids some headaches
    myLoader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    myLoader.load(myRequest);
    // Note: all the listeners are removed
    // it is always wise to remove listeners that are needed any longer
    // to make objects eligible for arbage collection
    function onLoadError(e:IOErrorEvent):void
         trace(e.toString());
         myLoader.removeEventListener(Event.COMPLETE, onFileLoaded);
         myLoader.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    function onFileLoaded(e:Event):void
         myLoader.removeEventListener(Event.COMPLETE, onFileLoaded);
         myLoader.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
         images = new XML(myLoader.data);
         // only now xml is ready and you can start loading images
         imageList= images.pic;

  • Photo gallery buttons don't work on new Chrome, Safari

    Hi
    I just upgraded my Mac and the Photo Gallery module's Next, Previous and Close buttons do not work.
    see sample.
    http://stsstone.businesscatalyst.com/gallery-by-applications
    works fine on Firefox.
    Any clue?
    Thanks
    Micha

    Found a solution.
    If you find that the bottom links do not work properly it's because of the links floating to the right and nothing clears the float.
    add:
    #bottomNav { clear:both }
    fixed in Chrome and Safari
    Cheers
    Micha

  • Next previous button in gallery

    Hi guys, been a while, hope everyone is well.  I am having a problem implementing a next/previous button on an image once it has been enlarged in my gallery.  I have done it in pure as3 but all tutorials seem to use the timeline.  I will post my code underneath so you can see what I am up too.  The next/previous button should I think be added to the modelClicked function.
    From what I understand, I will get a next/previous button and turn them into a button object.  I will then delete them from my stage and instantiate them within the class below.  I would then add them to the modelClicked function with events tied to them.  What should I then do in these events to make it fit in with the code below?
    Any advise appreciated,
    Cheers
    Nick
    package classes.models
        import flash.display.Bitmap;
        import flash.display.Loader;
        import flash.display.MovieClip;
        import flash.display.Sprite;
        import flash.geom.Rectangle;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import flash.net.URLRequest;
        import eu.flashlabs.ui.BasicButton;
        import classes.ui.StateClip;
        import classes.ui.Placeholder;
        import classes.utils.URLUtil;
        import classes.vo.ModelsStates;
        import fl.containers.ScrollPane;
        import fl.controls.ProgressBar;
        import com.greensock.TweenLite;
        public class IndividualModel extends StateClip
            // CONSTANTS
            private static const PADDING_TOP:Number= 28;
            private static const PADDING_LEFT:Number= 50;
            private static const COLS:int= 4;
            private static const ROWS:int= 8;
            private static const GAP_HORIZONTAL:Number= 5;
            private static const GAP_VERTICAL:Number= 5;
            // MEMBER VARIABLES
            private var _data:XML;
            public function get data():XML
                return _data;
            public function set data(value:XML):void
                setData(value);
            private var items:Array;
            private var backBtn:BasicButton;
            private var itemsHolder:MovieClip;
            private var loadIndex:int;
            private var sp:ScrollPane;
            private var clonedBitmap:Bitmap;
            private var originalBitmap:Bitmap;
            private var rect:Rectangle;
            private var screen:Sprite = new Sprite();
            public function IndividualModel()
                super();
                items = [];
                addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
            private function addedToStageHandler(event:Event):void
                initChildren();
            private function initChildren():void
                itemsHolder = new MovieClip();
                addChild(itemsHolder);
                sp = getChildByName("mc_pane") as ScrollPane;
                backBtn = getChildByName("btn_back") as BasicButton;
                backBtn.addEventListener(MouseEvent.CLICK, backBtn_clickHandler);
                screen.graphics.beginFill(0x111111, .75);
                screen.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
                screen.graphics.endFill();
            public function destroy():void
                clearItems();
            // PUBLIC INTERFACE
            // LAYOUT
            private function clearItems():void
                while (items.length > 0)
                    var item:ModelsItem = items.pop() as ModelsItem;
                    itemsHolder.removeChild(item);
                    item.destroy();
            private function populateItems():void
                for (var i:int = 0; i < Math.min(COLS * ROWS, data.picture.length()); i++)
                    var item:ModelsItem = new ModelsItem();
                    item.data = data.picture[i];
                    item.x = PADDING_LEFT + (i % COLS) * (ModelsItem.ITEM_WIDTH + GAP_HORIZONTAL);
                    item.y = PADDING_TOP + Math.floor(i / COLS) * (ModelsItem.ITEM_HEIGHT + GAP_VERTICAL);
                    /*item.addEventListener(MouseEvent.CLICK, modelClicked);*/
                    itemsHolder.addChild(item);
                    /*item.mouseEnabled = false;*/
                    sp.source = itemsHolder;
                    items.push(item);
                sp.verticalScrollPolicy = "on";
                sp.horizontalScrollPolicy = "off";
                sp.update();
            // PICTURE LOADING
            private function loadNextPicture():void
                if (loadIndex < items.length)
                    var loader:Loader = new Loader();
                    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadNextPicture_completeHandler);
                    var item:ModelsItem = items[loadIndex] as ModelsItem;
                    loader.load(new URLRequest(URLUtil.getURL([email protected]())));
                    /*item.mouseEnabled = true;*/
            private function loadNextPicture_completeHandler(event:Event):void
                event.target.removeEventListener(Event.COMPLETE, loadNextPicture_completeHandler);
                ModelsItem(items[loadIndex]).bitmap = event.target.content as Bitmap;
                ModelsItem(items[loadIndex]).addEventListener(MouseEvent.CLICK, modelClicked);
                loadIndex++;
                loadNextPicture();
            // EVENT HANDLERS
            private function backBtn_clickHandler(event:MouseEvent):void
                state = ModelsStates.HIDDEN;
            private function modelClicked(e:MouseEvent):void
                stage.addChild(screen);
                var item:ModelsItem = e.currentTarget as ModelsItem;
                originalBitmap = item.bitmap;
                clonedBitmap = new Bitmap(originalBitmap.bitmapData.clone());
                stage.addChild(clonedBitmap);
                rect = originalBitmap.getBounds(stage);
                clonedBitmap.x = rect.x;
                clonedBitmap.y = rect.y;
                clonedBitmap.width = rect.width;
                clonedBitmap.height = rect.height;
                clonedBitmap.smoothing = true;
                TweenLite.to(clonedBitmap, 1, { x: (stage.stageWidth - originalBitmap.width) / 4, y: (stage.stageHeight - originalBitmap.height) / 6, onComplete:zoomInFinished, scaleX: 1, scaleY: 1 });
            private function zoomInFinished():void
                trace("Zoom In Finished");
                stage.addEventListener(MouseEvent.CLICK, mouseClicked);
            private function mouseClicked(e:MouseEvent):void
                TweenLite.to(clonedBitmap, 1, { x: rect.x, y: rect.y, onComplete:zoomOutFinished, width: rect.width, height: rect.height});
                stage.removeEventListener(MouseEvent.CLICK, mouseClicked);
            private function zoomOutFinished():void
                trace("Mouse Clicked");
                stage.removeChild(screen);
                stage.removeChild(clonedBitmap);
            // GETTERS & SETTERS
            private function setData(value:XML):void
                _data = value;
                clearItems();
                populateItems();
                loadIndex = 0;
                loadNextPicture();
                state = ModelsStates.SHOWN;
            // UTILS
            override protected function animateInComplete():void
                super.animateInComplete();
                switch (state)
                    case ModelsStates.SHOWN :
                        break;
                    case ModelsStates.HIDDEN :
                        break;

    I don't actually know how you're loading your data.  It's also very difficult to figure out what's happening in your code, since you're extending Classes you don't show. What I can tell you is that you need to store the data about iterating each collection at the level where it's needed. You may want to look at the composite pattern http://www.as3dp.com/2007/05/composite-pattern-book-part-1/ .
    In my opinion, the biggest problem you have is poor separation of concerns--you call things Models that are clearly Views, and because you are storing relevant data in Views rather than simply using your Views to represent data, you're making the task of representing and iterating through your data much harder than it needs to be.
    The ideal structure would be a data structure that has data for each thumbnail in some sort of collection, like an Array or Vector. This data structure would only be responsible for storing the data and maintaining a pointer to the currently selected thumbnail.  When the pointer changes, the data object dispatches a change event, so Views that care about this pointer can update. Each piece of data could then have a member variable that is one of these collections that manages the correct pointer.  That's where the composite pattern comes in.
    Now, the task of building your Views becomes much easier. You have one View that gets a collection and shows all the thumbnails and one View that gets a specific thumbnail, mix and match as needed. The Views, again watch the change event and do whatever they need to do when the pointer changes.
    At this point, who sets the pointer ceases to matter. It can be inside one of your Views or outside any of your Views--when the pointer changes, the View that is watching that particular collection will update, and if the result of that update is that a nested View then watches a different collection, that's ok--it still follows the same principles.

  • Help with buttons in photo gallery

    Hello all
    I am trying to find a more effeicent way to place buttons on each of my pages (Photo Gallery SIte). I have 150 pages and constantly have to link each button to the "next" or "last" button. Is there a more efficent way to for me to ad butons to each page.My site is Blazinginterest.com
    Please give me some feedback on my site, possibly add a picture viewer?
    Thank you, HD

    what code do you already have? Maybe we can help you modify
    it where it's not working.
    Also, how do you have it currently laid out? eg. do you have
    several images on the screen, but some method to scroll through
    other images? Have you done a search here or on director-online.com
    (in the forum or articles section) on similar questions? Do you
    have something written up to describe what features you need such
    as a design document?
    Just trying to get a sense of your level of programming in
    general, experience with Director and what planning/details you
    have worked out so far because there are so many different ways to
    program a gallery.

  • Buttons Not Working in Photo Gallery

    Hello,
    I set up a photo gallery that uses transition effects. The
    JPEG will load with the transition effect but when I try to use the
    thumbnails nothing happens. I think there is something wrong with
    the thumbnail code.Thanks, WonderWendy

    since your "button" is a movieclip, try modify the script for
    button_mc
    button1_mc.onRelease = function(){
    this._parent.image_mcl.loadClip("image1.jpg", image_mc);
    }

  • Need Help Removing XML Photo Gallery on Button Click

    Hi, I'm new to flash so this might seem like a dumb question, but I'm right in the middle of designing a photography site and need some help.  I have 4 buttons in my timeline that go to the corresponding frame labels when clicked, above each frame label is a keyframe with actionscript applied to it, that will load an external XML photo gallery. I need the current photo gallery that's on the screen to disappear when I click on a new button to load the new XML photo gallery.  this is the code that will be above each frame label with a few changes, then below this is the code for my buttons. Any help is greatly appreciated. Thank you  Code: Select all var imageX:XML; var imageList:XMLList;  var canvas:MovieClip = new MovieClip(); var picLoader:Loader; addChild(canvas); canvas.x = -155; canvas.y = 160;   var req:URLRequest = new URLRequest("gallery.xml"); var imageLoader:URLLoader = new URLLoader(); imageLoader.addEventListener(Event.COMPLETE, onComplete); imageLoader.load(req);  function onComplete(e:Event):void { imageX = new XML(imageLoader.data); imageList = imageX.image; picLoader = new Loader(); picLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, imageLoaded); picLoader.load(new URLRequest (imageList[0].url)); }  function imageLoaded(e:Event):void  { canvas.addChild(picLoader); }    Code for the buttons in different keyframe.  Code: Select all stop();  kids_btn.addEventListener(MouseEvent.CLICK,onKidsClick); couples_btn.addEventListener(MouseEvent.CLICK,onCouplesClick); portraits_btn.addEventListener(MouseEvent.CLICK,onPortraitsClick); bellies_btn.addEventListener(MouseEvent.CLICK,onBelliesClick);  function onKidsClick(e:MouseEvent):void { gotoAndStop("kids"); }  function onCouplesClick(e:MouseEvent):void { gotoAndStop("couples"); }  function onPortraitsClick(e:MouseEvent):void { gotoAndStop("portraits"); }  function onBelliesClick(e:MouseEvent):void { gotoAndStop("bellies"); }

    Hi, I'm new to flash so this might seem like a dumb question, but I'm right in the middle of designing a photography site and need some help.  I have 4 buttons in my timeline that go to the corresponding frame labels when clicked, above each frame label is a keyframe with actionscript applied to it, that will load an external XML photo gallery. I need the current photo gallery that's on the screen to disappear when I click on a new button to load the new XML photo gallery.  this is the code that will be above each frame label with a few changes, then below this is the code for my buttons. Any help is greatly appreciated. Thank you  Code: Select all var imageX:XML; var imageList:XMLList;  var canvas:MovieClip = new MovieClip(); var picLoader:Loader; addChild(canvas); canvas.x = -155; canvas.y = 160;   var req:URLRequest = new URLRequest("gallery.xml"); var imageLoader:URLLoader = new URLLoader(); imageLoader.addEventListener(Event.COMPLETE, onComplete); imageLoader.load(req);  function onComplete(e:Event):void { imageX = new XML(imageLoader.data); imageList = imageX.image; picLoader = new Loader(); picLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, imageLoaded); picLoader.load(new URLRequest (imageList[0].url)); }  function imageLoaded(e:Event):void  { canvas.addChild(picLoader); }    Code for the buttons in different keyframe.  Code: Select all stop();  kids_btn.addEventListener(MouseEvent.CLICK,onKidsClick); couples_btn.addEventListener(MouseEvent.CLICK,onCouplesClick); portraits_btn.addEventListener(MouseEvent.CLICK,onPortraitsClick); bellies_btn.addEventListener(MouseEvent.CLICK,onBelliesClick);  function onKidsClick(e:MouseEvent):void { gotoAndStop("kids"); }  function onCouplesClick(e:MouseEvent):void { gotoAndStop("couples"); }  function onPortraitsClick(e:MouseEvent):void { gotoAndStop("portraits"); }  function onBelliesClick(e:MouseEvent):void { gotoAndStop("bellies"); }

  • How to create a dynamic button to download a photo gallery in Adobe Muse?

    I need to create a gallery in Muse, so far so good, but when each photo was displayed automatically would have to see a download option that picture, ie, individual download each photo gallery. Is how to do this? Is there a script for Adobe Muse or widgets?
    I thank your attention !!

    Hi Terry,
    As I already said, this is really a helpful tutorial to me.
    I have one question though. Is it possible to make a dropdown menu that gets triggerd by pushing only the menu button itself and not the whole header? It doesn't seem possible to me, as the accordion panel has to be the same size as the menu. I can't think of any solution but to align a small menu to the side of the screen, which would not be my first choice to do.
    Any workaround suggestions are welcome!
    Thanks in advance!

Maybe you are looking for