简体   繁体   中英

How to animate a button in ActionScript-3?

I have a game and I want to add some animations to it like highlighting things that can be used. (This is more about effects)

Example: see image below


If I want to highlight the green dices, how could I do that in theory? And with what tricks?
I thought of:

  • add glitter to buttons (easy)
  • shake buttons a bit (easy)
  • reflection effects (no idea ...)

What else can I do?

Thanks for any ideas and tips!


i frequently work with AS3 and what i usualy do when coding is the following: 1.Divide your Problem into small packages 2.Solve the first package and go on 3.Finetune your code for better dynamics and most importantly for further use so it can be used in other Projects to

Now to your problem: 1. How do you target the green dices only? 2. How do you target one dice only instead of all at once or none at all? 3. How do you dynamicaly add effects?

So first of all what Event qould you need, are you targeting them qith the keys? if yes then give the current element a boolean which turns active so you can go if(greenDice.true) do this the if statement needs to be in a constant loop. if you target it with your mouse it is a lot simpler, you can just use the mouseOver event and in it use an if statement if(e.currentTarget == greenDice) myFunction() in your called function you can animate it. Now you have it, you can call any event on your dice, the said effects qould probably be created with the flash filters http://www.republicofcode.com/tutorials/flash/as3filters/ change the different parameters in a loop and there you have it, check out other filters too. Have fun coding and best regards

Raphael

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM