Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:45:38+00:00 2026-06-05T04:45:38+00:00

Flash AS3: I just need to know how to check a condition for roll

  • 0

Flash AS3:
I just need to know how to check a condition for roll over effect on similar colour movieclips which is near by in a group of random colours movieclips in a grid whereas it is using 2D Array in flash AS3.or
I just need roll over event which i wrote is onBoxOver event function, in that the object which i am targetting is only getting rollover or getting alpha changes. But i need to know how to make rollover for similar colour which are all nearby.

    The code which i wrote is below for your 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);

                for (var i:Number = 0; i<totalRowBoxes; i++)
                {
                    boxCollection[i] = new Array(i);
                    for (var j:Number = 0; j<totalColumnBoxes; j++)
                    {
                        var squareCont:square = new square();
                        squareCont.x = 30 + (i * rowGap);
                        squareCont.y = 30 + (j * columnGap);
                        squareCont.name = i + "_" + 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
            {
                for (var i:Number=0; i< totalRowBoxes; i++)
                {
                    for (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]

    Thanks in Advance. Greatly Appreciable for the reply.

Hi this is the image or screenshot of my project. In that image there are 8 colours randomly arranged. whenever i make mouse position or rollover on any box , the condition should check whether the same colour occurs around the box(eg.top, down, left, right) which i am making rollover.
1.If the same colour occur on the top of the box which i am pointing the cursor , the top box and the box which i am pointing both should get less alpha, else only the pointing box should get less alpha. this is my concept friends. please go through the image and let me know if u have any doubts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:45:40+00:00Added an answer on June 5, 2026 at 4:45 am

    I am still unsure what you mean by ‘nearby’. (neighbour tiles? adjacent of similar colour?…)
    If ‘nearby’ means adjacent, you need to read about flood fill algorithms. There is a good wiki article about this. You would use that to crawl through the list of tiles similar enough to trigger the effect you want.

    I also don’t know what ‘similar’ colour means in your project. You will need a method to determine weather two colours are similar. There is a stackoverflow question re: similar colour detection. It has a good answer to start you out in your research. look here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm just starting to learn flash and as3, i need to send to a
I currently have a flash (AS3) project which consists of a sketchpad onto which
I'm a Flash(AS3) newbie and this is just a little experiment of mine. I'm
I've been away from Flash as3 for a while, but today I need to
I have a bitmap in AS3 flash and I am sending it over to
My Flash (AS3/AIR) application is currently using a slightly unusual architecture (for a Flash
I've built an AIR application with flash/as3 that has a webcam display on the
How to pass information in this flow: Flash(AS3) -> PHP, using XML -> Database(mysql)
This is for a game in a flash AS3 only project. the player controls
I am working on a application in Flash AS3 with MDM ZINC 4 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.