Skip to main content
Participant
March 10, 2008
Question

methods of class were not called...

  • March 10, 2008
  • 3 replies
  • 191 views

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();
}
}
}
}
This topic has been closed for replies.

3 replies

Participant
March 11, 2008
Thank you, Dave.
Inspiring
March 10, 2008
Sorry... I missed it. My bad.

I think I see your problem now:
my_mcl.loadClip(inAniName,this);

You are replacing your clip, and any code, by using 'this' here. You should
have a container to hold the loaded movie, within your clip, and then use
this.container instead.



--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Inspiring
March 10, 2008
I don't see any loadClip being called that would cause those to fire?

--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/