as3 dynamic button name capturing problem

Posted by user16458 on Stack Overflow See other posts from Stack Overflow or by user16458
Published on 2010-03-19T16:41:40Z Indexed on 2010/03/19 16:51 UTC
Read the original article Hit count: 189

Filed under:
|

i am using this code below to dynamically capture the name of the button pressed and then playing the related balloon movie clip animation.

stage.addEventListener(MouseEvent.CLICK, player); 

function player(evt:MouseEvent){
var nameofballoon = evt.target.name;
 nameofballoon =nameofballoon.substring(nameofballoon.length-1,nameofballoon.length);
var movie = "balloon"+nameofballoon;
 trace(movie);
movie.gotoAndPlay("burst");

  }

i'm getting this error even though the name of the clip capture by the event is correct

TypeError: Error #1006: value is not a function.
at Balloons2_fla::MainTimeline/player()

any thoughts ? what wrong with this code?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flash