1 Reply Latest reply on Jul 9, 2011 1:44 PM by kidelectric

    How to get properties of clickable photo on mouseclick?


      I have a series of thumbnail images which are dynamically loaded/created in AS3 via an HTTPService call...

      I would like this photos to be clickable (or mouse over) in order to swap out the source of a main (larger) image.


      However, when I set a mouse event handler for the photo, it won't let me access the target photo's properties (such as source or id) the way I normally would, such as event.target.id


      When I attempt to do this, the event target is not the photo itself but the spark.skins.ImageSkin...


      The reason I am trying to pull the image.id is because I used it to store the index of that image which corresponds to an array of URL addresses to be able to fetch the full-size version... any ideas how I can do this? It worked with other element types (like Label), but not Image...



      private function onMousePhoto(event:MouseEvent):void {

      mainPhoto.source = currentPhotos[event.target.id]+




      private function flickrImageResult(re:ResultEvent):void {

      photoArray = re.result.rsp.photos.photo;


      var photoCounter:int = 0;


      for each ( var p:Object in photoArray ) {


      var photo:Image = new Image();

      currentPhotos[photoCounter] =

      "http://farm" + p.farm + ".static.flickr.com/" + p.server + "/" + p.id + "_" + p.secret;

      photo.source = currentPhotos[photoCounter]+


      photo.id = photoCounter.toString();

      photo.useHandCursor =


      photo.buttonMode =


      photo.addEventListener(MouseEvent.MOUSE_OVER, onMousePhoto );