...

View Full Version : Need help in creating a flash menu which show/hide on button click.



mohankumarnath
05-16-2008, 11:16 AM
Hi,

I wish to create a flash menu which should scroll up from botton of movie on clicking a single "View menu" button.
The text on the button should show "Hide menu" when menu is displayed.
Up on clicking the same button whose text is "Hide menu" now, the menu should scroll down and hide from stage.
The text on the button again revert to "Show Menu"

Please help me creating this.Any valuable help is appreciated.

Thank you.

gnomeontherun
05-16-2008, 04:56 PM
Do you have Flash? Do you have anything created now?

I'm not a code machine...you can use Google if you want to find free scripts. If you have a question about coding and are willing to try to make it first, then we can help.

Not trying to sound rude, but we aren't here to just code things for people, we are here to help others code on their own.

mohankumarnath
05-17-2008, 04:19 PM
Hi Jeremy,

I am sorry if you felt in that way. I am not a lazy freak who wants some one else to do the job which i should do. Only thing was that my message was incomplete.

Here is the action script i wrote which is running in the root, frame1


Movieclip.prototype.scrollme = function(yPos)
{

this._y -= (this._y-yPos)/5;
};

out = false;


menu.onEnterFrame = function() {


if (out) {

this.scrollme(75);
} else {
this.scrollme(100);
}
};


//To give an elastic property on mouse over

Movieclip.prototype.elasticScale = function(targetS, accel, convert) {
this.step = this.step * accel + (targetS - this._xscale) * convert
this._xscale = this._yscale += this.step
}


// Button actions

for(i=1;i<6;i++){
theButton=_root.menu["but"+i];
theButton.thisNum=i;

theButton.onEnterFrame=function() {

if (_root.menu["but"+this.thisNum].overMe) {

this.elasticScale(150, 0.7, 0.3)
} else {
this.elasticScale(100, 0.7, 0.3)
}
}

}
theButton.onRollOver=function(){

_root.menu["but"+this.thisNum].overMe=true;

_root.menu["but"+this.thisNum].swapDepths(4000)
}

theButton.onRollOut=function(){

_root.menu["but"+this.thisNum].overMe=false;
}

// show hide button

showhide.onRelease = function() {

if (out) {

out = false;

} else {

out = true;

}};

My issue is that the show hide button is not doing what it should do.The menu is not popping up when the button is clicked.

I know that you were trying not to be rude.but that was good enough to discourage a new coder registered in this forum.

I was only looking for a suggestion .Not your code.Thanks for your advice about the possibilities of google.


Thanks for your time.

gnomeontherun
05-17-2008, 06:11 PM
No problem, I'm just trying to get enough information about your problem so that we can actually help. Sometimes people try to get us to just do their work, so thanks for the code now we can actually do some help. We try to be helpful when we can, but its very hard sometimes with out any information to go on, and sometimes we get people who just want us to provide them our code. I even see every few days someone who doesn't even have Flash trying to make a flash program, and that shows a serious lack of attempt on their part. That is what I want to prevent, so my apologies if you were put off.

I'm not sure what your level of AS knowledge is? Your menu is contained in a movieClip right? You are writing or combining a lot of code which can be simplified greatly. Basically you can create this effect with Tweens, which are documented here (http://www.oman3d.com/tutorials/flash/tweenclasseasing/), and with only about 8 lines of code or so. Basically on a button click you will call the Tween class to slide it up.

Here is a basic demonstration, which you can further develop from.


buttonname.onRelease {
var myTween:Tween = new Tween (menu_mc,"_y",Strong.easeOut,500,100,2,true);
}

mohankumarnath
05-20-2008, 08:23 AM
Hi Jeremy,

Thank you very much. You were very helpful.
I went through the documentation link you gave me.
I restructured the code using tweening .
It is working fine now.

Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum