Solved

Actionscript 2 List Box help

Posted on 2004-04-09
3
1,683 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 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

Technology Partners: 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

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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.
Suggested Courses

628 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