View Full Version : [AS3] ScrollPane image gallery

07-07-2010, 08:35 PM
Alright, so I have a ScrollPane on my stage that I got from the components window in flash. I have a movie in my library that is linked to the ScrollPane. In the movie I have thumbnails that I converted to buttons. What i want to happen is when you click on a button a larger version of the image you clicked with load right above the ScrollPane. When I test it and click the buttons nothing happens. Here is how I have my .fla set up:

Scene 1:

the empty scrollpane component with an instance name of "paintings_scrollpane".

its class in the linkage properties is "fl.containers.ScrollPane"

the scrollpane is the only thing on the stage. there is no actionscript.

then i have a movie clip with the name "paintings", that is in my library.

its class in the linkage properties is "MyPaintings"

inside the "paintings" movie clip are thumbnails that i have converted to buttons and given instance names that are listed in the code.

on a different layer in the "paintings" movie clip i have the actionscript that is posted below:

var Xpos:Number = 275;
var Ypos:Number = 180;
var jpg:MovieClip;
var loader:Loader = new Loader();

var defaultIMAGE:URLRequest = new URLRequest("swfs/mixed_media/one.jpg");

loader.x =Xpos;
loader.y =Ypos;


//Btns Universal function

function btnClick(event:MouseEvent):void{
var newJPGRequest:URLRequest = new URLRequest("swfs/mixed_media/"+event.target.name+".jpg");

//Btn Listeners
one.addEventListener(MouseEvent.CLICK, btnClick);
two.addEventListener(MouseEvent.CLICK, btnClick);
three.addEventListener(MouseEvent.CLICK, btnClick);
four.addEventListener(MouseEvent.CLICK, btnClick);
five.addEventListener(MouseEvent.CLICK, btnClick);
six.addEventListener(MouseEvent.CLICK, btnClick);