Newbie needs help calling functions.
Hello. First, so everyone knows what I'm trying to accomplish, I have a Flash website I am building usingover 300 .png's (named home0264.png, home0265.png, etc.) in my flash folder inside a folder called "images" that were output from a 3D animation program to create my animation. The animation is a metal wheel that rotates towards the user based on the link they are currently hovering over (seen here- teamsuperior.org).
The problem is that using all the frames I need to create the animation has resulted in a huge file that makes the functionatlity of the website non existent for a typical user. I asked about this a while back and a good hearted soul provided me with the following code to perform those functions as opposed to using frames to do it:
var tl:MovieClip=this;
var imageNum:int=0260;
var imageTotal:int=0524;
loadF();
function loadF():void{
tl["loader_"+imageNum]=new Loader();
tl["loader_"+imageNum].contentLoaderInfo.addEventListener(Event.COMPLETE,loadcompleteF);
tl["loader_"+imageNum].load(new URLRequest("images/home"+imageNum+".png"));
}
function loadcompleteF(e:Event):void{
if(imageNum<imageTotal){
imageNum++;
loadF();
} else {
// loading of the images is complete. you can now display any sequence without delays. ie, start your app
startF();
}
}
/* Mouse Over Event
Mousing over the symbol instance executes a function in which you can add your own custom code.
Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
The code will execute when the symbol instance is moused over.
*/
function displayF([0260,0261,0263,0264,0265,0266,0267,0268]):void{
tl.imageA=imageA;
tl.currentIndex=0;
tl.addChild(tl["loader_"+imageA[0]]);
tl.addEventListener(Event.ENTER_FRAME,enterframeF);
}
function enterframeF(e:Event):void{
tl.removeChild(tl["loader_"+tl.imageA[tl.currentIndex]]);
tl.currentIndex++;
if(tl.currentIndex<tl.imageA.length){
tl.addChild(tl["loader_"+tl.imageA[tl.currentIndex]]);
} else {
tl.removeEventListener(Event.ENTER_FRAME,enterframeF);
}
}
SO HERE"S MY QUESTION (FINALLY):
First, I am fairly new to action script so I use snippets a lot but these larger functions I have no idea where to put them or how to call them using an event (i.e. do I use the full code for the function on the event or just the function name? Anyone willing to type out an example I would apprecaite so I see the format and syntax for this)
Second I get these errors when trying to run the animation:
expecting identifier before left bracket
expecting rightparen before leftbrace
This occurs for the top line of code that reads:
function displayF([0260,0261,0263,0264,0265,0266,0267,0268]):void{
tl.imageA=imageA;
tl.currentIndex=0;
tl.addChild(tl["loader_"+imageA[0]]);
tl.addEventListener(Event.ENTER_FRAME,enterframeF);
}
Will someone who knows syntax help me figure out what the issue is? I think that's all I need. Thanks very much in advance.