Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Actionscript 2 List Box help

Posted on 2004-04-09
3
Medium Priority
?
1,687 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
[X]
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
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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. …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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.

730 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