BitmapData object limitations

I'm developing a tile based side scrolling game (similar to
mario brothers) using the BitmapData object to create the map. the
problem is the maximum width the BitmapData object will support is
2880 pixels, which makes each level to short. I'd like it to be at
least 50% bigger.
Does any body know a way to increase this? Please help.

use more than one bitmap.

Similar Messages

  • New to FLEX, Writing text on a BitmapData object

    Hello,
    it has been quite some time since I coded in actionscript, I am a java  developer who is struggling to learn some game oriented actionscript.
    The problem:
    I have a double buffering schema using a canvas declared on the MXML  file and a bitmapdata on a class as the back buffer. the enterframe  method paints the bitmapdata into the canvas thus updating the screen.
    I know I can add graphics to the bitmapdata object but I want to write  some text into the bitmapdata. How can I do that?

    You can convert Text into bitmapdata and write it.

  • Devicenet object limitation​s

    Hello, We have a PXI with an 8461 Devicenet card as well as other cards running, communicated to by a third party software written in Labview 8.2.1.  We are experiencing an issue when only 25 or so devicenet objects are capable of being loaded and communicated with.  I know Devicenet can have up to 63 macIds, and we are not even close to loading that many and the application will just crash.  Could it be a LabView resource limitation, bus issue...  I do notice the CPU spike when loading the configuration for the Devicenet objects, have plenty of memory though.  Anyone else experiencing a limitation when using LabView when communication with multiple devices on a single devicenet network.

    There is definitely an object limitation of 50 including the Port handle so 49 objects for a one port device and 24 for a two port device per port.
    The only solution for that is to use a second board in parallel. But I don't know your App. can handle that. Is ther eany kind of error message/number you are getting?
    DirkW

  • Custom Object Limitations

    Hello guys,
    I am trying to document all the limitations of custom object and new features added in new releases of COD.
    If anyone has any documentation or want to share some points, it will be greatly appreciated.
    Thank you,
    asmi

    The number of custom currency in CO 1-6 is 25. The number of custom picklist in CO 1-6 is 100. The number of custom short text fields in CO 1-3 is 60. The number of custom short text fields in CO 4-6 is 90. The number of custom long text fields in CO 1-6 is 30. You will find a table providing this information (page 928-930) in the R17 Online Help document.

  • Beta 2 Object Limits?

    When trying to import a file from AI, I got the following message:
    "The design file you have selected has too many objects to import into this beta version of Adobe Flash Catalyst.Please consider rasterizing complex groups or layers, then try importing it again."
    What is the limit amount? Will this increase with beta 3? Or full release?
    Thanks

    I am trying to open my first AI project in Flash Catalyst but it is not being friendly to me (or I too it evidently)
    I am getting the following error message when trying to open the Ai from Catalyst...
    "The design file you have selected has too many objects to import to Adobe Flash Catalyst"
    It then tells me I should flatten some layers.
    I can't see this being the case because I only have 25 total layers comprising of:
    2 simple rectangle paths w/gradient
    2 arrow symbols
    2 Jpegs
    19 text layers
    I'm on a running Snow leopard on a Mac Pro.
    -Daniel

  • Bitmap/picture/whatever size limitation in Adobe Air on iPhone.

    Hi
    I'm gonna start on a new app and was wondering what the max width and height of a picture can be?
    I will import a big picture into my Flash CS5.5 (pro) and place it in a movieclip.
    I found this info on an old site from 2008:
    Note: The maximum dimensions of a bitmap in Flash Player is limited to 2880 pixels in either direction (width or height). If you attempt to create a BitmapData instance that is larger than this restriction, the Bitmap will not be created. This limit is in place to keep people from creating Flash movies that gobble up the client’s RAM. A bitmap that is 2880 x 2880 pixels, will use roughly 32MB of RAM.
    I'm not sure if that is the limit of today's flash version. I'm using Flash CS5.5 Pro.
    And íf now, let's say the max width and height of a picture (or should I rather say bitmap?) is 2880x2880, will the limit change in any way if it's placed in a movieclip?
    According to some more info on the same site, there's no limit if you do a "trick":
    [Workaround] Flash Bitmap maximum width and height
    The trick is to “kidnap” a BitmapData object from a loaded image with dimension over the limit of 2880 pixels (Which flash allows. Huh! Yes Flash can actually handle bitmaps larger the the limit. It just doesn’t let you create one.).
    It’s simple. Create a dummy image with the dimension you need. Save it and make it accessible to Flash. Dynamically load it using ActionScript. And take the loader object’s BitmapData object. That’s why I termed it “kidnap”. We are actually just taking the child of the parent object(loader object), which is the BitmapData, and use it like we build it ourselves.
    Here’s the actionscript ,
    // 1. Create an image loader and
    var DummyImageLoader:Loader = new Loader;
    // 2. Assign a function to “kidnap” the BitmapData object
    DummyImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, DummyImageOnComplete);
    // 3. Load the image with the preferred dimension
    var DummyImageRequest:URLRequest = new URLRequest(“dummy_image.jpg”);
    DummyImageLoader.load(DummyImageRequest);
    function DummyImageOnComplete(evt:Event):void {
         var DummyImageBitmap = Bitmap(DummyImageLoader.content);
         // “kidnap” the BitmapData object
        var ValidBitmapData:BitmapData = DummyImageBitmap.bitmapData;
        // you can now use ValidBitmapData to draw any element larger than 2880×2880
    var InvalidBitmapData:BitmapData = new BitmapData(3000, 3000);
    Now, I don't think I can do it this way anyway, I need to import it and manually put stuff on the picture in the movieclip in the Flash IDE.
    Is there a difference in picture size limit between normal Flash stuff (no Adobe Air) and Adobe Air? Maybe the picture limit also changes if the app is made for an iPhone?, ie, size limit for Adobe Air could be 2880x2880, but the iPhone can only handle max 2000x2000 so I must not do bigger than 2000x2000.
    Speaking of picture size limits in Flash, I experienced a problem once in Flash MX. I had a picture of max size imported, I could scroll to the far right, left, up and down in the Flash Player (not IDE, this was with code) and I could see every bit of the picture, so it all worked ok... but for some reason, the graphics I manually placed on the picture (the graphics were tiny objects I've drawn myself placed in movieclips) only showed in a limited area... for instance:   the big picture I imported was 2880x2880, I have the starting position in the bottom right corner of the picture. I place some graphics on the picture far apart from each other.. first one on .x=2880/y=2880 (bottom right), then I placed several from that position to the far left, til I reached x=0/y=2880... for some reason the graphics half way to the left stopped showing. I only placed like 10 small things. So, if the picture size limit is 2880x2880, it can not show anything else beyond a certain point? only the picture itself?
    I apologize for my somewhat bad English... I find it hard to express what I want to say

    Ah, nice page... 16.7X mill seems to be the rough number.
    I didn't look such pages up as I wasn't sure, and still arn't if that size applies to everything with Flash. Could vary depending on what it's used for, like Adobe Air desktop apps, Adobe Air iPhone apps etc.... But I guess I'll just have to accept and hope it's the same for all.
    The largest square bitmap allowed is 4,095 x 4,095 pixels.  Nonrectangular size limits vary, for example, the following sizes all fit within Flash Player 10 limits:
    2169 x 7735
    3133 x 5355
    3315 x 5061
    3615 x 4641
    4095 x 4097
    4097 x 4095
    4641 x 3615
    5061 x 3315
    5355 x 3133
    7735 x 2169
    So guess I could make any size I want, as long as it's not above 7735xXXXX / XXXXx7735 and 16.7X million pixels.
    Wonder if that's how it is, or if I could have like 10000x1600...couldn't find that answer on that page.

  • Is there a way to use a single bitmapdata for multiple images with GPU mode?

    With GPU mode is there a way to bring in a single 1024 X 1024 png containing all my sprites and then slice it up into multiple display objects all refering to the original BitmapData?
    I have an app that runs in GPU mode - but I want to optimize the image management.
    I am making three sets of images in the orders of 2048, 1024 and 512 px.
    The app is a book app and each page has around 4 to 5 bitmaps. I would like to bring in one single image and slice it up - but just refer to the original bitMapData in the memory.
    Is there a way to do this - e.g. using a masking technique?
    I think it is possible using textures in direct mode - but that is not an ideal solution for me - as the app is already in the appstore - and I would have to entirely refactor it for stage3D. Also I use very large bitmaps which have some masking animations applied to them dynamically: http://youtu.be/Nm0T1jLCTz8?t=42s
    Currently, I use jpgs and a jpeg mask file for each image which I composite to get the alpha - then I scale them.
    PNGs may be better for GPU - (no compositing) but they make for a huge app file.
    Now I am converting it to use diffent sized assets depending on the device, then scaling them if need, and then compositing them for apha.  What I was hoping was to find a technique that could reduce the number of bitmapdata objects used and reduce the operations in general. 
    Any thoughts on optimizing would be appreciated.  I can add my code here if it helps.

    Tell Apple:
    http://www.apple.com/feedback/iphone.html
    We're all users here, just like you.

  • Using jpegEncoder object and filesystem

    Hi, I also posted this in the Flex general forum, but it
    seems to be more AIR related since it deals with saving to the
    local disk. I am trying to create a simple AIR application that
    creates a thumbnail from an image component and saves it as a jpeg
    to the desktop. I am not sure where I am going wrong here, but the
    file is corrupt and no information is being written to it. If I
    look at the content (via the "more" command on the command line) it
    is 8 blank lines.
    Thanks so much,
    Jed
    =========
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    import mx.graphics.ImageSnapshot;
    import mx.graphics.codec.*;
    import mx.events.FileEvent;
    private function captureImg():void{
    //captures the image as a jpg and saves it to the desktop
    var codec:JPEGEncoder = new JPEGEncoder();
    //var ba:ByteArray = new ByteArray;
    var file:File =
    File.desktopDirectory.resolvePath("test.jpg");
    var filestream:FileStream = new FileStream;
    var snapShot:ImageSnapshot = new ImageSnapshot;
    snapShot = ImageSnapshot.captureImage(bigImg,72,codec);
    filestream.open(file, FileMode.WRITE);
    filestream.writeBytes(
    codec.encodeByteArray(snapShot.data,420,120),0,snapShot.data.length);
    filestream.close();
    private function makeSmall():void{
    //makes the image on the screen thumbnail size
    var pic:Image = bigImg;
    pic.setActualSize(420, 120);
    ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="center" verticalAlign="top">
    <mx:Image id="bigImg" width="480" height="320"
    source="orignial/test2.jpg"/>
    <mx:Button label="Reduce Size" id="btnSmaller"
    click="makeSmall();" />
    <mx:Button label="Snap Thumbnail" id="btnThumbnail"
    click="captureImg();"/>
    </mx:VBox>
    </mx:WindowedApplication>
    Text

    Well I didn't get any feedback here on this problem. But I
    did figure it out.
    ===============
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    import flash.display.BitmapData;
    import mx.graphics.codec.JPEGEncoder;
    import flash.filesystem.*;
    private function captureImg():void{
    ** A bitmapData object is needed to contain the visual data
    var bmpd:BitmapData = new BitmapData(
    smallImg.width,smallImg.height, false, 0xFFFFFF);
    bmpd.draw(smallImg);
    ** the bitmapdata object needs to be encoded into an
    byteArray with
    ** the JPEGEncoder. there is also a PNGEncoder for .png
    files if wanted
    ** The paramerter passed is the quality of jpeg we are
    encoding, 50 - 100.
    var jpegEnc:JPEGEncoder = new JPEGEncoder(80);
    var ba:ByteArray = jpegEnc.encode(bmpd);
    ** Then we need to take the byteArray and save it to disk.
    ** this requries using a File and fileStream object. The try
    block
    ** catches the end of file error.
    var file:File =
    new
    File("file:///Developer/Flex/thumbnailDemo/src/thumbnail/thumb1.jpg");
    var filestream:FileStream = new FileStream();
    try{
    filestream.open(file, FileMode.WRITE);
    filestream.writeBytes(ba);
    filestream.close();
    }catch (e:Error){
    trace(e.message);
    filePath.text = file.name + " has been saved to " +
    file.nativePath;
    filePath.enabled = true;
    ** makeSmall reduces the size of the main image and places
    it in
    ** the smallImg component to await capture
    private function makeSmall():void{
    //makes the image on the screen thumbnail size
    var pic:Image = bigImg;
    var otherPic:Image = smallImg;
    smallImg.source = bigImg.source;
    otherPic.setActualSize(120, 80);
    ** loadThumb loads the saved thumbnail to the savedPic
    component
    private function loadThumb():void{
    var thumb:File =
    new
    File("file:///Developer/Flex/thumbnailDemo/src/thumbnail/thumb1.jpg");
    if (thumb.exists){
    var src:File = new
    File("file:///Developer/Flex/thumbnailDemo/src/");
    var relPath:String = src.getRelativePath(thumb);
    savedPic.source = relPath;
    filePath.text = "The Thumbnail has been sucessfully loaded
    from "
    + thumb.nativePath;
    ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="left" verticalAlign="top">
    <mx:HBox>
    <mx:Image id="bigImg" width="480" height="320"
    source="orignial/test2.jpg"/>
    <mx:VBox verticalAlign="top" horizontalAlign="center">
    <mx:Label text="Thumbnail"/>
    <mx:Image id="smallImg" width="120" height="80" />
    <mx:Label text="Saved Thumbnail" />
    <mx:Image id="savedPic" width="120" height="80" />
    </mx:VBox>
    </mx:HBox>
    <mx:HBox horizontalAlign="left">
    <mx:Button label="Reduce Size" id="btnSmaller"
    click="makeSmall();" />
    <mx:Button label="Snap Thumbnail" id="btnThumbnail"
    click="captureImg();"/>
    <mx:Button label="Load Thumbnail" id="btnLoad"
    click="loadThumb();"/>
    </mx:HBox>
    <mx:Label id="filePath" enabled="false" />
    </mx:VBox>
    </mx:WindowedApplication>

  • BitmapData works in IDE, but not flash player

    I actually have 2 BitmapData objects that are drawing 2
    different movieclips, only one works in the browser, both work when
    testing in flash. Any ideas?
    Flash Pro 8.0
    Flash Player 9.47
    Firefox 2.0.0.6

    I inserted your code, these are the effects
    http://www.kingcommedia.com/newSite/projects.cfm
    roll over one of the balls, and in the middle will pop up a
    box with an image in it, under that box should be its reflection.
    That's the broken reflection, but notice the balls have
    reflections.
    Things got weirder, though- this is embedded using the
    dreamweaver ActiveContent script, so I published the html and
    tested that. The image's reflection worked in the html version BUT
    only on my machine, when I uploaded it here:
    http://www.kingcommedia.com/newSite/flash/orbitTest.html
    the reflection stopped working.
    My original tests were not on this server either- which is
    IIS on windows server 2003 running coldfusion enterprise
    7,0,2,142559 on JRun 4.
    I've been testing until now on my local machine which is
    Coldfusion developer 8,0,0,176276 in Apache 2.2 on windows xp pro
    sp 2
    to sum up:
    reflection doesnt work in
    dreamweaver generated code on cfm page on local SERVER and
    remote servers
    flash generated code on html page on remote ONLY
    reflection does work in
    flash generated code in html when called from windows, NOT
    the server
    if the reflection works for you, please tell me what browser
    and version of the flash player you used
    The movie may be a little jittery, that's the smoke (desuade
    partigen) taking large amounts of cpu

  • Array size limitations... and prime number programs.

    What are they? I am an ameteur programmer who wrote an extremely efficient prime finding program, if i do say so myself. The program doesnt find high primes, just prime numbers from 1-1,000,000,000 so far. Thats one version, the next version i use is faster, but because it uses an ArrayList, it can only do the primes 1-10,000,000. I am trying to work the programs up to primes with 50 or more digits, but ArrayList runs out of space, Integer is too small, I dont quite know how to switch all my code to be compatable with BigIntegers, and I cannot find a limit to arrays. I guess that I could find big primes if a) Integer was bigger, b)I tried, but what i wanted to do, because the second program is way more effecient, is to use an array to store primes instead of an ArrayList. The only problem? Arrays cannot be appended, so I need to know the limit in size for an array... So far, from my tests, I have found the limit to be somewhere around, 15,380,277. The only problem with this is that every time i compile, i can use a different number. So I would like it if a) somone could tell me the limit to an array's size, b) ideas for programs that can find primes with 50 or more digits, c) Down below is the code, could someone tell me how to convert it to BigIntegers?
      private void primeFinder1root(int beg, int end){
        int tmp = 0;
        int counter = 0;
        int counter2 = 2;
        boolean flag;
        for(int n = 3; n < end; n+=2){
          if(n%5!=0){
            flag = true;
            for(int d = 3; d <= Math.sqrt(n) && flag; d+=2){
              counter++;
              if(n%d == 0)
                flag = false;
            if(flag){
              System.out.println(n);
              counter2++;
              tmp = n;
              if(counter2%100000 == 0)
                System.out.println(n);
        System.out.println();
        System.out.println("The program looped " + counter + " times. There were " + counter2 + " primes found. "
                             + tmp + " was the last prime found.");
      }That is the first progam that does not use an ArrayList, but is still extremely effecient, it only looped 1,744,118,556 times to find the primes 1-100,000,000 which seems like a lot, but it truely isn't. I realize that by using counters and printing, I am slowing the program down immensly, but i am fine with that.
      public void primeFinder(){
        boolean flag;
        int tmp = 0;
        int tmp2 = 0;
        int counter = 0;
        primes.add(2);
        for(int n = 3; n < end; n+=2){
          if(n%5!=0){
            flag = true;
            for(int i = 0; i < primes.size()/2 && ((Integer)primes.get(i)).intValue() <= Math.sqrt(n) && flag; i++){
              tmp = ((Integer)primes.get(i)).intValue();
              if(n%tmp == 0)
                flag = false;
              counter ++;
            if(flag && n!=1){
              System.out.println(n);
              primes.add(n);
              tmp2 = n;
              if(primes.size() % 100000 == 0)
                System.out.println(n);
        primes.add(0, 1);
        System.out.println(counter + " " + primes.size() + " " + tmp2);
      }This is the code that stores all the primes it finds in an ArrayList, and then compares all numbers to the ArrayList of primes. This is extremely more effecient than the first, looping only 278,097, 308 times to find the primes 1-10,000,000 (the other looped 868,772,491 times). I used 10,000,000 as my example because this program cannot go to 100,000,000 because there are 5,761,455 primes and the ArrayList can only hold ~4,000,000 objects. Because of this ~4,000,000 object limitation on the ArrayList I have set my sites on the Array. This is the reason why I want to know the limitations of an Array if you could please tell me. If you could also, I would like help making my code compatable with BigIntegers as well.
    Well, sorry for the very long post, but thank you if you answer it and took the time to read it.
    Dumber_Child

    I too was in the quest to develop the most efficient prime number code few years ago when I was a student.
    Here is a more fine tuned version for your code
       public static long findPrimes(int max, ArrayList out){
          long count=0;
          FastList primes = new FastList((int)Math.sqrt(max));
          primes.add(2);
          for (int i=3; i<=max; i+=2)
             int al_size = primes.size();
             double sqrt = Math.sqrt(i);
             boolean prime_flag =true;
             boolean loop_flag = prime_flag;
             for (int j=0; j<al_size && loop_flag; j++)
                int val = primes.get(j);
                if (i%val == 0)
                   loop_flag = prime_flag = false;
                else if (val > sqrt)
                   loop_flag = false;
                count++;
             if (prime_flag)
                primes.add(i);
          primes.addToArrayList(out);
          return count;
    Following a data structure to store the prime numbers while processing
    Since this holds first number of primes in an array instead of in an ArrayList
    the get will work much faster and for those elements the casting is not required
       static class FastList
          ArrayList list = new ArrayList();
          int cache[];
          int pointer = 0;
          int fastAreaSize;
          public FastList(int fastAreaSize){
             cache = new int[fastAreaSize];
             this.fastAreaSize = fastAreaSize;
          public void add(int i){
             if (pointer < fastAreaSize)
                cache[pointer] = i;
             list.add(new Integer(i));
             pointer++;
          public int size(){
             return pointer;
          public int get(int i){
             if (i<fastAreaSize)
                return cache;
    else
    return((Integer)list.get(i)).intValue();
    public void addToArrayList(ArrayList al){
    for (int i=0; i<pointer; i++)
    if (i<fastAreaSize)
    al.add(new Integer(cache[i]));
    else
    al.add(list.get(i));
    When running in my pc
    above code detected primes within range 0-10000000 in 281809517 iterations within 6.718secs
    while your original code did the same in 278097308 iterations within 13.687 secs.
    By the way i removed the check for '5' thats why my code does more iterations.
    Notice that I have relocated code like Math.sqrt and ((Integer).....).intValue() to reduce the re calculating the same thing. That saved a lot of time.

  • Getting square magnifying filter, even though it's defined by a circular object.

    So I have created a magnifying effect in AS3 where the BitmapData collected is filtered through a shape that is circular.
    However, when I test this out, the distortion filter goes beyond the object's circular bounds and creates a square.
    When I go to mask the BitmapData, it says I cannot mask it.
    Problem:                                                                       
    Image Without:
    I just need the best method to make this BitmapData circular.
    My code:
    (the premise of this is, to have a ball tthat your drag and tracks the speed of throw to reflect bouncing speed on stage, while it bounces it magnifies an image, or can be dragged to magnify it)
    //Magnifying://
    var dPoint:Point = new Point(0, 0);
    var dMap:BitmapData = new BitmapData(object.width, object.height, true, 0x808080)
    dMap.draw(colorMap_mc)
    removeChild(colorMap_mc)
    var dFilter:DisplacementMapFilter = new DisplacementMapFilter ();
    dFilter.scaleX         = 30   
    dFilter.scaleY         = 30   
    dFilter.componentX     = 1           
    dFilter.componentY     = 2           
    dFilter.mode        = "color"   
    dFilter.color        = 0x000000   
    dFilter.alpha         = 0           
    dFilter.mapPoint    = dPoint;   
    dFilter.mapBitmap    = dMap;       
    Image_mc.filters = [dFilter]
    Image_mc.addEventListener(Event.ENTER_FRAME, onFrame)
    function onFrame(e:Event){
        dPoint.x += ((object.x-colorMap_mc.width/2)-dPoint.x)
        dPoint.y += ((object.y-colorMap_mc.height/2)-dPoint.y)
        object.x += xSpeed;
        object.y += ySpeed;
        dFilter.mapPoint = dPoint
        Image_mc.filters = [dFilter]
    Both my colormap_mc and object are round and exactly the same size.
    The square is the dimensions of the circular object, but alas, it's still a square.

    Yeah, but at further staring, I notice that the square doesnt have the magnifying filter.
    So the displacement's location doesn't seem to be the issue.  :-/

  • Can't use memory allocated in C to write then read BitmapData in AS

    Hi all,
    I've been attempting to use Alchemy to allocate a chunk of memory in C, and then write a bitmap to the memory (via getPixels) which is I would then be able to modify using my super fast C image processing functions.  I've been following the "Memory allocation in C with direct access in Actionscript (FAST!!)" section from here.
    The problem is that when I allocate the memory in C, then try to display the image using setImage, all I see is a black box on the screen.  The code below shows how I use getPixels to fill the C memory region with my bitmap data, then use setPixels to fill the BitmapData object which is displayed on the screen.  Does anyone know what I'm doing wrong here?  I've been really stuck on this
    ActionScript variables, and event function which runs after my Bitmap is loaded
            private var _dataPosition:uint;
            private var displayedImage:Image;
            private var bmp:Bitmap;
    public function loaded(e:Event):void {
                bmp = e.target.content as Bitmap;
                // A setImage at the beggining of this function properly displays my image
                displayedImage.setImage(bmp.bitmapData);
                var loader:CLibInit = new CLibInit();
                var lib:Object = loader.init();
                var ns:Namespace = new Namespace("cmodule.alchemyrgr");
                var byteArray:ByteArray = (ns::gstate).ds; //point to memory
                var tmpByteArray:ByteArray = new ByteArray();
                var imgSize:int = bmp.width * bmp.height * 4;
                _dataPosition = lib.initByteArray(imgSize); //This is the position of the data in memory           
                var bounds:Rectangle = new Rectangle(0, 0, bmp.width, bmp.height);
                tmpByteArray = bmp.bitmapData.getPixels(bounds);
                byteArray.readBytes(tmpByteArray, 0, imgSize);
                byteArray.position = _dataPosition;
                bmp.bitmapData.setPixels(bounds, byteArray);
                displayedImage.setImage(bmp.bitmapData);
                //lib.clearByteArray(); //Free the bytearray
    C memory allocation function
    static AS3_Val initByteArray(void* self, AS3_Val args)
        AS3_ArrayValue(args, "IntType", &bufferSize);
        //Allocate buffer of size "bufferSize"
        buffer = (unsigned char*)malloc(bufferSize*sizeof(char));
        //return pointer to the location in memory
        return AS3_Int((int)buffer);
    Thanks in advance!
    Mark

    Hi Mark,
    I too attempted to use a method similar to yours to no avail. I posted my solution for passing bytearray data to/from alchemy here:
    http://forums.adobe.com/thread/773517?tstart=0
    There is full flash code and C++ code so you should be able to answer all your questions just by reading my post. However, one thing I see about how you're passing your pointer back to flash is:
        //return pointer to the location in memory
        return AS3_Int((int)buffer);
    I think should be:
        //return pointer to the location in memory
        return AS3_Ptr(buffer);
    You shouldn't be casting your char array as an int and returning it, just use AS3_Ptr(buffer) and that will return the actual memory address as an int to flash. I'm not 100% sure but I think this could be an issue. I use this method also in my code you can find in the link above so you can see the full implementation there. Hope that helps.

  • Saving BitmapData as jpeg file

    I've been working on an AIR image editing application for a
    few weeks now and i'm suddenly realizing that there seems to be no
    easy way to save BitmapData as a JPEG file. I have found flash
    examples that call php scripts in order to save jpegs, but is this
    even possible when running only local code? How can I do this???
    Will this functionality be available any time soon? Any suggests of
    ways to do this would be GREATLY appreciated.
    Thanks!

    Well I have only used the JPGEncoder class, but the
    PNGEncoder seems to work the same way... All I needed was something
    to take my BitmapData object and give me a ByteArray that can be
    written to meet the jpeg format specification. So basically, you'd
    do something like this:
    //assuming you already have some BitmapData called
    myBitmapData
    var stream:FileStream = new FileStream();
    stream.open(newFile, FileMode.WRITE);
    var bytes:ByteArray = new PNGEncoder().encode(myBitmapData);
    stream.writeBytes(bytes);
    stream.close();
    If you need to do something a little different, you might
    need to look through the functions in the PNGEncoder class a little
    more.
    Also, if you were implying you're actually confused as to how
    to import the corelib, you should be able to either import it as a
    new project or import the com.adobe.images package into your
    current project and use the classes that way.
    Hopefully this helps... I'm still sorta just getting the hang
    of this stuff myself.

  • BitmapData.draw() failing to draw entire MovieClip

    Hi, all;
    I'm trying to do some lean blitting for an object that rotates by rotating it once at startup and capturing a BitmapData snapshot of each 5 degrees.  The problem I'm having is that the draw() method of the BitmapData object is only picking up pixels in the MovieClip that are below and to the right of the registration point.  If I change the MC so that the registration point is in the top left corner, I sometimes get what looks like most of the pixels, but the entire object rotates into and out of the frame, since it's rotating around the corner and not the center.
    Has anyone encountered this before, and if so is there a fix?
    Thanks;
    Amy Blankenship
    flexdiary.blogspot.com

    I think you're misunderstanding the question.  I am using a matrix to transform it, and that lower right quadrant of the MovieClip rotates perfectly as inended, but the rest of the object isn't captured as if it weren't there.
    Here's the code:
    package com.magnoliamultimedia.datastructures
    import flash.display.BitmapData;
    import flash.display.IBitmapDrawable;
    import com.magnoliamultimedia.datastructures.IChain;
    import com.magnoliamultimedia.datastructures.IChainable;
    import flash.geom.Matrix;
    import flash.geom.Rectangle;
      * RotationChain takes an IBitmapDrawable and rotates
      * it through 360 degrees, creating a BitmapDataLink
      * for each incremental rotation
      * @author Amy Blankenship
    public class RotationChain implements IChain
      //private storage for the chain entry point
      private var _defaultNode:IChainable;
       * Constructor
       * @param rotatingObj object to rotate
       * @param degrees number of degrees to rotate (must divide evenly into 360)
      public function RotationChain(rotatingObj:IBitmapDrawable, degrees:int=5, size:int=200)
       //first, check if degrees divides evenly into 360
       if (360 % degrees != 0) {
        throw new Error('Degrees must divide evenly into 360');
        //set to the default, so we still have a usable chain
        degrees = 5;
       var matrix:Matrix = new Matrix();
       var bd:BitmapData;
       var bdl:BitmapDataLink;
       var lastBDL:BitmapDataLink;
       var loops:int = 360 / degrees - 1;
       for (var i:int = 0; i < loops; i++) {
        /* Take "snapshot" of rotating obj with matrix applied.
         *  On the first loop, use the identity matrix.
        bd = new BitmapData(size, size);
        bd.draw(rotatingObj, matrix);
        bdl = new BitmapDataLink(bd);
        //check for any previous links that might have been added
        if (lastBDL == null) {
         //no? this is the default
         defaultNode = bdl;
        } else {
         //set up reciprocal arrangement with last node
         bdl.previous = lastBDL;
         lastBDL.next = bdl;
        //set this link as the last link
        lastBDL = bdl;
        //rotate next snapshot
        matrix.rotate(degrees);
       //connect the last link to the first link to make a circular chain
       lastBDL.next = defaultNode;
       defaultNode.previous = lastBDL;
      /* INTERFACE com.magnoliamultimedia.datastructures.IChain */
      public function get defaultNode():IChainable
       return _defaultNode;
      public function set defaultNode(value:IChainable):void
       _defaultNode = value;
    Is there anyone out there who does this kind of stuff?
    Thanks;
    Amy

  • Load a  external jpg in BitmapData

    Hello Everybody,
    I search a way to load a external jpg from my server in my
    swf to use
    it with the BitmapData-Class.
    The Method loadBitmap only works with images from my internal
    library.
    What do you think is the best way to solve this problem.
    For me it seems to be a little bit stupid to load the image
    in a MovieClip.
    Then Scan the Mc to write it in a BitmapData-Object.
    To Filter it. And then write it back to an MC.
    Do you know a way, where I can load it directly to and
    BitmapData-Object
    like this:
    1) load Image in BitmapData-Object
    2) Filter - Image
    3) attachBitmap to MovieClip
    I am a noob with Flash 8 and my english is very bad.
    So sorry and thanks for you help
    jm

    //import BitmapData
    import flash.display.BitmapData;
    //stop movie so it doesn't repeat over and over
    stop();
    //load a pic into an mc on the stage
    content_mc.loadMovie("flash.jpg", 1);
    //create a function that runs every frame (only for this
    example, it keeps running and you won't want that
    _root.onEnterFrame = function() {
    //this is the interesting bit, basically the next line is
    your preloader 100% action, the pic has to actually have been fully
    loaded before we can do this
    if (_root.content_mc.getBytesLoaded() ==
    _root.content_mc.getBytesTotal()) {
    //create a variable to hold the bitmapdata info
    myBitmapData = new
    flash.display.BitmapData(content_mc._width, content_mc._height,
    true, 0x00FFFFFF);
    //copy the bitmap into the bitmapdata variable we just
    created
    myBitmapData.draw(_root.content_mc);
    //now attach it to a different mc for the sake of example
    _root.content_mc2.attachBitmap(myBitmapData, 1, "auto",
    true);
    //rotate both movieclips so you can see the difference
    _root.content_mc._rotation = 30;
    _root.content_mc2._rotation = 30;
    supplied by myFlash83

Maybe you are looking for

  • Void Warranty From Opening?

    Was just wondering if just cracking off the back of the nano but not unscrewing anything will void my warranty. Just taking the back off and slapping it back on. How could they tell anyways. I have the apple warranty along with a 2 year retail store

  • Strategy escalation not appearing in the escalation node of UWQ.

    Hi, Module: Advanced Collections Customer has done the following test case: There are three work items in the collection strategy. First two work items are automatic and completed successfully. Third work item is manual and need to be escalated to ma

  • Dynamic Header (OBI report)

    Hi I have just started working on OBIE. Need some suggestions. Is there a way to put a dynamic header in the report. Eg: I want to display a text in the header as "Sales Report for Alabama" where Alabama is the state coming from the State prompt. I d

  • Looking for a book that would teach me Java from the ground

    Hi! I'm a high school student looking to learn a lot about Java Programming. I'm taking Computer Science III right now and I took Computer Science I last school year (My school don't offer Computer Science II). However, my Comp. Sci. I teacher was re

  • On field Cost Center in VA01

    Hi Experts, Please help me! I am integrating SD with FI-CA. I would like to add the field cost center in the tab account assignment. How can I do? Thanks