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

  • Home
  • SEARCH
  • 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 5932949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:54:21+00:00 2026-05-22T14:54:21+00:00

Good Morning, I have an existing Flash app that has a layer containing a

  • 0

Good Morning,

I have an existing Flash app that has a layer containing a square separated into 4 quadrants. A set of icons is provided to the user and he/she is asked to drag each icon into one of the quadrants.

Does Flash/AS3 provide a way to create a grid (not necessarily DataGrid) that overlays the existing image? If so, how do I setup AS3 syntax to save the quadrant in which an icon is placed?

Thanks much!!

  • 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-05-22T14:54:21+00:00Added an answer on May 22, 2026 at 2:54 pm

    If I understand your question correctly, you have a 2 x 2 grid into which icons are dragged. You need to save the position of a icon in this grid.

    Couple ways to do this but I think the easiest would be to use a little bit of math to determine where the icon is.

    If there is some button that indicates the user has placed the icon where he/she wants to then write your code in the handler for that button.

    The following will find the distance between the top-left corner of the grid and the top-left corner of the icon. You can use this to find how many quadrants over the icon is by dividing the x value of this distance by the width of a quadrant. In this case the width of a quadrant is half the size of the grid’s total width (because it is only 2 across). In order to find out how many quadrants down the icon is, do the same with the y component of the distance.

    var col:Number = Math.round( Math.abs(icon.x - grid.x) / (grid.width/2))+1;
    var row:Number = Math.round( Math.abs(icon.y - grid.y) / (grid.height/2))+1; 
    

    The Math.abs (absolute value function) is just in case the distance is negative for whatever reason. Without the +1 that expression would result in either 0 or 1 in col and row which would be fine if you considered the first quadrant to be 0 x 0 but since I said 2 x 2 grid it’d be nice to have the furthest corner of the grid to be 2 x 2.

    Also in order for this to work make the grid and the icon are both symbols with instance names. Instance names can be set in the properties window under “instance name” after clicking on the symbol on the stage (main work area).

    Furthermore should you implement this you’ll note that even if the icon is more than half way down a quadrant it will still register as being in the quadrant above. This is because in the code above we’re comparing the distance between the top left corners. In order to measure the distance between the center of the icon and the top left corner of the grid simply add half the height of icon to its y value like so:

    var row:Number = Math.round( Math.abs((icon.y+icon.height/2) - grid.y) / (grid.width/2))+1;
    

    Note I haven’t tested this code but in theory it should work.

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

Sidebar

Related Questions

Good Morning, I have created an ASP.NET 3.5 webform that allows users to search
Good Morning All, I have loaded over 1,300 blurbs into my client's database with
Good Morning, Say I have an insert statement: Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo','null')
Good Morning, I have got the following function: FUNCTION queryDatabaseCount(sqlStr) SET queryDatabaseCountRecordSet = databaseConnection.Execute(sqlStr)
Good morning, I have found that many of my customers have MS Access already
Good morning, I have an application that run well on iPhone but crash to
Good Morning, I have a SharePoint site that I've been trying to fix up
Good morning I'm trying to get a table row (TR) that must have one
Good morning, I have to layout some QWidgets and layouts into a main layout,
Good morning to everybody, :) I have writen a code in C++ that reads

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.