Buttons array

 

The goal is to show how to manage an array of buttons cloned from a genuine one..
The 3 states are under control.
A reset button switches all buttons to original state.
It 's basically a script and a good understanding of progamming is required.

⇒ See animation ⇐

Reset button gave me some trouble because I wished a neat code using some ActionScript methods :
AsBroadcaster.initialize(xxx); xxx.addListener( yyy ); yyy.broadcastMessage("une_fonction");
but I did not succeed. So, if somebody has got any idea...
Fortunately, I found out a so simple workaround I wonder why I did not think of it before.

We gonna describe the differents stages right away.

Creating Objects

1 - Set up movie sizes 460x315. Background color : 000000. Frame rate = 35.

2 - Create a square modele , as mentioned hereafter :

         

3 - Convert to sprite, name it btn.

4 - Create a dynamic text as shown :

    

5 - Creating reset button :
    - first framework :

    

    - then title :

    

Group, Convert to button named b_reset.
Play with colors.

SwishMax Script

Here's script for Scene_1

Here's script for b_reset
on (release)
{
    _root.removeAll();    // destroy sprites
    _root.initStates();    // rebuilt initial states
    _root.txtdyn = "";    // no button clicked
}

Here's script for btn

Et voilà, it's up to you.

 


Si vous aimez le site

 

Select a language if you need :


Page chargée en 0.003 sec.

Dernière Modification : Mer 25 Janvier 2017 8:56
Copyright © 1999-2017 Jean-Paul Molina Tous droits réservés.

to Google