a frame runs code written in another frame?
for example:
a mouse click calls a function that fades out a textfield in a frame, go to another frame and fades in the textfield that is in that frame.
Code:
function changeFrame(e):void
{
if (_txt){
new GTween(_txt, 0.3 ,{alpha:0});
}
var timer:Timer = new Timer(300, 1);
timer.addEventListener(TimerEvent.TIMER, function(){
e.target.addEventListener(Event.ENTER_FRAME, updateFrame);
gotoAndStop(e.target.frameLink);
});
timer.start();
}
function updateFrame(e:Event):void
{
if (_txt){
_txt.alpha =0;
new GTween(_txt, fadeDuration ,{alpha:1});
}
e.target.removeEventListener(Event.ENTER_FRAME, updateFrame);
timer.reset();
}
problem:
when it changes frame, the actual movieclip or textfield will be there with alpha 1. so it blinks, between the two alpha animations.
a condition:
the fade should function with many movieclips, some of which won't exist in every frame, that's why the verification ( if (!_txt)... )
project:
This is part of a type of "powerpoint style" presentation in flash. another time I'll certainly try to do it by loading everything in the XML, and no frame Nav. then the listener should not only tween the textfields and movieclips, but also get the values of these objects by xml.
But for the moment I'm doing it like this.
obs:
I surely don't want to write scripts in every frame, so that's the reason I wrote the code like this.
And anyway, I somehow feel that I shouldn't do it that way. What do you people think about it ?
Thanks in advance !