Cor thank you it's working

On 7/13/08, Bassam M <[EMAIL PROTECTED]> wrote:
>
> Yes sorry its traces 3 but I want to do something like on click multiple
> the i var or and variable as I said first click i=2 then second click i = 4
> and so untile i =10
>
> On 7/13/08, 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
>>
>
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to