RE: [Flashcoders] Duplicate varibale definition

2011-03-16 Thread Marco Terrinoni
 

 

Thank you Tom - works perfectly now!

 

Henrik - I'd love to know more about your use of component definitions, do
you have any recommended reading material?

 

Thanks again

 

 

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 

 

From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik
Andersson
Sent: 16 March 2011 18:31
To: Flash Coders List
Subject: Re: [Flashcoders] Duplicate varibale definition

 

The way I would do it is to assign each clickable object the url it
needs to go to in a property and then use a single event listener that
reads the property to know what url to use.

If I was in a really fancy mood I would look into using a component
definition to allow the url to be easily set without scripting.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 

  _  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1204 / Virus Database: 1498/3510 - Release Date: 03/16/11

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Duplicate varibale definition

2011-03-16 Thread Henrik Andersson
The way I would do it is to assign each clickable object the url it 
needs to go to in a property and then use a single event listener that 
reads the property to know what url to use.


If I was in a really fancy mood I would look into using a component 
definition to allow the url to be easily set without scripting.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Duplicate varibale definition

2011-03-16 Thread tom rhodes
stick var request:URLRequest; before your switch, then assign it with
request = whatever later


On 16 March 2011 19:16, Marco Terrinoni  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:   ma...@mularam.com
> w:   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


[Flashcoders] Duplicate varibale definition

2011-03-16 Thread Marco Terrinoni
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:   ma...@mularam.com  
w:   www.mularam.com 

 

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders