PDA

View Full Version : I know I'm going to kick myself...


jamief
03-17-2005, 07:20 PM
But I'm going mad here...

All i want to do is create a new variable called 'pics_max' that is one greater than the variable 'totalpics'. (total pics is currently set to 4)


// I've tried:
pics_max = totalpics + 1;
trace (pics_max);

// and:
pics_max = Number (totalpics + 1);
trace (pics_max);


... but each time i get '41' instead of '5'. Both variables have been data typed 'Number'. Someone please put me out of my misery....

Jamie

Flash Gordon
03-17-2005, 07:25 PM
var total_pics:Number = 4;
var max_pics:Number =total_pics +1;

CyanBlue
03-17-2005, 07:26 PM
Howdy and Welcome... :)

I guess somehow the data type is not set correctly...

Try this...

var totalpics:Number = 4;
var pics_max:Number = totalpics + 1;
trace (pics_max);

And, make sure that you are publishing for AS 2.0... ;)\

And... Please use more descriptive topic next time...

senocular
03-17-2005, 07:55 PM
you were close with pics_max = Number (totalpics + 1);

you need
pics_max = Number (totalpics) + 1;

nthpixel
03-18-2005, 12:27 AM
I wonder if pics_max = totalpics++ works.

jamief
03-18-2005, 10:05 AM
Thanks everyone - That's sorted it