-
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 !
Last edited by ziriguidum; 08-05-2009 at 11:39 PM.
-
lemon juice hurts your eyes
Am I correct to say that you're using this code inside of a MovieClip, which serves as your "powerpoint" and which contains the "slides"?
If so, than you can just use GTween to tween the alpha of "this" instead of "_txt", making the container MovieClip invisible, and then you can change to whatever content you want and just tween its alpha back to 1, revealing whatever's inside it
(theoretically)
Florian Vanthuyne
WAR AGAINST SOLVED THREADS
mark yours as Resolved under Thread Tools!
-
Actually, it isn't inside of a MovieClip , but the MainTimeLine !
I guess I'd better put it inside of a MovieClip at least to keep things better organized.
Thanks !
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|