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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:19:59+00:00 2026-05-23T00:19:59+00:00

I have the following code ///Get BitmapData from library in SWC var ClassReference:Class =

  • 0

I have the following code

///Get BitmapData from library in SWC
var ClassReference:Class = getDefinitionByName(products[i].producticon+"Data") as Class;
// Create new BitmapData Instance From it
var bitMapS:BitmapData = new ClassReference();
// Create new Class that contains Bitmap Data
var IconBitmap:Class =  new AndroidAsset(bitMapS) as Class;
// Get String name from Class
var s:String = getQualifiedClassName(IconBitmap);
trace(s);

I get null in the trace. How do I make a dynamic class that I can refer to for this bitmap similar to how your reference a class from and embedded media?

  • 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-23T00:19:59+00:00Added an answer on May 23, 2026 at 12:19 am

    I’m not sure I understand you question exactly, but it sounds like you want a way to get a copy of this bitmap data in a manner similar to creating a new instance of a class. If that’s the case, you could do something like this :

    //grab the name of the asset as a string
    var bitmapDataAssetName:String = products[i].producticon+"Data";
    //get the asset definition from the SWC
    var CustomBitmapDataClass:Class = getDefinitionByName(bitmapDataAssetName) as Class;
    
    //store it in an associative array or dictionary for use later
    var myBitmaps:Array = [];
    myBitmaps[bitmapDataAssetName] = CustomBitmapDataClass;
    
    //then instantiate new bitmaps from the class definition that's stored in your array
    var testBitmapData:BitmapData = new (myBitmaps[bitmapDataAssetName] as Class)() as BitmapData;
    

    So, in a practical use scenario, your array of symbol definitions would be a member variable on some BitmapManager class or something. Then if you wanted to make it accessible from anywhere in your application, just make it a singleton, and presto – you can instantiate a new library asset from your SWC anywhere you need it with a call like this:

    var localBitmapData:BitmapData = new (BitmapManager.instance.definitions[theNameOfTheBitmapIWant] as Class)() as BitmapData;
    

    Or, a better way to do that would to be to add a method to BitmapManager like

    public function getBitmapAsset(assetName:String):BitmapData {
        var symbolDefinition:Class = myBitmaps[bitmapDataAssetName] as Class;
        return new symbolDefinition() as BitmapData;
    }
    

    so you could just call it up like this :

    var localBitmapData:BitmapData = BitmapManager.instance.getBitmapAsset("theNameOfTheBitmapIWant");
    

    Hope that helps (if that was even you question to begin with) 😛

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

Sidebar

Related Questions

I have written the following code: //get the user from the DB var tmpuser
i have following code to get center of width function alertSize() { var myWidth
I have the following code to get some data about companies: XDocument doc =
I have the following code: var div = $(<div id='3.5'>AA</div>); div_id_after = Math.floor(parseFloat(div.get(0).id)); $('#'+div_id_after).after(div);
I have the following code: (define (get-data) (define port (open-input-file ../data/problem11.txt)) (define field 0)
I have written following code to get JSON result from webservice. function SaveUploadedDataInDB(fileName) {
I have the following code to get a list of changed files from Subversion
I currently have the following code to get a specific value i need from
I have the following code making a GET request on a URL: $('#searchButton').click(function() {
I have the following code, for which I get the error: Warning : mysqli_stmt::bind_result()

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.