stick var request:URLRequest; before your switch, then assign it with request = whatever later
On 16 March 2011 19:16, Marco Terrinoni <ma...@mularam.com> wrote: > Hi everybody > > > > I'm sure some of you have experience with this issue > > > > I'm trying to write an array for all my navigation buttons and one of the > functions is a MouseEvent "clickHandler" which is used for all buttons to > navigate to external pages. Below is my code: > > > > > > var webArray: Array = [apoc_mc, ballards_mc, buyapowa_mc, cds_mc, > chrysalis_mc, dr_mc, girliepants_mc, hillbilly_mc, hpXmas_mc, kagemusha_mc, > mularam_mc, ouol_mc, trainerace_mc, uds_mc, ves_mc, villas_mc, webrel_mc]; > > > > for (var i:int = 0; i < > webArray.length; i++) { > > webArray[i].buttonMode = > true; > > > webArray[i].addEventListener(MouseEvent.CLICK, clickHandler); > > } > > > > > > function > clickHandler(event:MouseEvent):void { > > switch (event.currentTarget) > { > > > > > > case apoc_mc: > > var request:URLRequest = new > URLRequest("http://www.mularam.com/projects/apoc.php"); > > navigateToURL(request, > "_self"); > > break; > > > > > > case ballards_mc: > > var request:URLRequest = new > URLRequest("http://www.mularam.com/projects/ballards.php"); > > navigateToURL(request, > "_self"); > > break; > > > > And so on for each different nav element. I receive warning 3596 and > although the file publishes and works I am trying to improve my AS3 skills > and would like to know what the proper way of doing this is (without > writing > separate functions for all nav elements if possible). I'm also using an > array because I'm calling other functions for Mouse ROLL_OVER and ROLL_OUT > states > > > > Many thanks in advance for any advice > > > > > > Marco Terrinoni - Director > MULARAM PRODUCTIONS > web design // animation // illustration > uk: +44 7876 652 643 > e: <mailto:ma...@mularam.com> ma...@mularam.com > w: <http://www.mularam.com/> www.mularam.com > > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders