Idostuff
January 8th, 2009, 05:01 PM
So I have a small gallery type of thing I'm running. You click on the thumbs and an image loader puts the images on the stage.
That part works great, yay!
However, I would love to have some back and next buttons.
Currently i'm assigning all the thumbnails a number value - on the next button it checks to see what number is up.
next_btn.buttonMode = true;
next_btn.addEventListener(MouseEvent.CLICK, nextPic);
function nextPic(e:Event):void
{
if(picNumber == 1)
{
}
}
What I want to do, is pass a function I've already made in the if statment instead of re-writing the whole thing. Here is the function that is down further in my code:
function show2(e:Event):void
{
var textLoader:URLLoader= new URLLoader();
var textRequest:URLRequest = new URLRequest("two.txt");
var imageRequest:URLRequest = new URLRequest("two.jpg");
function textLoaded(e:Event):void
{
cssLoader.load(cssRequest);
cssLoader.addEventListener(Event.COMPLETE, cssLoaded);
}
function cssLoaded(e:Event):void
{
textLoader.addEventListener(Event.COMPLETE, textLoaded);
imageLoader.load(imageRequest);
fadeTween = new Tween(imageLoader, "alpha", None.easeNone,0,1,.5, true);
addChild(imageLoader);
addChild(imageText);
}
Any advice would be hugely appreciated, thanks!
That part works great, yay!
However, I would love to have some back and next buttons.
Currently i'm assigning all the thumbnails a number value - on the next button it checks to see what number is up.
next_btn.buttonMode = true;
next_btn.addEventListener(MouseEvent.CLICK, nextPic);
function nextPic(e:Event):void
{
if(picNumber == 1)
{
}
}
What I want to do, is pass a function I've already made in the if statment instead of re-writing the whole thing. Here is the function that is down further in my code:
function show2(e:Event):void
{
var textLoader:URLLoader= new URLLoader();
var textRequest:URLRequest = new URLRequest("two.txt");
var imageRequest:URLRequest = new URLRequest("two.jpg");
function textLoaded(e:Event):void
{
cssLoader.load(cssRequest);
cssLoader.addEventListener(Event.COMPLETE, cssLoaded);
}
function cssLoaded(e:Event):void
{
textLoader.addEventListener(Event.COMPLETE, textLoaded);
imageLoader.load(imageRequest);
fadeTween = new Tween(imageLoader, "alpha", None.easeNone,0,1,.5, true);
addChild(imageLoader);
addChild(imageText);
}
Any advice would be hugely appreciated, thanks!