iphone - Flash : How to write roll over coding for grid in array which is similar colour movieclips nearby? -


flash as3: need know how check condition roll on effect on similar colour movieclips near in group of random colours movieclips in grid whereas using 2d array in flash as3.or
need roll on event wrote onboxover event function, in object targetting getting rollover or getting alpha changes. need know how make rollover similar colour nearby.

    code wrote below reference. 

flash as3::

package  {     import flash.display.movieclip;         import flash.events.mouseevent;          public class playgame extends movieclip         {             public static var totalrowboxes:number = 13;             public static var totalcolumnboxes:number = 12;             public static var rowgap:number = 30;             public static var columngap:number = 30;             public static var totalcolorboxes:number = 8;             public static var boxcollection:array = new array();             public static var boxcollection1:array = new array();              public function playgame(thegame:main)             {                 // constructor code                 addboxonstage();             }              private function addboxonstage():void             {             var bordercont:banner = new banner();                 var scoreclipcont:scoreclip = new scoreclip();                 addchild(bordercont);                 addchild(scoreclipcont);                 scoreclipcont.x = 0;                 scoreclipcont.y = 0;                 createlevel(1);                  (var i:number = 0; i<totalrowboxes; i++)                 {                     boxcollection[i] = new array(i);                     (var j:number = 0; j<totalcolumnboxes; j++)                     {                         var squarecont:square = new square();                         squarecont.x = 30 + (i * rowgap);                         squarecont.y = 30 + (j * columngap);                         squarecont.name = + "_" + j;                         var boxcollection1:array = new array();                         boxcollection1[0] = math.round(math.random() * 8);                         boxcollection1[1] = squarecont;                         var boxcolour:number = new number();                         boxcolour = boxcollection1[0];                         boxcollection[i][j] = boxcollection1[1];                         addchild(squarecont);                         squarecont.gotoandstop(boxcollection1[0]);                         squarecont.addeventlistener(mouseevent.mouse_over, onboxover);                       squarecont.addeventlistener(mouseevent.mouse_out, onboxout);                                squarecont.addeventlistener(mouseevent.click, onboxclick);                         }                 }                 }              private function onboxclick(eve:mouseevent):void             {              }              private function onboxover(eve:mouseevent):void             {                 (var i:number=0; i< totalrowboxes; i++)                 {                     (var j:number=0; j<totalcolumnboxes; j++)                     {                         eve.target.alpha = 0.3;                         // trace(boxcollection[i][j].currentframe)                         trace(eve.target);                     }          }             }              private function onboxout(eve:mouseevent):void             {                 eve.target.alpha = 1;             }              private function createlevel(lvl):void             {              }           }        }      ![my game screenshot here colourbox][1]      in advance. appreciable reply. 

hi image or screenshot of project. in image there 8 colours randomly arranged. whenever make mouse position or rollover on box , condition should check whether same colour occurs around box(eg.top, down, left, right) making rollover. 1.if same colour occur on top of box pointing cursor , top box , box pointing both should less alpha, else pointing box should less alpha. concept friends. please go through image , let me know if u have doubts.

i still unsure mean 'nearby'. (neighbour tiles? adjacent of similar colour?...) if 'nearby' means adjacent, need read flood fill algorithms. there wiki article this. use crawl through list of tiles similar enough trigger effect want.

i don't know 'similar' colour means in project. need method determine weather 2 colours similar. there stackoverflow question re: similar colour detection. has answer start out in research. look here.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -