Increment global variable on click in flash, actionscript 3

Posted by msandbot on Stack Overflow See other posts from Stack Overflow or by msandbot
Published on 2010-05-24T18:28:27Z Indexed on 2010/05/24 18:31 UTC
Read the original article Hit count: 341

Hi,

Making a flash page that can cycle through these three images on mouseclick. For some reason the local changes to count are not reflected on the global one. I tried _global but the syntax was odd and gave me errors. How should I implement this?

import flash.events.Event;

var images:Array = ["images/image.jpg", "images/image2.jpg", "images/image3.jpg"];
var count:int = 0;

forward.addEventListener(MouseEvent.CLICK, loadPhoto);


function loadPhoto(evt:Event){

    if(count>2){
        count==0;
    }

    trace(count);
    imageFrame.source = images[count];

    count++;

}

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3