 | UILoader images to buttons?
on Jul 30, 2010 at 5:24:44 pm |
I have a 5 thumbnail gallery that dynamically loads large images. Now I want to be able to click on the large images and jump to different sections of my site.
I know how to code the jump to sections, but how do I make the large images into buttons?
 | Re: UILoader images to buttons? on Jul 31, 2010 at 12:24:24 am |
you are using a UILoader component? give the component(s) names, then you can direct them to do what you want.
for example- if you use the same UILoader to load the large images. the UILoader is given an instance name of,say 'ldr'.
then if you load into the loader either 'pic1.jpg' or 'pic2.jpg', you want to click on 'pic1.jpg' and be taken to frame label 'label1' or if you click on 'pic2.jpg' then you want to go to frame label 'label2'.
then this code makes that work:
ldr.addEventListener(MouseEvent.CLICK, loaderFunction);
function loaderFunction(ebent:MouseEvent):void{
if(ldr.source=="pic1.jpg"){gotoAndStop("label1");}else
if(ldr.source=="pic2.jpg"){gotoAndStop("label2")}
}
but of course this will all depend on how you have your file and loader(s) set up