Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:05:55+00:00 2026-05-27T21:05:55+00:00

I almost have this thing the way I want it except when I’m clicking

  • 0

I almost have this thing the way I want it except when I’m clicking forward or backwards through my images, once it hits the array length, the next images doesn’t show. It is only an issue when I add the checkImage() method. Anyone see what I have wrong?

fix**

package 
{

    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.DisplayObject;
    import flash.events.Event;
    import flash.events.MouseEvent;


    import com.greensock.TweenMax;
    import com.greensock.layout.*;
    import com.greensock.loading.LoaderMax;
    import com.greensock.loading.XMLLoader;
    import com.greensock.loading.ImageLoader;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.display.ContentDisplay;
    import com.greensock.loading.data.XMLLoaderVars;


    public class Main extends MovieClip
    {

        public var imgHolder:MovieClip;

        private var ls:LiquidStage;
        private var la:LiquidArea;
        private var xml:XMLLoader;
        private var index:int = 0;
        private var images:Array;


        public function Main()
        {
            arrowRight.alpha = arrowLeft.alpha = .5;
            xmlLoader();
        }

        private function xmlLoader():void
        {
            LoaderMax.activate([ImageLoader]);
            xml = new XMLLoader("assets/data.xml", new XMLLoaderVars()
                                                    .name("loader")
                                                    .estimatedBytes(600000)
                                                    .onComplete(xmlLoaded)
                                                    .onProgress(loadProgress));
            xml.load();

        }

        private function xmlLoaded(e:LoaderEvent):void
        {
            trace("Loaded");
            arrowListeners();
            showImage(index);
        }

        private function loadProgress(event:LoaderEvent):void
        {
            progressMC.progressBar.scaleX = event.target.progress;
        }

        private function showImage(index:int):void

        {
            ls = new LiquidStage(this.stage, 1024, 768, 1024, 768);
            la = new LiquidArea(imgHolder, 0, 0, 1024, 768);

            images = LoaderMax.getContent("loader"); 

            imgHolder.addChild(images[index]);

            TweenMax.from(images[index], 1, {alpha:0});
            la.attach(images[index], {scaleMode:ScaleMode.PROPORTIONAL_OUTSIDE, crop:true});


        }

        // BUTTON FUNCTIONS
        private function arrowListeners():void
        {
            arrowRight.addEventListener(MouseEvent.ROLL_OVER, rollOverArrowHandler, false, 0, true);
            arrowRight.addEventListener(MouseEvent.ROLL_OUT, rollOutArrowHandler, false, 0, true);
            arrowRight.addEventListener( MouseEvent.CLICK, showNext );
            arrowLeft.addEventListener(MouseEvent.ROLL_OVER, rollOverArrowHandler, false, 0, true);
            arrowLeft.addEventListener(MouseEvent.ROLL_OUT, rollOutArrowHandler, false, 0, true);
            arrowLeft.addEventListener( MouseEvent.CLICK, showPrev );
        }

        private function rollOverArrowHandler(e:MouseEvent):void
        {
            TweenMax.to(e.currentTarget, 0.5, {alpha:1});
        }

        private function rollOutArrowHandler(e:MouseEvent):void
        {
            TweenMax.to(e.currentTarget, 0.5, {alpha:.5});
        }

        // CLICK LISTENERS
        private function showNext( e:MouseEvent ):void
        {
            index++
            if (index > images.length - 1) 
            {
                index = 0;
            }

            showImage(index);
        }

        private function showPrev( e:MouseEvent ):void
        {
            index--
            if (index < 0) 
            {
                index = images.length - 1;
            }
            showImage(index);
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:05:56+00:00Added an answer on May 27, 2026 at 9:05 pm

    Several things come to mind:

    1) index is a global variable and a function param – conflicting?

    2) in the checkimage function you pass in ‘index’ but refer to 0 in getChildAt and RemoveChildAt

    3) you don’t call showimage in checkimage if the numchildren > 0 is true

    I’d want to trace into all of this to sort it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I've almost got this thing finished! Many thanks to all who have helped
I'm trying this for almost two hours now, without any luck. I have a
So I have this stinky method, the two conditional blocks do almost the exact
I have been searching for an answer for this for almost a week now,
I have a website that has images with urls like this: http://mysite.com/image1.jpg My server
OKay I lost alsmost the whole day on this. I have a webapp where
I have several input and option elements on my page, each (well almost) have
I have almost the worst spec in the world. An application that exists and
I have almost 800 MB and over 31,000 files in hundreds of subfolders at
I have almost created a website that works in all major browsers flawlessly. Yesterday,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.