PDA

View Full Version : [AS3] ScrollPane issue...


popnfresh24
07-31-2011, 10:36 AM
Hey, so this is pretty basic i'm guessing but it's annoying me because i can't work it out.

I have 30 MovieClips inside of another MovieClip called "containerx"

I have a ScrollPane called "mySP" and it scrolls the containerx

'mySP.source = containerx'

now, this is the part i cant work out. I won't always need to use all 30 mc's inside of the containerx, so the ones i'm not using i'm using the "removeChild()" method to get rid of them...

So far, what i've worked out is that i have to put the removeChild code in the containerx because it has to be within the parent... that's fine... but i need to set the source of the mySP AFTER i removeChild... otherwise there is a lot of blank space in my scrollPane where the other mc's used to be...

all following so far?

So what i tried to do is set the source of mySP after i removed child, but to do this i have to access it on the stage from inside my containerx.

I done that by using this code:

MovieClip(parent).mySP.source = this;

it works! but it gives me this Compile Error:

ComponentShim (Compiled Clip), Line 1 Warning: 5002: The frame scripts of the symbol 'ScrollPane' have been ignored because a compiled clip contains a definition for fl.containers.ScrollPane. To override the fl.containers.ScrollPane definition, place a custom class file within your classpath.

Nooo idea what that means or if my code is even right... but it works...

---------------------------------------------------------------------------------

Incase you didn't full understand, here it is again.

There are 30 buttons inside of a mc called containerx

If i only need 20 buttons, i'll use 'removeChild' to remove the last 10.

i have to put the 'removeChild' method inside of the containerx

i need to set the scrollPanes source to containerx after the removeChild.

How do i do this correctly?

Thank you!

Jesse

audiopro
07-31-2011, 10:42 AM
Why not just create the number of MC's required, at runtime?

popnfresh24
07-31-2011, 01:32 PM
For the purpose i'm using this for, i figured that this is the most easiest way to do it. They are already on the stage and whoever uses it will name them, and then the ones that are unnamed will be removed.

popnfresh24
07-31-2011, 03:09 PM
Answered my own question again... lol...

i found that i can just remove the child movieclip externally using:

containerx.removeChild(containerx.box1);