Re: [Flashcoders] calling an event function with a parameter that is a number

2009-05-24 Thread Juan Pablo Califano
Agreed! 2009/5/24 Steven Sacks flash...@stevensacks.net The latter is cleaner and better, IMO. Write a function that your event handler calls. Then, you can call it from elsewhere and from your button click handler. function onThumbClick(event:MouseEvent):void {

[Flashcoders] calling an event function with a parameter that is a number

2009-05-23 Thread Isaac Alves
Hello! In my code there's a function that shows an image on the screen (or load the image and show a progress bar) that is called by clicking on a thumbnail, and uses a parameter [e.target.name] refering to the property name of the thumbnail clicked, which is an integer. The thumbnails are placed

Re: [Flashcoders] calling an event function with a parameter that is a number

2009-05-23 Thread Manish Jethani
On Sun, May 24, 2009 at 2:00 AM, Isaac Alves isaacal...@gmail.com wrote: 1067: Implicit coercion of a value of type Number to an unrelated type flash.events:MouseEvent. How could I call the function clickThumb and make it use image_num + 1 instead of e.target.name ? Do you have the value of

Re: [Flashcoders] calling an event function with a parameter that is a number

2009-05-23 Thread Juan Pablo Califano
You have a couple of options: You could add an optional parameter to the function that handles the click, like this: function clickThumb(e:MouseEvent,index:int = 0):void{ } Setting a default value for the index parameter allows the function to be called without passing it. That's what will

Re: [Flashcoders] calling an event function with a parameter that is a number

2009-05-23 Thread Steven Sacks
The latter is cleaner and better, IMO. Write a function that your event handler calls. Then, you can call it from elsewhere and from your button click handler. function onThumbClick(event:MouseEvent):void { loadImage(event.target.name); } function loadImage(num:int):void { //