Skip to main content
Participant
April 10, 2007
Question

how to target movie from within the event listener

  • April 10, 2007
  • 1 reply
  • 204 views
I've been having this problem from the very beginning: how to actually target movie clips or functions from another function? If I am on main timeline and call main timeline function from within another main timeline fucntion it works like this:

callF1();

function callF1() {
this.F1();
}

function F1() {
//do something
}

but for event listener "this" doesn't work!!!

someButton.onRelease = function() {
F1();
}

now for calling movie clips on the fly, I have movie on main timeline that has been created like this:

holderName = "blabla"
this[holderName].createEmptyMovieClip("img_holder_MC", this.getNextHighestDepth());

I can target this new clip quite ok from within the function:

loadImageNow("image1.jpg", holderName);

function loadImageNow(imagePath:String, holder) {
loadMovie(imagePath, this[holderName].img_holder_MC);
}

but again this wont' work for event listener!!!!

someButton.onRelease = function() {
loadMovie(imagePath, _root[holderName].img_holder_MC);
}

what is the correct way to target things on main timeline from within the event listener???? I just guessed the previus code and I don't even know what it is doing. I just works correctly.
Thanks for any help,
Zbynek
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 10, 2007
check mike chambers Delegate class (and its create method).