header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
KaMi
Points:30
Posts:2
Answered

7/6/2010 5:11:31 AM

Title: How to go back to previous depth ?


hi, i am using Flash CS3 (AS 2)
that's what I've done:

on(rollOver){
gotoAndPlay("over");
this.swapDepths(_root.getNextHighestDepth());
}
on(rollOut){
gotoAndPlay("out");
}

now I need to restore object's previous depth on rollOut

kindly help me :-(



1
Friend
Points: 690
Posts:0
Accepted Answer
7/6/2010 6:00:11 AM



before setting the new depth store the old depth in a variable and when you need to restore it use that stored variable to restore the depth.






//on roll over store the old depth 
var oldDepth
on(rollOver){
oldDepth=this.getDepth()
gotoAndPlay("over");
this.swapDepths(_root.getNextHighestDepth());
} 


//to restore use 
this.swapDepths(oldDepth);



2
KaMi
Points: 30
Posts:2
7/6/2010 7:15:47 AM



A "Friend" in need is a friend indeed... :)

Thanks Buddy !

3
Friend
Points: 690
Posts:0
7/6/2010 7:40:29 AM



:) welcome

4
KaMi
Points: 30
Posts:2
7/6/2010 8:22:02 AM



hi, needs your help again

here is my work:
http://www.iamgamester.com/projects/luscious/test.html

when you'll see 3 picture thumbnails, roll over & roll out
your cursor on them... they are working fine with the above
mentioned AS.

but if you stay on Roll Over (I mean you don't roll out)
the thumbnail will spoil animation... :-(

Tip: to jump direct to thumbnail's section click on Win Prizes


var oldDepth

on(rollOver){  
	oldDepth=this.getDepth()  
	gotoAndPlay("over");  
	this.swapDepths(_root.getNextHighestDepth());  
	}
on(rollOut){
	this.swapDepths(oldDepth);
	gotoAndPlay("out");  
}

5
Friend
Points: 690
Posts:0
7/6/2010 9:32:32 AM



when your animation proceeds just send all three to the out animation , so if anyone was visible it will disappear


thumbnail1.gotoAndPlay("out");
thumbnail2.gotoAndPlay("out");
thumbnail3.gotoAndPlay("out");


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 6+4 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions