?
Solved

Flash - fade-out

Posted on 2011-03-22
9
Medium Priority
?
365 Views
Last Modified: 2012-08-13
Hello,

I've created a fade in with the timeline, calling it in a function with object.play();
How can I, with another function, reverse the timeline?

So that I get a fade-out instead of fade-in?

So instead of playing frame 1-30, it goes 30-1
0
Comment
Question by:ErnstJacobs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35191065
Create a recursive function like this:
function reverse():void
{
   if( object.currentFrame > 1 ){
        object.gotoAndStop( object.currentFrame - 1 );
        reverse();
   }
}

Open in new window


Warm Regards
Deepanjan Das
0
 

Author Comment

by:ErnstJacobs
ID: 35191179
I've done the following
function btnOutFunction(e:MouseEvent) {
	   if( txtObjectMC.currentFrame > 1 ){
        trace(txtObjectMC.gotoAndStop( txtObjectMC.currentFrame - 1 ));
        btnOutFunction(e);
   }
}

Open in new window


But it gives as output "undefines, undefined, undefined, etc."
maybe it needs a delay? but how?
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35191261
try this:
function btnOutFunction(e:MouseEvent) {
          reverse();
}

function reverse() {
           if( txtObjectMC.currentFrame > 1 ){
        trace(txtObjectMC.gotoAndStop( txtObjectMC.currentFrame - 1 ));
        reverse();
   }
}

Open in new window


Warm Regards
Deepanjan Das
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
smabudhahir earned 1000 total points
ID: 35191309
Try this..

function btnOutFunction(e:MouseEvent) {
   txtObjectMC.addEventListener(Event.ENTER_FRAME, onObjEnterFr);
}
function onObjEnterFr(e:Event):void{
	if( txtObjectMC.currentFrame > 1 ){
		 txtObjectMC.gotoAndStop( txtObjectMC.currentFrame - 1 );
	}else{
		txtObjectMC.removeEventListener(Event.ENTER_FRAME, onObjEnterFr);
	}
}

Open in new window

0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35191326
sorry the code is:
function reverse() {
           if( txtObjectMC.currentFrame > 1 ){
        txtObjectMC.gotoAndStop( txtObjectMC.currentFrame - 1 );
        reverse();
   }
}

Open in new window

0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35191329
or try this:
function reverse() {
           if( txtObjectMC.currentFrame > 1 ){
        txtObjectMC.prevFrame();
        reverse();
   }
}

Open in new window

0
 
LVL 1

Expert Comment

by:smabudhahir
ID: 35191384
Hi deepanjandas, The time taken for every iteration while recursive call will not update the stage. So it will look like a jump to first frame. I think better way to use Enter_Frame event. Please correct me if i'm wrong.
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35191415
Hmm..may smabudhahir is right.. ErnstJacobs you may use the ENTER_FRAME event to run the reverse functiion and clear it on the condition achieved.

Warm Regards
Deepanjan Das
0
 

Author Closing Comment

by:ErnstJacobs
ID: 35191761
I had to go for this code, it works perfectly :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question