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 511909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:15:56+00:00 2026-05-13T07:15:56+00:00

EDIT (for clarification): I have a vector image with a simple contour, an irregular

  • 0

EDIT (for clarification):
I have a vector image with a simple contour, an irregular closed polygon.
I need to import it into Flash in a way that I can then programmatically access each of the segments that form the polygon.
Importing the vector image into the library as a MovieClip wasn’t good because all I get is a shape from which I can take no geometry information at all.
My goal is being able to calculate the polygon’s area and also calculating the intersection between the polygon and another polygon.
I guess I could write an Illustrator script that reads all the segments and writes a CSV files with their coordinates, but there has to be a simpler way, I mean, they’re both vectorial, they should understand each other.

Thanks!

.

— Old Post: —

I have a contour in vector graphics that I imported to the Flash library as a movieclip.
I Instanciate the movieclip and it has a Shape child which is the actual contour.
I need to be able to access the contour segments, i.e. the polygon’s sides, to be able to get their starting and ending points, is there a way?
the Graphics class only allows to draw but what you draw, as with the Shape class, are not objects, it’s not a polygon with sides or whatever.
Am I being clear?
Thanks

  • 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-13T07:15:56+00:00Added an answer on May 13, 2026 at 7:15 am

    There is no way to read the data of a Graphics object (which is essentially what contains the information that you are after.) This applies to any vector graphics object that has already been drawn, either by the Graphics/drawing API itself, or in Flash CS3/CS4, or was embedded using the [Embed] meta-tag.

    Your best bet if you need to calculate the algebraic area, or for some other reason retain the vectors in your algorithms, is definitely exporting an SVG or some single-purpose format (like a CSV of the points) from Illustrator, and parsing that in ActionScript.

    Another option is to use a BitmapData, and draw the Shape object onto that, then counting the colored (opaque) pixels to numerically calculate it’s area.

    var bmp : BitmapData = new BitmapData(myShape.width, myShape.height, true, 0);
    bmp.draw(myShape);
    
    var i : uint;
    var area : uint = 0;
    var num_pixels : uint = bmp.width*bmp.height;
    for (i=0; i<num_pixels; i++) {
    
      var px : uint = bmp.getPixel32(i%bmp.width, Math.floor(i/bmp.height));
    
      // Determine from px color/alpha whether it's part of the shape or not.
      // This particular if statement should determine whether the alpha
      // component (first 8 bits of the px integer) are greater than zero, i.e.
      // not transparent.
      if ((px >> 24) > 0)
        area++;
    }
    
    trace('number of opaque pixels (area): '+area);
    

    Depending on your application, you might also be able to use the BitmapData.hitTest() method for your collision detection.

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

Sidebar

Ask A Question

Stats

  • Questions 292k
  • Answers 292k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, see: http://www.scripts.com/viewscript/book-flip-slideshow/3626/ It is a free one. May 13, 2026 at 6:15 pm
  • Editorial Team
    Editorial Team added an answer You have to do a For Each for the form's… May 13, 2026 at 6:15 pm
  • Editorial Team
    Editorial Team added an answer f = open('data.txt', 'r') raw = f.readlines() #generate set of… May 13, 2026 at 6:15 pm

Related Questions

i am trying to extract outline path from given bitmap, i create a fast
With the help of the Stack Overflow community I've written a pretty basic-but fun
I have a linked list, which stores groups of settings for my application: typedef
I have a 'reference' SQL Server 2005 database that is used as our global
Suppose that I have a Java program within an IDE (Eclipse in this case).

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.