views:

201

answers:

2

This is driving me crazy. It seems I cannot use ScrollPane ANYWHERE in my AS3 code without it crashing every dropdown box in the program.

Here is the error message I get when clicking a dropdown box:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.containers::BaseScrollPane/drawBackground()
at fl.controls::List/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::List/scrollToIndex()
at fl.controls::SelectableList/scrollToSelected()
at fl.controls::ComboBox/open()
at fl.controls::ComboBox/onToggleListVisibility()

This happens when clicking ANY dropdown box, regardless of whether or not the code referencing ScrollPane has been executed. The really retarded thing is that I can't even declare a scrollPane var without it causing these errors. IE this:

var x:ScrollPane;

causes all dropdowns to break. And no, I'm not trying to reference x without initializing it. Initializing Scrollpanes using 'new' causes the same problem, as well as casting anything to a ScrollPane.

To get around this, I have been creating scrollpanes directly in the fla and referencing them from AS. This doesn't break the program, and I can access their properties. They even work fine this way.

In short, using the word 'ScrollPane' anywhere in the program breaks it. This is not just my system either. It is happening to at least two other devs I work with.

Any ideas?


edit:

So after scouring the interweb for a while, most people are solving this issue by following bhups suggestions below and adding the component to the library. I'm adding the thing to my main fla from window -> components -> ScrollPane and it indeed shows up in the library. It still doesn't work. I even put one instance on the stage to make sure it had all of the symbols it needed to no avail. Does anyone know of any settings that may be incorrect or anything else I can look at? I will provide any info if necessary.

+1  A: 

ScrollPane doesn't belong to the core libraries of ActionScript-3 so before instantiating or defining a variable of Components classes you need to add that particular component to you library. yo can find components source in (FLASH_INSTALL_DIR/LANGUAGE/Configuration/Component Source) and Components UI in (FLASH_INSTALL_DIR/LANGUAGE/Configuration/Components) folder.

bhups
I need to do this even though I'm importing fl.containers.ScrollPane? Why is this?
SP
So I ended up doing this but I am still having the same problem.
SP
A: 

Did you ever resolve this? I am having the exact same issue, only for Textfields instead of dropdowns. Interestingly enough it works everywhere except on one particular host that has an additional preloader.

Edit: By everywhere I mean that it is a game on multiple sites, and one site has an additional bootstrapper swf to pass some parameters to the game. Also, it is not within an Iframe on this site.

Steve