0
votes

I have a confusing ScrollPane issue that I hope someone has encountered before!

I have a movie clip called Inner_Area, which gets a number of other smaller movie clips loaded into it. The end effect is that it looks like a list of strings.

After the Inner_Area movieclip is populated with its additional information, I set the source of a ScrollePane object to it.

scroll_area.source = Inner_Area;

When I play the movieclip, the list loads up successfully, and a scroll bar appears on the right hand side. This is where the strange part happens.

If I click the scroll down arrow, to try to see the items at the bottom of the list, the Inner_Area actually seems to scroll to the RIGHT. Not down at all. I've looked over my actionscript and I cannot for the life of me see how this could be.

I've not included any code, of course, because I am initially hoping that someone may have experienced a similar situation before. How can I get a scrollpane area such that when you scroll down, it actually goes down instead of in a different direction?

Any hints, tips, or advice is much appreciated!

Some Code:

public class MenuBackground extends MovieClip 
{
    scroll_area = new ScrollPane();
    scroll_area.x = -275;
    scroll_area.y = -77;
    scroll_area.width = 250;
    scroll_area.height = 175;

    addChild(scroll_area);

    inner_area = new Inner_ZoneScrollArea();

    spacing = 0;

    for (i= 0; i < numthings; i++)
    {
    _field = new _Field();
    _field.y = spacing;
    spacing = spacing + 20;

        inner_area.addChild(_field);
    }

    scroll_area.source = inner_area;
}

And in a different file, is the _Field code:

public function _Field() 
{
     _Format = new TextFormat();
    _Format.size = 16;

    _TextField = new TextField();
    _TextField.x = 50;
    _TextField.y = 4;
    _TextField.textColor = 0xFFFFFF;
    _TextField.defaultTextFormat = _Format;
    _TextField.autoSize = "left";
    _TextField.multiline = true;  // Just added these last two on suggestion in this thread

    _TextField.text = "Name"; // some text

    addChild(_TextField);
}
2
I don't believe that this is a common issue. I suggest you post some code.Marcela
Good call, I just added some sample code. Thanks for commenting!mherr
I created a test using your code, substituting Inner_ZoneScrollArea with a MovieClip because you didn't post the code for it. Once I changed the name of your TextField instance to something other than the same name as the class (please, never do that) it worked just fine.Marcela
Thanks very much for your time. Unfortunately, using the same name as the class type was just a mistake when I made the example. It didn't exist in my actual code. But, if it works fine for you, then that tells me that there is something outside of this code that is the problem, and could lead me towards the solution. Thanks very much.mherr

2 Answers

1
votes

not sure if you have got this one fixed yet mate but I think I had a similar issue trying to add Dynamic content to a ScrollPane if your having an issue with the scrollbars not coming up you need to do an update to the ScrollPane I had to put mine on a Timer so that it gave the content time to append and then update. like so

var timer:Timer = new Timer(3000,1);

timer.addEventListener(TimerEvent.TIMER, updateEvent);
timer.start();

function updateEvent(e:TimerEvent):void
{
   ScrollPane.update();
   timer.stop();
}

hope this helps any one else with a similar issue loading Dynamic content into a ScrollPane

0
votes

The following simple example produces a ScrollPane that scrolls down:

var tf:TextField = new TextField();
tf.text = "Lorem \nIpsum dolor \nsit amet \nthese are \nmany\nmany \nmany \nmanylines of \ntext"; 
tf.autoSize = "left";
tf.multiline = true;

var sp:ScrollPane = new ScrollPane();
sp.source = tf;
addChild(sp);