1 Attachment(s)
Delegate.Create for an mc inside a class [DEADLINE] pls help
PHP Code:
import mx.events.EventDispatcher;
import mx.utils.Delegate;
class main_movie extends MovieClip
{
public var pbSend:Button;
public var my_mc:MovieClip;
public var my_button:MovieClip;
// constructor
public function main_movie()
{
super();
EventDispatcher.initialize(this);
my_mc = attachMovie ("my_mc", "my_mc", getNextHighestDepth(), {_x :100, _y:50} );
my_button = attachMovie ("my_button", "my_button", getNextHighestDepth(), {_x :100, _y:50} );
my_button._x = 100;
// I want to avoid doing this function here..
/*this.onLoad = function()
{
// this is the only line that works and it does add the event.
pbSend.addEventListener("click", Delegate.create(this, checkFields));
// doesn't work
my_mc.addEventListener("onRelease", Delegate.create(this, checkFields));
// doesn't work
my_button.addEventListener("onRelease", Delegate.create(this, checkFields));
}*/
//this["my_mc"].addEventListener("click", Delegate.create(this, checkFields));
}
// I would rather do it here...
private function onLoad ()
{
// doesn't work, this line doesn't work in the onLoad function if its placed here !
//pbSend.addEventListener("click", Delegate.create(this, checkFields));
// doesn't work This is the most important one I really need to get it to work
my_mc.addEventListener("onRelease", Delegate.create(this, checkFields));
// doesn't work
my_button.addEventListener("onRelease", Delegate.create(this, checkFields));
}
private function checkFields():Void
{
trace("check");
}
}
Hi I need help, all I want to do is to create an onRelease event for the my_mc
clip which is being attached within the main_movie class.
it works for the button component but not for the mc clip... please advice
thanks