Question
methods of class were not called...
class FAniCtrl extends MovieClip
{
//---------------------------------------------- Properties
private var mRepeats :Number;
private var mCurrentRepeat :Number;
public var mAni :Number;
public var mAniName :String;
private var my_mcl :MovieClipLoader;
private var mclListener :Object;
//---------------------------------------------- Methods
/**
* constructor method
*/
public function FAniCtrl()
{
super();
mCurrentRepeat = 0;
mRepeats = 1;
mAni = -1;
mAniName = "";
_visible = false;
this.stop();
////////////////////////////////
///what is wrong with following code section: OnFrameEntry and OnLoaded were never called.
////////////////////////////////
this.my_mcl = new MovieClipLoader();
this.mclListener = new Object();
this.mclListener.pparent = this;
this.mclListener.onLoadInit = function(
target_mc:MovieClip
) : Void
{
this.pparent.onEnterFrame = function() : Void
{
this.OnFrameEntry();
}
this.pparent.OnLoaded();
}
this.my_mcl.addListener(mclListener);
////////////////////////////
}
/**
* destroy method
*/
public function Destroy():Void
{
_visible = false;
this.unloadMovie();
}
public function Load(
inAniName :String,
inRepeats :Number
) : Void
{
_visible = true;
mRepeats = inRepeats;
mAniName = inAniName;
my_mcl.loadClip(inAniName,this);
this.stop();
}
public function LoadNPlay(
inAniName :String,
inRepeats :Number
) : Void
{
_visible = true;
mRepeats = inRepeats;
mAniName = inAniName;
my_mcl.loadClip(inAniName,this);
//TBD
}
public function Play() : Void
{
if(mAniName == "")
{
return;
}
_visible = true;
this.gotoAndPlay(1);
}
public function Stop() : Void
{
_visible = false;
this.gotoAndStop(1);
}
public function Resume() : Void
{
if(mAniName == "")
{
return;
}
//TBD
this.play();
}
public function Pause() : Void
{
//TBD
this.stop();
}
public function OnLoaded() : Void
{
trace("OnLoaded");
}
public function OnRound() : Void
{
_global.GLDXI_AniRounded(mAni);
}
public function OnEnd() : Void
{
trace("OnEnd");
_visible = false;
_global.GLDXI_AniFinished(mAni);
}
public function OnFrameEntry() : Void
{
trace("OnFrameEntry");
if(this._currentframe == this._totalframes)
{
mCurrentRepeat++;
if(mCurrentRepeat >= mRepeats)
{
mCurrentRepeat = 0;
OnRound();
OnEnd();
this.stop();
}
else
{
OnRound();
}
}
}
}