I am trying to use the ENTER_FRAME event with a number of dynamically created movieclips and it is not working.
The swf features a series of five clock faces that the user will select by hitting the appropriate button. Each clock has five unique movieclips to that season including a second hand, a minute hand, a main character, a seasonal clock face and a back ground, again, each of these MovieClips are different on each of the five clocks.
So I have a series of five listeners for each of the buttons:
spring_btn.addEventListener(MouseEvent.CLICK, startSpring, false, 0, true);
winter_btn.addEventListener(MouseEvent.CLICK, startWinter, false, 0, true);
…
**then the associated functions to the mouse event looks like this.
**
function startSpring(){
var mBack:springback = new springback();
var mFace:springface = new springface();
var mChar:springchar = new springchar();
var mSeconds:springseconds = new springseconds();
var mMinutes:springminutes = new springminutes();
bringToStage(mBack,mFace,mChar,mSeconds,mMinutes)
}
function startWinter(){
var mBack:winterback = new winterback();
var mFace:winterface = new winterface();
var mChar:winterchar = new winterchar();
var mSeconds:winterseconds = new winterseconds();
var mMinutes:winterminutes = new winterminutes();
bringToStage(mBack,mFace,mChar,mSeconds,mMinutes)
}
… Three others reflecting the three remaining season themes
**The bringToStage function called in each deletes any existing clock pieces and fades in the newly selected clock.
**
function bringToStage(mBack,mFace,mJack1,mJack6,mSeconds,mM inutes1,mMinutes6):void
{
//cleans out existing clock items from stage
for (var i:int = 0; i < numChildren; i++)
{
var Cleaner:Tween = new Tween(getChildAt(i), “alpha”, Strong.easeOut, 1, 0, 2, true);
}
//fades in new
stage.addChild(mBack);
mBack.x = 239.3
mBack.y = 400.3
var Tweenback:Tween = new Tween(mBack, “alpha”, Strong.easeOut, 0, 1, 2, true);
stage.addChild(mFace);
var Tweenface:Tween = new Tween(mFace, “alpha”, Strong.easeOut, 0, 1, 2, true);
mFace.x=241.3
mFace.y=241.3
. . .
**That all is working fine but now I want to use the ENTER_FRAME Event to keep the time with the hour, minute and second hands, I was hoping to do something like this: **
addEventListener(Event.ENTER_FRAME, keepTime);
function keepTime(e:Event):void
{
var min:int;
min = Number(my_date.minutes);
mMinutes.rotation=(min * 6);
…
}
**Back to where I started, apparantly you can’t throw mMinutes around like that in the code and expect it to work. So I am in search of the rationale so I can find a solution. Keep in mind I am very new to AS3, so please speak slowly.
**
Thanks,
Jim