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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:59:42+00:00 2026-06-05T12:59:42+00:00

I wrote application that lets people paint together via internet (using Adobe cirrus). Everything

  • 0

I wrote application that lets people paint together via internet (using Adobe cirrus). Everything works great but when for example I run my application and paint something before my friend connects, he dont see that what I have painted. So I’m looking for the method, that would let me convert my canvas into something(object) that it is possible to send by internet (I cant send whole Sprite, it’s not possible to copy its graphics on the friend’s application, it’s null).

So let’s get this clear. The main question is: How to convert graphic’s of Sprite into object, that would let me convert it back to Sprite and copy its canvas.

ANSWER:
I used DisplayConverter library from “www.Flextras.com” post with his mod to convert Sprite to BitmapData and then to ByteArray and it works. I couldn’t receive BitmapData on the friend’s app, but It worked with ByteArray.

Sprite -> BitmapData -> ByteArray;
ByteArray -> BitmapData -> Sprite;

//TO SEND
var bitmapdata:BitmapData = DisplayConverter.spriteToBitmapData(palette);
var bytearr:ByteArray = bitmapdata.getPixels(bitmapdata.rect);

//TO RECEIVE
var bmd:BitmapData = new BitmapData(530,430);
bmd.setPixels(bmd.rect, bytearr);       

mysprite.graphics.beginBitmapFill(bmd);
mysprite.graphics.drawRect(0,0,530,430);
mysprite.graphics.endFill();

Hope this will help someone

  • 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-05T12:59:43+00:00Added an answer on June 5, 2026 at 12:59 pm

    I think you want to convert your Canvas into a BitMap or BitMapData (and back). A Flex Canvas extends Sprite, so you can use a library like this one. To copy the relevant code, this will convert a Sprite to a BitMap:

        public static function spriteToBitmap(sprite:Sprite, smoothing:Boolean = false):Bitmap
        {
            var bitmapData:BitmapData = new BitmapData(sprite.width, sprite.height, true, 0x00FFFFFF);
            bitmapData.draw(sprite);
    
            return new Bitmap(bitmapData, "auto", smoothing);
    
        } // END FUNCTION spriteToBitmap
    

    This will convert a Bit Map to a Sprite:

        public static function bitmapToSprite(bitmap:Bitmap, smoothing:Boolean = false):Sprite
        {
            var sprite:Sprite = new Sprite();
            sprite.addChild( new Bitmap(bitmap.bitmapData.clone(), "auto", smoothing) );
            return sprite;
    
        } // END FUNCTION bitmapToSprite
    

    In my own development, I have a mod to this library, which allows me to get the BitMapData instead of an actual BitMap. So, this will turn a Sprite into BitMapData:

        public static function spriteToBitmapData(sprite:Sprite):BitmapData
        {
            var bitmapData:BitmapData = new BitmapData(sprite.width, sprite.height, true, 0x00FFFFFF);
            bitmapData.draw(sprite);
    
            return bitmapData;
    
        } // END FUNCTION spriteToBitmapData
    

    This will take BitMapData and turn it back into a Sprite:

        public static function bitmapDataToSprite(bitmapData:BitmapData, smoothing:Boolean = false):Sprite
        {
            var sprite:Sprite = new Sprite();
            sprite.addChild( new Bitmap(bitmapData.clone(), "auto", smoothing) );
            return sprite;
    
        } // END FUNCTION bitmapToSprite
    

    You do want to keep in mind that when converting the BitMap or BitMapData back into a Sprite you will probably not be able to cast it as a Canvas. For information on sending BitMapData to a server; look at this question.

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

Sidebar

Related Questions

I have wrote an application that syncs two folders together. The problem with the
(Using WPF) In a small application that I wrote, I am using some count-down
I wrote a simple web application that lets you mark flea market stands on
I wrote an application that re-hosts the Workflow 4 Designer (System.Activities.Presentation.WorkflowDesigner). Activities are discovered
I wrote an application that generates quiz applets. I could't find a portable way
I wrote a C# application that is a simple countdown timer. I use it
I have got a Wavecom Supreme GSM modem. I wrote a simple application that
I wrote an application in JAVA that adds articles to a Joomla site. My
I have a process that currently runs in a Delphi application that I wrote
I keep getting the error in VS 2100 CRT detected that the application wrote

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.