[SIZE=2]I’m graphic designer with very little programming experience and I’m trying to put together a flash based version of my company’s catalog. It’s been frustrating but I’ve managed to piecemeal together the following code.[/SIZE] [SIZE=2] I know it’s probably a monstrosity but everything works except for the navigational index I’m going to place at the bottom of the stage. As it is right now, I’m defining 42 individual dynamic textfields on the stage (six of which appear in the AS) and [/SIZE]attempting to make them link to their respective pages via AS. You can probably see what I’m trying to do here:
[COLOR=Blue]
var p:int = 1;
var catalog:Array = new Array(“images/catalog_Page_” + p + “.png”);
while (p < 42) {
p++;
catalog.push(“images/catalog_Page_” + p + “.png” );
}
var page:int = 0;
var imageRequest:URLRequest = new URLRequest(catalog[page]);
var imageLoader:Loader = new Loader ();
imageLoader.load(imageRequest);
addChild(imageLoader);
imageLoader.x = 54;
imageLoader.y = 15;
stage.displayState=StageDisplayState.FULL_SCREEN;
stage.scaleMode=“noScale”;
backBtn.visible = false;
backBtn.addEventListener(MouseEvent.CLICK, pageBack);
forwardBtn.addEventListener(MouseEvent.CLICK, pageForward);
var normal:TextFormat = new TextFormat(null, null, 0x999999);
var highLight:TextFormat = new TextFormat(null, null, 0x00ccff);
var newList:Array = new Array(one,two,three,four,five,six); [COLOR=Red]//these are my TextFields[/COLOR]
function setButtonParam():void {
var i:int = 0;
while (i < 6){
newList*.selectable = false;
newList*.addEventListener(MouseEvent.CLICK, pageJump);
newList*.setTextFormat(normal);
i++;
}
}
setButtonParam();
function pageJump(evt:MouseEvent):void {
[COLOR=Red]page = ???[/COLOR]
var imageRequest:URLRequest = new URLRequest(catalog[page]);
var imageLoader:Loader = new Loader ();
imageLoader.load(imageRequest);
addChild(imageLoader);
imageLoader.x = 54;
imageLoader.y = 15;
buttonCtrl();
setButtonParam();
navStatus();
}
function buttonCtrl():void {
if (page > 0) {
backBtn.visible = true;
} else {
backBtn.visible = false;
}
if (page > 40) {
forwardBtn.visible = false;
} else {
forwardBtn.visible = true;
}
}
function pageBack(evt:MouseEvent):void {
page = (page-1);
var imageRequest:URLRequest = new URLRequest(catalog[page]);
var imageLoader:Loader = new Loader ();
imageLoader.load(imageRequest);
addChild(imageLoader);
imageLoader.x = 54;
imageLoader.y = 15;
buttonCtrl();
setButtonParam();
navStatus();
}
function pageForward(evt:MouseEvent):void {
page = (page+1);
var imageRequest:URLRequest = new URLRequest(catalog[page]);
var imageLoader:Loader = new Loader ();
imageLoader.load(imageRequest);
addChild(imageLoader);
imageLoader.x = 54;
imageLoader.y = 15;
buttonCtrl();
setButtonParam();
navStatus();
}
function navStatus():void {
newList[page].setTextFormat(highLight);
}
stop();[/COLOR]
The question is what do I have do to make the [COLOR=Blue]pageJump[/COLOR] function know which TextField was clicked?
Any other pointers are welcome! Thanks!