I’m relatively new to AS3, but have done a lot of work with AS2, so please forgive me if I’m not using the right terminology with this…
I’ve created a button that I turned into a library class and am pulling onto my stage (same as attachMovie is AS2). This button has a timeline which does a small amount of animation.
In my AS, I am loading a thumbnail into each button class and am also assigning mouseevents of roll_over and roll_out to my button… this all is working so far. On roll_over the button’s timeline plays to a point; on roll_out, the button’s timeline plays to the end and then goes back to the first frame… BUT now my image is gone. Why??? Thanx in advance! Here is my AS:
for(var c:int=0; c<arrTours.length; c++){
var clip = new mc_clip(); // my button class
clip.x = (c % 3) * (clip.width + horzPadding);
clip.y = Math.floor(c/3) * (clip.height + vertPadding);
var thumbLoader = new Loader();
var thumbHolder:Sprite = new Sprite();
thumbHolder.x = 9;
thumbHolder.y = 8;
thumbHolder.addChild(thumbLoader);
thumbLoader.load(new URLRequest(arrTours[c].thumb));
clip.addChild(thumbHolder);
clip.ID = c;
clip.buttonMode = true;
clip.addEventListener(MouseEvent.ROLL_OVER, clipOver);
clip.addEventListener(MouseEvent.ROLL_OUT, clipOut);
clip.addEventListener(MouseEvent.CLICK, clipHit);
footer_mc.thumbHolder_mc.addChild(clip);
}
function clipOver(e:MouseEvent){
e.target.gotoAndPlay('in');
}
function clipOut(e:MouseEvent){
e.target.gotoAndPlay('out');
}
function clipHit(e:MouseEvent){
trace(e.target.ID);
}