dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How do you add onclick events to cloned elements?

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    18

    How do you add onclick events to cloned elements?

    I have a problem: I can't figure out how to set an onclick event handler for a cloned layer. I'm working on a 3D carousel of click-able layers, and so I thought I would just set the onclick event of the original "template" layer -- the one that all the others are cloned from. I checked the "element has events" box, and then added a script to the onclick event:

    showInfo( this )


    In 3DFA, this works perfectly, but when I compile it and run it, only the original layer activates on a click. When I'm cloning the layers, is there a way to set the onclick event individually?

  2. #2
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    Yep there is a way. Just do...

    function function_name()
    {
    //do something
    }

    myclone.onPress=root.function_name

    Because of the way 3DFA works, you must set it to a function like that.
    BC

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