Solved

Actionscript 2 List Box help

Posted on 2004-04-09
3
1,675 Views
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;
      titleFix();
      windowBuild(myIndex);
      _root.n = listBox1.getSelectedIndex();
      listBox1.setScrollPosition(_root.n);        //////  area in question
     } else {
      _root.n = _root.n + 1;
      if(listBox1.getSelectedIndex() == _root.menuMax){
            listBox1.setSelectedIndex(0);
            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
      titleFix();
      windowBuild(myIndex);
     }
}


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...


rp
0
Comment
Question by:rascalpants
  • 2
3 Comments
 
LVL 22

Author Comment

by:rascalpants
ID: 10792820
here is a link to what I am talking about:

http://www.rascalpants.com   <--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...


rp
0
 
LVL 2

Accepted Solution

by:
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 :)

hth
-h
------------
http://www.quillem.com
0
 
LVL 22

Author Comment

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

rp

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now