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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:40:18+00:00 2026-05-11T17:40:18+00:00

I have a flashlite3 application with navigation consisting of icons the user can browse

  • 0

I have a flashlite3 application with navigation consisting of icons the user can browse left or right through infinitely.

The basic algorithm i’m using now works (and is adequate for this project) however, part of the solution depends on a duplicate of the array of icons. Depending on the number of items in the array, and/or the size of the element contents, this solution could become less efficient. I’m interested in a solution or algorithm(in any language) that could achieve the same thing while being scalable & efficient.

Heres a portion of relevant code in the setter function for mutating the ‘_selectedItem’ property, which:

  1. Evaluates the current ‘_selectedItem’ and the new ‘_value’
  2. Based on step 1 pop,unshifts right, or shift,pops left
  3. Repeats step 2 until the icon matching the ‘_selectedItem’ is in the center of the array

This code runs using 3 arrays:

  1. [static] Array of positions. There are 5 icons, 3 are visible at a time, so position 0 is off stage, position 1 is 1/3, position 2 is 1/2 ..
  2. When instantiating the icons 2 arrays are created: _viewArray & _icons. The order of _viewArray mimics the order to be displayed and _icons is left alone and used for the loop condition checking

///Actionscript2///

    public function set selectedItem(value:Number)
    {
        var w=Stage.width;

        if(value > _icons.length-1)
        {
            value=0;
        }else if(value < 0)
        {
            value=_icons.length-1;
        }

        if(value > _selectedIndex)
        {
            while(_viewArray[Math.floor(_icons.length*.5)] != _icons[value])
            {
                var element;
                element=_viewArray.pop();
                _viewArray.unshift(element);
            }
        }else if(value < _selectedIndex)
        {
            while(_viewArray[Math.floor(_icons.length*.5)]!=_icons[value])
            {
                var element;
                element=_viewArray.shift();
                _viewArray.push(element);
            }           
        }




        for(var i:Number=0;i<_viewArray.length;i++)
        {
            if(i>=1 && i<= _icons.length-2)
            {
                _viewArray[i]._visible=true;
            }else
            {
                _viewArray[i]._visible=false;
            }
            Tweener.addTween(_viewArray[i],{_x:positions[i],_alpha:80,time:.5,transition:'elasticIn'})
        }


        Tweener.addTween(_icons[(_viewArray.length*.5)-1],{_alpha:100,time:.0,transition:'elasticIn'});
        Tweener.addTween(_selectedServiceIndicator,{_alpha:0,time:.3,transition:'elasticIn',onComplete:function() {Tweener.addTween(this,{_alpha:100,time:.2,transition:'elasticIn'});}});

        var eventObject:Object = {target:this, type:'SelectedItemChange'};
        eventObject.value=value;

        for(var key in _serviceData[value])
        eventObject[key]=_serviceData[value][key];

        dispatchEvent(eventObject);
        _selectedIndex=value;
    }
  • 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-11T17:40:18+00:00Added an answer on May 11, 2026 at 5:40 pm

    Why does each element of the _viewArray has to actually store the icon, rather than only the index into the _icons array? This way you only have the icons stored once, and _viewArray just stores their presentation order.

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

Sidebar

Related Questions

I have made a flashLike button with jquery via this code: $(document).ready(function() { $('#navigation
Have got a method which returns IEnumerable<User> which I have been using Linq /
Have started working my way through a book called WebGL: Up and Running, which
have on question about the Zend Framework 2. In my Application i have a
Have a look at this JSFiddle: http://jsfiddle.net/kZ3Af/25/ I have the base navigation pinned down
Have spent the morning on the examples page, and can't seem to spot why
Have an app that can use tts to read text messages. It can also
Have such a problem, hope you'll help me.. Can't find anywhere. Here is the
have a little question concerning image icons in java and how to put a
Have a n-tire web application and search often times out after 30 secs. How

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.