PDA

View Full Version : [AS3] Reusing Scrollpane Component


dwappes
02-08-2010, 02:12 AM
I have about 10 pages (clips) that need the use of a scrollpane and am using the following AS3 script:

scrollPane.source = home_mc;
scrollPane.setSize(575,340);

This works great for one clip, but I would like to reuse it for other clips.

Can someone please give me an AS3 script example of how to reuse the scrollpane for other clips, or do I have to drag a new scrollpane component for each instance? Thanks.

rondog
02-08-2010, 03:55 AM
you would just set the source of the same scrollpane instance to another movie clip

so

scrollPane.source = home_mc;

can just as easily be changed out to

scrollPane.source = about_mc;

dwappes
02-08-2010, 04:00 AM
Do I need to redefine the size each time if I want it to always remain the same size?

rondog
02-08-2010, 04:16 AM
nah once you size it, its the same size until you resize it again

dwappes
02-08-2010, 04:43 AM
I tried that and it worked fine, then when I added script for my buttons I got the following error messages. So I removed the script for my buttons and continued getting the same errors. Do you know what I did wrong?

1026: Constructor functions must be instance methods.5000: The class 'fl.core.ComponentShim' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. 5000: The class 'fl.controls.ScrollBar' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. 5000: The class 'fl.containers.ScrollPane' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

henke37
02-08-2010, 09:43 AM
Your flash install is corrupt. That or you forgot to link with the component symbols, be sure to include the component in the library.

dwappes
02-08-2010, 04:34 PM
I am linked to all the symbols & they are all in the library. Does that mean my Flash CS4 needs to be reinstalled or that I need to contact their technical support?