1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Actionscript, disable function

Discussion in 'Programming' started by chaukar, Dec 8, 2010.

  1. #1
    Hello,

    I'm following this tutorial. http://www.riacodes.com/flash/falling-snow-christmas-card-with-as3/ to make an interactive christmas card.

    I want to make a button to stop the snowing. This is my code:

    /*Sneeuw begint hier*/
    addEventListener(Event.ENTER_FRAME, createSnow);

    function createSnow(event:Event):void {
    var snowflake : Snowflake = new Snowflake();
    snowflake.x=Math.random()*stage.stageWidth;
    snowflake.y=0;
    addChild(snowflake);
    snowflake.addEventListener(Event.ENTER_FRAME, moveSnowflake);
    }

    function moveSnowflake(e:Event):void {
    if (e.target.y<stage.stageHeight) {
    e.target.y+=10+Math.random()*1;
    e.target.alpha-=0.015;
    e.target.scaleX=e.target.scaleY-=0.01;

    } else {
    e.target.removeEventListener(Event.ENTER_FRAME,moveSnowflake);
    removeChild(e.target as Snowflake);
    }
    }
    /*Einde sneeuw*/


    /*Next knop*/
    next_btn.addEventListener(MouseEvent.CLICK,Next);
    function Next(event:MouseEvent):void {

    if (toestand==1) {
    initTypewriter(tekst2);
    } else if (toestand==2) {
    initTypewriter(tekst3);
    } else if (toestand==3) {
    initTypewriter(tekst4);
    } else if (toestand==4) {
    initTypewriter(tekst5);
    } else if (toestand==5) {
    initTypewriter(tekst6);
    bg_outdoor_mc.visible=false;
    //disable the snow??????????

    I'm new to actioscript 3, so please tell me how to stop the snow....
     
    chaukar, Dec 8, 2010 IP