PDA

View Full Version : funny "if statement"...



Master_thief
June 3rd, 2009, 07:02 PM
hii all...

I building a photoviewer with xml loaded pics...

my problem right now is that i should building the back button, but i dont know how ...

it should be:

when i press back-button(mc) (its placed on frame 10 to frame 20)
it should gotoandplay frame 21
and when its hits frame 30
it should read, if back-button was clicked it should play frame 50, if not it should play frame 31.

hope anyone understod my problem and can help me..... please...

thx

Shaedo
June 4th, 2009, 02:59 AM
how about make a global boolean variable and just check it at the right time ? eg...
in class global_variables

static var back:boolean = false;
then on frame 10-20

back_button.addEventListener(MouseEvent.CLICK, back_function);
function back_function(evt:MouseEvent):void
{
gotoAndPlay(21)
global_variables.back_pressed = true;
}
then on frame 30;

if(global_variables.back_pressed == true)
{
stop();
gotoAndPlay(50)
}
// this way if != true it will just proceed to frame 31 so no need for else statement

Master_thief
June 4th, 2009, 05:40 AM
thx...i can see what you are going...

mabye thisis tha solution...

but where should I place "static var back:boolean = false;"...?
shoul it be in the "master" as or what you'll like to call it...

or can i place it on the button at frame 10 - 20...?

thx again...:thumb:

__________________________________________________ ________

I now tryed to put this code on the button and on frame 30.. and thats great...

but i dont dont where to put the static var back:boolean = false; ...
when i put it in the overall AS, I get:

1012: The static attribute may be used only on definitions inside a class

does that mean that i have to build a class file...? or...?

PLEASE help me..:D