AS3 problem

A place for tutorials on how to get the most out of Flash

AS3 problem

Postby liossenel » Thu Apr 25, 2013 6:05 pm

Hi there.

with as3, i currently am using next main timeline "next frame" and "precedent frame" and stop. But i would like to be able to go like frome frame 1 (menu) to whatever frame and then stop. at this point I could do it, but then, in the chosen frame, i put the same code to navigate anywhere else, but then the flash starts going menu, then chosen frame in loop. like:

menu>frame 5>menu>frame 5 etc...

...endlessly. I don't know why. and this problem really limitate my possibilities.

I tried two codes:

Code: Select All Code
name of the button.addEventListener(MouseEvent.CLICK, onClickNextSlide);
function onClickNextSlide(event:MouseEvent):void{
gotoAndStop("number of the frame");
}


Code: Select All Code

stop();
name of the button.addEventListener
   (MouseEvent.CLICK, onClick);
function onClick
( event:MouseEvent):void
{
gotoAndPlay("number of the frame")
}


any idea(s)?
liossenel
 
Joined: Thu Apr 25, 2013 5:34 pm

Re: AS3 problem

Postby OwnerOfSuccuby » Thu Apr 25, 2013 10:19 pm

It is much more easier too see fla then the code - becouse problem can be not only in this part of code and you can see what mistakes it wrights.

But lets go step by step:

You have frame number 1 for example there is this code ?

MyBTN.addEventListener(MouseEvent.CLICK, onClickBTN);

function onClickBTN(e:MouseEvent):void{
gotoAndStop("number of the frame");
}


And what for is the next function - what names do it have ? May be you have 2 events on one button ? Or dublicate some thing ?

Or may be becouse you have
Code: Select All Code
gotoAndPlay("number of the frame")
- not a gotoAndStop("number of the frame")

Or may be you forget name your button :mrgreen:

Becouse this code works:

MyBTN.addEventListener(MouseEvent.CLICK, onClickBTN);

function onClickBTN(e:MouseEvent):void{
gotoAndStop("number of the frame");
}

But -
Code: Select All Code
"number of the frame"
- if it is string then yes you need "" (i mean you make name of the frame and go to that name)

If it is number of frame then:

MyBTN.addEventListener(MouseEvent.CLICK, onClickBTN);

function onClickBTN(e:MouseEvent):void{
gotoAndStop(3);
}

For example
OwnerOfSuccuby
 
Joined: Fri Jun 11, 2010 9:33 pm

Re: AS3 problem

Postby liossenel » Thu Apr 25, 2013 10:51 pm

thank you sir, problem seams to be solvedµ. you made my day ;)
liossenel
 
Joined: Thu Apr 25, 2013 5:34 pm


Return to Tutorials



Who is online

Users browsing this forum: No registered users