• About WordPress
    • WordPress.org
    • Documentation
    • Learn WordPress
    • Support
    • Feedback
  • Log In
Skip to content

MonoFlauta

Indie Game Developer

Menu
  • Blog
  • Portfolio
    • Games
      • Happy Ghost Studio
      • Etermax
      • Silky Smooth Studio
      • Fun+Mono
    • Frameworks & Tools
      • Framework Goat
      • Twitch Mono Integration
      • Framework Mono
      • Narwhal Engine
    • Others
  • Store
  • About Me

Framework Mono – Visual/PixelColorReader.as

IconoThe PixelColorReader.as script will let you read all the colors of each pixel inside the stage. You will just need to call a static function and it will return you a Dictionary with the information. Note: This class doesn’t need an instance of Mono.as


How to use PixelColorReader.as

It is a really simple to use. You will just need to call the public static function readStageColors inside the class and send it the stage as parameter. You will recieve as result a Dictionary where as keys you will have the color and in value how many times it appears.

For example, imagine you want to trace all the colors with the ammount of times it appears. In order to do that, you will have to do the following:

 var result:Dictionary = PixelColorReader.readStageColors(stage);
 for(var k:Object in result)
 {
         trace("Key: "+k+" Value: "+result[k]);
 }

Note that the result of calling the function is a dictionary and we iterate it showing the key and the value of each index.

Also, you will note that there is an index called TOTAL in which it will tell you the total pixels it had read in case it is needed.


Public Static Consts

  • TOTAL:String = “Total”;

Public Static Functions

  • readStageColors(s:Stage):Dictionary

Powered by WordPress MonoFlauta 2025 | All Rights Reserved.

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}