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 8679027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:52:12+00:00 2026-06-12T20:52:12+00:00

I made a Coverflow class, and everything works fine, but I got one problem.

  • 0

I made a Coverflow class, and everything works fine, but I got one problem. If I click on an item or navigate through the images with the arrow keys I want an image formation like this:

1) What I want

Wanted cover flow item

I got everything working fine on the right side my objects arent placed correctly, they are positioned over each other:

2) What’s wrong

Whats wrong

Now you see on the right side it is kinda fucked up, the images shouldn’t overlap like that, they should be positioned after each other just like on the left side.

3) Code where I build up the images

package be.devine.cp3.itemGroup
{

import com.greensock.TweenLite;
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.MouseEvent;

public class Coverflow extends Sprite
{
    public var images:Array;
    private var _currentImageIndex:int;
    private var imageSize:uint;


    public function Coverflow(images:Array)
    {
        this.images = [];

        for each(var image:DisplayObject in images)
        {
            if(image.width > imageSize)
            {
                imageSize = image.width;
            }
            var imageContainer:Sprite = new Sprite();
            image.x = -1 * (image.width >> 1);
            image.y = -1 * (image.height >> 1);

            imageContainer.addChild(image);
            this.images.push(imageContainer);
        }
        this.currentImageIndex = images.length >> 1;


    }

    private function imageClickHandler(event:MouseEvent):void
    {
        var targ:DisplayObject = event.currentTarget as DisplayObject;
        currentImageIndex = getChildIndex(targ);
    }

    public function display():void
    {
        while(this.numChildren > 0)
        {
            removeChildAt(0);
        }

        var depth:Number = 0;

        for(var i:int = 0; i < images.length; i++)
        {
            var image:DisplayObject = images[i];
            var xPos:Number = 0;
            xPos = (i - _currentImageIndex) * imageSize;

            if(i < _currentImageIndex) { //moet er links van komen -> negatieve x
                image.rotationY = -90; //-45
                depth++;
            } else if(i == _currentImageIndex) {//in het midden            {
                image.rotationY = 0;
                depth = 0;

            } else {//moet rechts komen -> positieve x
                image.rotationY = 90; //45
                depth ++;

            }

            addChild(image);

            TweenLite.to(image,.5, {x:xPos});
            var zPos:int =  (i - _currentImageIndex);
            image.addEventListener(MouseEvent.CLICK, imageClickHandler);

        }

    }

    public function get currentImageIndex():int {
        return _currentImageIndex;
    }

    public function set currentImageIndex(value:int):void {

        value = Math.min(images.length -1, Math.max(0, value));

        if(_currentImageIndex != value)
        {
            _currentImageIndex = value;
            display();
        }
    }

}
}

I already searched on the web, but I can’t find a similar thing about coverflows… I know it has to do something with setting the child index of the images but I have no idea on how to calculate it :). I hope someone can help me out.

  • 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-06-12T20:52:13+00:00Added an answer on June 12, 2026 at 8:52 pm

    I found the solution 🙂
    had to add the image before i changed the child indexes and use setChildIndex instead of addChildAt:

       for(var i:int = 0; i < images.length; i++)
        {
            var image:DisplayObject = images[i];
            var xPos:Number = 0;
            var rY:int = 0;
    
            xPos = (i - _currentImageIndex) * imageSize;
            addChild(image);
    
            if(i < _currentImageIndex) { //moet er links van komen -> negatieve x
                rY = -90;
                setChildIndex(image,  numChildren-1);
            } else if(i == _currentImageIndex) {//in het midden            {
                rY = 0;
            } else {//moet rechts komen -> positieve x
                rY = 90;
                setChildIndex(image, 0);
            }
            TweenLite.to(image,.5, {x:xPos, rotationY: rY});
            image.addEventListener(MouseEvent.CLICK, imageClickHandler);
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Made a custom obj called Item with some string fields and one float. .h
So everything works perfectly, until an ajax call is made and the function is
I've made this jQuery code that toggles class to open and close. but when
Following up on this post , I made a test, but I still got
I got 2 divs, one inside another. <div id=ads_content class=ads_contents> <div id=ads_text class=ads_text> ...
Made this nice little loop for hiding and showing div's, works as a charm
I made a dll in c# but i need to export the functions. Is
I'm using html5 boilerplate and their .ir class. I made the logo clickable, I
How to get multiple images to show up in this coverflow. I am getting
I'm trying to figure out Valgrind usage so I made a simple program but

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.