Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 90089

Key Down Event in AS3 Problem

$
0
0

I have an template Slot game an want to start the Spin when the "a" is pressed. The AS code is externaly i stopped devolping Flash with AS2. No i couldn´t get the simple code to work. Here the Code from the Slot Games:

package net.nosov{

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    import net.nosov.utils.Utils;

    /**

     * ...

     * @author Nosov Vitaliy

     */

    public class Main extends MovieClip {

 

        public  var engine         : Engine

        public  var bet            : Bet

        private var help           : Help

        public  var balance_credit : IncreaseAnimation

        public  var balance_won    : IncreaseAnimation

        public  var balance_bet    : IncreaseAnimation

 

        // Define here how many images will be duplicated in slot

        // For example, if you have 5 images, they will duplicated to

        // have good smooth animation. Ussualy you don't need to change it

        public const images_total_spin   = 20

        // Spin time of slot, define in seconds

        public const spin_animation_time = 2

        // How many coins will take from CREDITS if user don't have

        // won combination. Also you need to remember about bet value

        // Final result will be spinCOST x User Bet

        public const spinCOST = 8

       

        public function Main() {

            Utils.root = MovieClip(this)

            engine = new Engine()

            bet    = new Bet()

            help   = new Help()

           

            btn_spin.buttonMode = true

            btn_spin.addEventListener(MouseEvent.CLICK, spind_do)

           

            // Credit text field

            balance_credit = new IncreaseAnimation(999, txt1, 7)

            // Won text field

            balance_won    = new IncreaseAnimation(0,   txt2, 5)

            // Bet text field

            balance_bet    = new IncreaseAnimation(1,   txt3, 2)

        }

       

        private function spind_do(e:MouseEvent):void {

            btn_spin.mouseEnabled  = false

            btn_spin.mouseChildren = false

            engine.spin()

        }

       

    }

 

}

 

 

Now i thought i have simply change the funkction btn_spin. But i couldn`t get it to work. Can someone assist me !


Viewing all articles
Browse latest Browse all 90089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>