Image resize depending on number of clicks

  • Hi everyone,

    I was wondering if i could resize the image depending on what click number it is on. For example, I want to declare a variable called count = 0 in the beginning of my scene. Everytime the image is clicked, that count variable will increment. If count is odd, then make the image smaller, but if count is even, then make the image the original size. I was wondering if i would have to make a javascript function within my XMl file to do this; would I have to use an <action> and make the type "Javascript" ? Thank you.

  • Hi,

    here a small code snippet for counting the clicks and checking for odd or even:

    Best regards,
    Klaus

  • Hi,

    here a small code snippet for counting the clicks and checking for odd or even:

    Code
    if(clickcounter === null, set(clickcounter,0));
        inc(clickcounter);
        trace('clicks=',clickcounter);
        if( (clickcounter BAND 1) == 1, 
            trace('- odd number of clicks');
          , 
            trace('- even number of clicks');
        );

    Best regards,
    Klaus

    Thanks Klaus! Works flawlessly

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!