Hello everyone, please help me on this last part of my project. I’m sure it’s really simple but I can’t seem to figure it out:
I have dynamically loaded buttons (thumb) and images (galImage) going to container_mc and full_mc containers respectively. I can’t get the buttons to stay down when pressed using MOUSE_DOWN and MOUSE_UP. When I use CLICK instead, they all stay pressed. Please help!
//Load Gallery Images and Thumbs
for (var i:Number = 0; i < sub_menu1.selectedItem.gallery.length(); i++)
{
//Load Gallery Images
var galImage:Loader = new Loader();
var galUrl = sub_menu1.selectedItem.gallery*;
galImage.load(new URLRequest(galUrl));
//Create Thumbs
var thumb = new ThumbButton();
thumb.image = galImage;
thumb.name = i;
thumb.y = 20*y_counter;
thumb.buttonMode = true;
thumb.graphics.lineStyle(1,0xFFFFFF);
thumb.graphics.beginFill(0xFFFFFF,0);
thumb.graphics.drawRect(0,0,15,15);
thumb.graphics.endFill();
y_counter++;
//Add Thumbs to Container
container_mc.addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, showFull);
thumb.addEventListener(MouseEvent.MOUSE_UP, stayClear);
function stayClear (ev:Event):void
{
ev.target.graphics.clear();
ev.target.graphics.lineStyle(1,0xFFFFFF);
ev.target.graphics.beginFill(0xFFFFFF,0);
ev.target.graphics.drawRect(0,0,15,15);
ev.target.graphics.endFill();
}
function showFull (evt:Event):void
{
full_mc.x = 420;
full_mc.y = 100;
full_mc.addChild(evt.target.image);
evt.target.graphics.lineStyle(1,0xFFFFFF);
evt.target.graphics.beginFill(0xFFFFFF,1);
evt.target.graphics.drawRect(0,0,15,15);
evt.target.graphics.endFill();
}