A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Event target name

  1. #1
    Lovely Lisa
    Join Date
    Jan 2009
    Location
    New York City
    Posts
    31

    Event target name

    Hello guys. Can I change an event target's name? or it's an only-read property? I've been googling it but to no avail...


    For example, say this is my button code:


    buttonOne.addEventListener(MouseEvent.CLICK,showIm ageOne,false,0,true);

    //variable to store he last button clicked
    var prevClicked:*;


    function showImageOne(event:MouseEvent):void
    {
    if(event.target.name !=prevClick)
    {
    prevClick=event.target.name;
    thecontainer.gotoAndPlay("begin");
    }
    }


    if trace the event target's name, you get buttonOne. But what I need to do is have the event's target's name to become buttonOne1. Why ? because I already have a button with the instance name. That's my setup, not the way I would do it OF COURSE, but this is the way the unique file is setup for my aunt, to have two set of buttons that calls the same image...(not the thumbnail issue I had before)...


    so the Question: is there a way to add a letter or remove a letter from the event target's name? You know how you can add a letter to the beginning of an array like buttonsArray.unshift(newButton)....can you do the same thing with an event.target.name ?

    thanks for any help; I'm still learning this

    x lisa x

  2. #2
    Lovely Lisa
    Join Date
    Jan 2009
    Location
    New York City
    Posts
    31
    I found a solution...

    var buttonOne:Buttons = new Buttons();
    buttonOne.x=10;
    buttonOne.y=10;
    buttonOne.name="whateverIwant";

    this.addChildAt(buttonOne,2);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center