|
Flash CS3 Actionscript 2.0 HELP!
07-29-2008, 03:34 PM
|
Flash CS3 Actionscript 2.0 HELP!
|
Posts: 3
|
Hi!
I need help with a site I’m designing - this is the link: http://www.martaramos.com
There’s much yet to be done but so far I’m having some trouble with the code: I’m not exactly a coder, more a designer…
So this is the question - I have a navbar that will display some content in the center of the page and every time you click a link it triggers some animation, and it works fine. The thing is that if you do not let the animation of each button finish and click another button, everything will go crazy and starts overlapping, and there’s no way to correct it unless you refresh the movie…
Is there any way of prevent this to happen?
Thank you!
This is the code for the navbar:
import mx.transitions.Tween;
import mx.transitions.easing.*;
// ------------- Display Content - Buttons Function ---------------- \\
navbar.biografia.onPress = function() {
clearInterval (delexposicoes);
clearInterval (delseleccao);
clearInterval (delbibliografia);
clearInterval (delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delbiografia = setInterval(secondFunction, 1800);
function secondFunction() {
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 100, 0.5, true);
}
};
navbar.exposicoes.onPress = function() {
clearInterval (delbiografia);
clearInterval (delseleccao);
clearInterval (delbibliografia);
clearInterval (delcontactos);
delbiografia = setInterval(secondFunction, 1800);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delexposicoes = setInterval(secondFunction, 1800);
function secondFunction() {
var xTween:Tween = new Tween(navbar.biografia, "_y", Regular.easeOut, navbar.biografia._y, -545, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 100, 0.5, true);
}
};
navbar.seleccao.onPress = function() {
clearInterval (delbiografia);
clearInterval (delexposicoes);
clearInterval (delbibliografia);
clearInterval (delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delseleccao = setInterval(secondFunction, 1800);
function secondFunction() {
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 100, 0.5, true);
}
};
navbar.bibliografia.onPress = function() {
clearInterval (delbiografia);
clearInterval (delexposicoes);
clearInterval (delseleccao);
clearInterval (delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delbibliografia = setInterval(secondFunction, 1800);
function secondFunction() {
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 100, 0.5, true);
}
};
navbar.contactos.onPress = function() {
clearInterval (delbiografia);
clearInterval (delexposicoes);
clearInterval (delseleccao);
clearInterval (delbibliografia);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
delbibliografia = setInterval(secondFunction, 1800);
function secondFunction() {
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 100, 0.5, true);
}
};
|
|
|
|
07-30-2008, 04:35 PM
|
Re: Flash CS3 Actionscript 2.0 HELP!
|
Posts: 10
Name: Marcio
|
you'll need to creat a symbol for each of them. so for example your home link would have the text home and a transparent symbol (movie clip because of the animation ) with a code like this
Code:
onClipEvent (load)
{
num = 3;
}
on (rollOver)
{
if (_root.link != num)
{
_root.menu1["item" + num].gotoAndPlay("s1");
this.gotoAndPlay("s1");
} // end if
}
on (releaseOutside, rollOut)
{
if (_root.link != num)
{
_root.menu1["item" + num].gotoAndPlay(_root.menu1["item" + num]._totalframes - _root.menu1["item" + num]._currentframe);
this.gotoAndPlay("s2");
} // end if
}
on (release)
{
gotoAndPlay(frame)
}
}
Good luck hope this helps
|
|
|
|
07-31-2008, 08:42 AM
|
Re: Flash CS3 Actionscript 2.0 HELP!
|
Posts: 3
|
Thanks for your reply marc180!
I'm very green in terms of code so I'm having a little difficulty understanding your script...
Your suggestion of creating movieclip symbols and control them with actionscript seams wise and I already came to that conclusion myself and before reading your post I came up with a possible solution that is working for now.
I have replaced the button symbols with movieclips and modified the code so now everything is funtioning well.
I' ve aded a disabling function for each button that disables it after clicking on them, preventing double clicks and this solutioned the overlaping problem.
If you click a button and another one next before the animation of the fist as ended, it blocks the animation to develop but displays the correct content and doesn't mess the all thing like before.
I thank you very much for your help and I'll study your code hoping to learn from it!
I've already updated the site so if you'll like you can visit it and see if there's something not functioning well. Every suggestion are mech welcome!
Thanks again for your time!
This is the new code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
// ------------- NavBar - Buttons Function --------------- \\
navbar.biografia_btn.onRollOver = function() {
navbar.biografia_btn.gotoAndStop(2);
};
navbar.biografia_btn.onRollOut = function() {
navbar.biografia_btn.gotoAndStop(1);
};
navbar.exposicoes_btn.onRollOver = function() {
navbar.exposicoes_btn.gotoAndStop(2);
};
navbar.exposicoes_btn.onRollOut = function() {
navbar.exposicoes_btn.gotoAndStop(1);
};
navbar.seleccao_btn.onRollOver = function() {
navbar.seleccao_btn.gotoAndStop(2);
};
navbar.seleccao_btn.onRollOut = function() {
navbar.seleccao_btn.gotoAndStop(1);
};
navbar.bibliografia_btn.onRollOver = function() {
navbar.bibliografia_btn.gotoAndStop(2);
};
navbar.bibliografia_btn.onRollOut = function() {
navbar.bibliografia_btn.gotoAndStop(1);
};
navbar.contactos_btn.onRollOver = function() {
navbar.contactos_btn.gotoAndStop(2);
};
navbar.contactos_btn.onRollOut = function() {
navbar.contactos_btn.gotoAndStop(1);
};
// ------------- Display Content - Buttons Function ---------------- \\
navbar.biografia_btn.onPress = function() {
navbar.biografia_btn.enabled = false;
navbar.exposicoes_btn.enabled = true;
navbar.seleccao_btn.enabled = true;
navbar.bibliografia_btn.enabled = true;
navbar.contactos_btn.enabled = true;
navbar.biografia_btn.gotoAndStop(2);
navbar.exposicoes_btn.gotoAndStop(1);
navbar.seleccao_btn.gotoAndStop(1);
navbar.bibliografia_btn.gotoAndStop(1);
navbar.contactos_btn.gotoAndStop(1);
clearInterval(delexposicoes);
clearInterval(delseleccao);
clearInterval(delbibliografia);
clearInterval(delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delbiografia = setInterval(secondFunction, 1800);
function secondFunction() {
var xTween:Tween = new Tween(navbar.biografia_btn, "_y", Regular.easeOut, navbar.biografia_btn._y, -529, 0.5, true);
var xTween:Tween = new Tween(navbar.exposicoes_btn, "_y", Regular.easeOut, navbar.exposicoes_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.seleccao_btn, "_y", Regular.easeOut, navbar.seleccao_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.bibliografia_btn, "_y", Regular.easeOut, navbar.bibliografia_btn._y, -54, 0.5, true);
var xTween:Tween = new Tween(navbar.contactos_btn, "_y", Regular.easeOut, navbar.contactos_btn._y, -54, 0.5, true);
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 100, 0.5, true);
}
};
navbar.exposicoes_btn.onPress = function() {
navbar.biografia_btn.enabled = true;
navbar.exposicoes_btn.enabled = false;
navbar.seleccao_btn.enabled = true;
navbar.bibliografia_btn.enabled = true;
navbar.contactos_btn.enabled = true;
navbar.biografia_btn.gotoAndStop(1);
navbar.exposicoes_btn.gotoAndStop(2);
navbar.seleccao_btn.gotoAndStop(1);
navbar.bibliografia_btn.gotoAndStop(1);
navbar.contactos_btn.gotoAndStop(1);
clearInterval(delbiografia);
clearInterval(delseleccao);
clearInterval(delbibliografia);
clearInterval(delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delexposicoes = setInterval(secondFunction, 1800);
function secondFunction() {
var xTween:Tween = new Tween(navbar.exposicoes_btn, "_y", Regular.easeOut, navbar.exposicoes_btn._y, -529, 0.5, true);
var xTween:Tween = new Tween(navbar.biografia_btn, "_y", Regular.easeOut, navbar.biografia_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.seleccao_btn, "_y", Regular.easeOut, navbar.seleccao_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.bibliografia_btn, "_y", Regular.easeOut, navbar.bibliografia_btn._y, -54, 0.5, true);
var xTween:Tween = new Tween(navbar.contactos_btn, "_y", Regular.easeOut, navbar.contactos_btn._y, -54, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 100, 0.5, true);
}
};
navbar.seleccao_btn.onPress = function() {
navbar.biografia_btn.enabled = true;
navbar.exposicoes_btn.enabled = true;
navbar.seleccao_btn.enabled = false;
navbar.bibliografia_btn.enabled = true;
navbar.contactos_btn.enabled = true;
navbar.biografia_btn.gotoAndStop(1);
navbar.exposicoes_btn.gotoAndStop(1);
navbar.seleccao_btn.gotoAndStop(2);
navbar.bibliografia_btn.gotoAndStop(1);
navbar.contactos_btn.gotoAndStop(1);
clearInterval(delbiografia);
clearInterval(delexposicoes);
clearInterval(delbibliografia);
clearInterval(delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delseleccao = setInterval(secondFunction, 1800);
function secondFunction() {
var xTween:Tween = new Tween(navbar.seleccao_btn, "_y", Regular.easeOut, navbar.seleccao_btn._y, -529, 0.5, true);
var xTween:Tween = new Tween(navbar.biografia_btn, "_y", Regular.easeOut, navbar.biografia_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.exposicoes_btn, "_y", Regular.easeOut, navbar.exposicoes_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.bibliografia_btn, "_y", Regular.easeOut, navbar.bibliografia_btn._y, -54, 0.5, true);
var xTween:Tween = new Tween(navbar.contactos_btn, "_y", Regular.easeOut, navbar.contactos_btn._y, -54, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 100, 0.5, true);
}
};
navbar.bibliografia_btn.onPress = function() {
navbar.biografia_btn.enabled = true;
navbar.exposicoes_btn.enabled = true;
navbar.seleccao_btn.enabled = true;
navbar.bibliografia_btn.enabled = false;
navbar.contactos_btn.enabled = true;
navbar.biografia_btn.gotoAndStop(1);
navbar.exposicoes_btn.gotoAndStop(1);
navbar.seleccao_btn.gotoAndStop(1);
navbar.bibliografia_btn.gotoAndStop(2);
navbar.contactos_btn.gotoAndStop(1);
clearInterval(delbiografia);
clearInterval(delexposicoes);
clearInterval(delseleccao);
clearInterval(delcontactos);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 0, 0.5, true);
delbibliografia = setInterval(secondFunction, 1800);
function secondFunction() {
var xTween:Tween = new Tween(navbar.bibliografia_btn, "_y", Regular.easeOut, navbar.bibliografia_btn._y, -70, 0.5, true);
var xTween:Tween = new Tween(navbar.biografia_btn, "_y", Regular.easeOut, navbar.biografia_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.seleccao_btn, "_y", Regular.easeOut, navbar.seleccao_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.exposicoes_btn, "_y", Regular.easeOut, navbar.exposicoes_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.contactos_btn, "_y", Regular.easeOut, navbar.contactos_btn._y, -54, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 100, 0.5, true);
}
};
navbar.contactos_btn.onPress = function() {
navbar.biografia_btn.enabled = true;
navbar.exposicoes_btn.enabled = true;
navbar.seleccao_btn.enabled = true;
navbar.bibliografia_btn.enabled = true;
navbar.contactos_btn.enabled = false;
navbar.biografia_btn.gotoAndStop(1);
navbar.exposicoes_btn.gotoAndStop(1);
navbar.seleccao_btn.gotoAndStop(1);
navbar.bibliografia_btn.gotoAndStop(1);
navbar.contactos_btn.gotoAndStop(2);
clearInterval(delbiografia);
clearInterval(delexposicoes);
clearInterval(delseleccao);
clearInterval(delbibliografia);
linhas.gotoAndPlay("transition");
var alphaTween:Tween = new Tween(exposicoes, "_alpha", Regular.easeOut, exposicoes._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(seleccao, "_alpha", Regular.easeOut, seleccao._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(bibliografia, "_alpha", Regular.easeOut, bibliografia._alpha, 0, 0.5, true);
var alphaTween:Tween = new Tween(biografia, "_alpha", Regular.easeOut, biografia._alpha, 0, 0.5, true);
delcontactos = setInterval(secondFunction, 1800);
function secondFunction() {
var xTween:Tween = new Tween(navbar.biografia_btn, "_y", Regular.easeOut, navbar.biografia_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.exposicoes_btn, "_y", Regular.easeOut, navbar.exposicoes_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.seleccao_btn, "_y", Regular.easeOut, navbar.seleccao_btn._y, -545, 0.5, true);
var xTween:Tween = new Tween(navbar.bibliografia_btn, "_y", Regular.easeOut, navbar.bibliografia_btn._y, -54, 0.5, true);
var xTween:Tween = new Tween(navbar.contactos_btn, "_y", Regular.easeOut, navbar.contactos_btn._y, -70, 0.5, true);
var alphaTween:Tween = new Tween(contactos, "_alpha", Regular.easeOut, contactos._alpha, 100, 0.5, true);
}
};
|
|
|
|
|
« Reply to Flash CS3 Actionscript 2.0 HELP!
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|