-
AS 3 Navigation problem
Ok. I have a huge problem which i can't handle. The code below is the code i use for my 2 buttons. The problems I have are:
1. when i move the mouse from one button to another the mouse over out animation from the first one stops (it should rewind). If i move the mouse anywhere else it works normally.
2. I want the button to rewind the 2 animation from the first button to if its active. How? Nothing works.
infor - button
portfolio - button
infobuble - buble whit the name of the 1 button you're on
portbuble - buble whit the name of the 2 button you're on
when you press the 1 or 2 button it pays itself from the 31 frame to the 54 (in both cases)
Code:
stop();
var rewind:Boolean = true;
// PORTFOLIO BUBLE
//ROLLOVER
function overportfolio (event:MouseEvent): void
{
if (portfolio.currentFrame > 31){
this.removeEventListener (MouseEvent.ROLL_OUT, outportfolio);
this.removeEventListener (MouseEvent.ROLL_OVER, overportfolio);
} else {
rewind = false;
portbuble.play();
}
}
//ROLLOUT
function outportfolio (event:MouseEvent): void
{
rewind = true;
}
function bublechackerportfolio (event:Event): void
{
if(rewind) {
if(portbuble.currentFrame != 0) {
portbuble.prevFrame();
}
}
}
//CLICK
function cllickportfolio (event:MouseEvent): void
{
portfolio.play();
portfolio.removeEventListener (MouseEvent.CLICK, cllickportfolio);
}
portfolio.addEventListener (MouseEvent.ROLL_OVER, overportfolio);
portfolio.addEventListener (MouseEvent.ROLL_OUT, outportfolio);
portfolio.addEventListener (Event.ENTER_FRAME, bublechackerportfolio);
portfolio.addEventListener (MouseEvent.CLICK, cllickportfolio);
//INFO BUBLE
//ROLLOVER
function overinfo (event:MouseEvent): void
{
if (infor.currentFrame > 31){
this.removeEventListener(MouseEvent.ROLL_OUT, outinfo);
this.removeEventListener(MouseEvent.ROLL_OVER, outinfo);
} else {
rewind = false;
infobuble.play();
}
}
//ROLLOUT
function outinfo (event:MouseEvent): void
{
rewind = true;
}
function bublechackerinfo (event:Event): void
{
if(rewind) {
if(infobuble.currentFrame != 0) {
infobuble.prevFrame();
}
}
}
//CLICK
function cllickinfo (event:MouseEvent): void
{
infor.play();
infor.removeEventListener (MouseEvent.CLICK, cllickinfo);
if (portfolio.currentFrame == 54) {
portfolio.prevFrame();
}
}
infor.addEventListener (MouseEvent.ROLL_OVER, overinfo);
infor.addEventListener (MouseEvent.ROLL_OUT, outinfo);
infor.addEventListener (Event.ENTER_FRAME, bublechackerinfo);
infor.addEventListener (MouseEvent.CLICK, cllickinfo);
Please help!!
And sorry for my bad English.
-
-
absolutezero342 tnx for replying, but ass always, I already found the solution.
It look's like I have to do it alone all the time, which isn't always a bad thing.
Basecly what i had to do was:
put the code into the button's itself (it was in the main timeline).
put another code to do the rewinding of the second part of animation for each button in the main timeline, because i somehow couldn't call the movie clip that was outside from inside the button (is this even possible?).
Here is the code if someone else has the same problem and if some one knows the better way to do it please tell me
Main timeline:
Code:
stop();
var rewind:Boolean;
var rewind2:Boolean;
portfolio.addEventListener (MouseEvent.CLICK, port_bt_click);
portfolio.addEventListener (Event.ENTER_FRAME, port_bt);
function port_bt_click (event:MouseEvent): void
{
if (infor.currentFrame == 55){
rewind = true;
portfolio.addEventListener (Event.ENTER_FRAME, port_bt);
}
}
function port_bt (event:Event): void
{
if(rewind) {
infor.prevFrame();
if(infor.currentFrame == 31) {
portfolio.removeEventListener (Event.ENTER_FRAME, port_bt);
}
}
}
infor.addEventListener (MouseEvent.CLICK, infor_bt_click);
infor.addEventListener (Event.ENTER_FRAME, infor_bt);
function infor_bt_click (event:MouseEvent): void
{
if (portfolio.currentFrame == 55){
rewind2 = true;
infor.addEventListener (Event.ENTER_FRAME, infor_bt);
}
}
function infor_bt (event:Event): void
{
if(rewind2) {
portfolio.prevFrame();
if(portfolio.currentFrame == 31) {
infor.removeEventListener (Event.ENTER_FRAME, infor_bt);
}
}
}
Button:
Code:
stop();
var rewind:Boolean;
portbuble.addEventListener(Event.ENTER_FRAME, portfoliobuble);
this.addEventListener(MouseEvent.ROLL_OVER, over_port);
this.addEventListener(MouseEvent.ROLL_OUT, out_port);
this.addEventListener(MouseEvent.CLICK, click_port);
function portfoliobuble(event:Event):void {
if(rewind) {
portbuble.prevFrame();
}
}
//ROLL_OVER
function over_port(event:MouseEvent):void {
rewind = false;
if (currentFrame > 31) {
this.removeEventListener(MouseEvent.ROLL_OVER, over_port);
this.removeEventListener(MouseEvent.CLICK, click_port);
} else {
portbuble.play();
}
}
//ROLL_OUT
function out_port(event:MouseEvent):void {
rewind = true;
}
//CLICK
function click_port(event:MouseEvent): void {
this.play();
}
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
|