sorry i misread it, i thought u needed to double i, but it seems you want to
up it by 2, that's i+=2.
On Sun, Jul 13, 2008 at 1:25 PM, Hans Wichman <
[EMAIL PROTECTED]> wrote:
> Hi,
>
> function f1(e:MouseEvent):void {
> var i:Number = 2 ; //set i to 2
> if (i < 10) { //if i<10 => true, so this always executes
> i = i++; //i = now 3
> trace("i = " + i); //traces 3 not 2?
> }
> you probably want to declare i as an instance variable, not a local var and
> then do i += i; or i *= 2; or i <<= 1;
>
> greetz
> JC
>
> On Sun, Jul 13, 2008 at 12:56 PM, Bassam M <[EMAIL PROTECTED]> wrote:
>
>> Hi guys
>> I have this simple question
>> I have this script
>>
>> btn.addEventListener(MouseEvent.CLICK, f1);
>> function f1(e:MouseEvent):void {
>> var i:Number = 2 ;
>> if (i < 10) {
>> i = i++;
>> trace("i = " + i);
>> }
>> }
>> I want to multiple i when I click on btn I m getting i = 2 always i don't
>> understand I need to change fon first click 2 then second 4 and so until
>> 10
>>
>> thank u
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders