Actionscript 2 List Box help

Posted on 2004-04-09
Last Modified: 2012-05-04
I have built a simple application that uses a list box and a window component to display external SWFs.  Using code that calls a setInterval inside of a function every 7 seconds, the list box index will go to the next item and also change the content of the window compenent to the corresponding information.

Here is my problem...  the list box has room for 4 items to be shown before you must scroll, and when the function (with the setInterval) advances to the 5 item, you cannot see it...

I tried placing a "setScrollPosition" inside the function that builds everything, but I don't think that works properly in version 7 and actionscript 2.0

here is the code that is in the function:

windowSwitch = function(evt){
     if (evt == "click"){
      myIndex = listBox1.getSelectedItem().data;
      _root.n = listBox1.getSelectedIndex();
      listBox1.setScrollPosition(_root.n);        //////  area in question
     } else {
      _root.n = _root.n + 1;
      if(listBox1.getSelectedIndex() == _root.menuMax){
            myIndex = listBox1.getSelectedItem().data;
            _root.n = 0;
      } else {
            var gsi = listBox1.setSelectedIndex(_root.n);
            myIndex = listBox1.getSelectedItem().data;
      listBox1.setScrollPosition(_root.n);        //////  area in question

again, everything is working fine, except for the "auto scroll"  when this function is called...  

what type of code should I be using instead of setScrollPosition() to automatically scroll the list box when this function is called...

this is fairly urgent, so I will give an extra 500 points to anyone who can point me in the right direction...

Question by:rascalpants
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 22

Author Comment

ID: 10792820
here is a link to what I am talking about:   <--delete this space-->     /flash/menu_sys/index.asp

when the menu advances down to the 5th item, I want the list box to auto scroll so that is it seen...  and when it goes back to the top item, I need it to scroll back up again...

thanks in advance...


Accepted Solution

hansblix earned 500 total points
ID: 10796087
//A basic example
function blah()
      test_lb.vPosition = vpos;
      test_lb.selectedIndex = vpos++;
vpos = 0;
test_lb.selectedIndex = vpos++;
interval = setInterval(blah, 2000);

The effect you want (where it starts scrolling from the last item) can be achieved with some tinkering :)

LVL 22

Author Comment

ID: 10805434
I was able to implement your code...  thanks...



Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Updating Flash Player with GPO 3 367
Adobe Flash Install via GPO - Remove Prior Versions From GPO? 1 177
System Center Configuration Manager 2012R2 7 101
type of website 13 53
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question