View Full Version : keyword problem

11-15-2010, 08:31 AM
Hello , i want to use keywords but in this cease i don't know which :
so the code is
topche1.addEventListener(Event.ENTER_FRAME , premestvane);

function premestvane(e:Event){
topche1.x = 300;
topche1.y = 100;


and i want to change "topche1" in function with a keyword something like "this" please help

11-15-2010, 08:39 AM
var item:Item = new Item();
item.addEventListener(Event.ENTER_FRAME, _onEnterFrame);

function (e:Event): void
var myItem:Item = Item(e.target);

//myItem is now item.

Any event which is dispatched by an item has a target property which references the item from which the event dispatched.

Or something like that. Im not very good with words.

11-15-2010, 08:50 AM
thanks man i understand what you wanted to say and it worked so in my case i have just to change "topche1" with "e.target" thanks a lot :)

11-15-2010, 08:58 AM
The event object has a property that holds a refference to the object the event happened to.