ActionScript 3.0 :: Can't Get Bitmap To Resize

Dec 17, 2009

I've got an image that I need to programatically add to the stage. In Flash CS4 I did an Import to Library, Export for ActionScript, gave it a name 'myphoto', then inside of a custom class that extends Sprite, I do this:

var bmd:BitMapData = new myphoto(100,200);
var myphotoBitMap:BitMap = new BitMap(bmd);
addChild(myphotoBitMap);

It shows up on the stage much larger than 100 x 200. I tried
 
myphotoBitMap.width = 100;
myphotoBitMap.height = 200;
 
but that gets ignored, the image is still far too large.
 
I tried resizing after the Added and AddedToStage events, thinking maybe my resizing commands were not working because the image was still being processed in some way, but this doesn't work either.

View 3 Replies


Similar Posts:


Flex :: How To Resize Images (Bitmap) Using AS3

Jul 8, 2011

I am loading an image using a Loader. Once loaded, I can get the bitmap data using Bitmap(event.target.loader.content).bitmapData.
However since the images I am loading are quite large (around 2000 x 1600), I would like to reduce the size and create a new smaller bitmap maybe 200 or 300 pixels wide, sort of like a thumbnail. I think it has to do with creating a new BitmapData with the new size. However I am not able to get that working properly.

View 1 Replies

ActionScript 3.0 :: Any Way To Resize Bitmap Dynamically

Jul 28, 2009

Is it possible to change the Bitmap size Dynamically in As3..Which is created from the movieClip .
var myBitmapData:BitmapData=new BitmapData(450,282);
myBitmapData.draw(my_mc);
Now I need the same bitmap of 620X225. How to resize the bitmap without modifying the movieClip height and width.

View 8 Replies

ActionScript 3.0 :: Bitmap Resize And Render?

Jan 25, 2011

i've been working on a project.. right now, i'm required to make something similar to tilelist component. i've to load external jpgs through as3, and then to resize on the stage.. what i'm looking for is: is there any way to render resized bitmap through as3 like flash does in tile-list component?

View 1 Replies

ActionScript 3.0 :: Resize Bitmap Data After Draw

Mar 1, 2012

So I am working on this project for work and we have a bunch of sprites with transform matrix that contain the rotation, scale, x, and y coordinates of various parts of a character, i.e arms, legs etc. so we are then drawing the individual sprites onto the same bitmap data. Then we store it in a vector and display it later.

The problem is the models are too big. So I want to resize them, without having to rebuild the entire matrix, since I don't want to go through every matrix in the sprites and manual calculate the scale, rotation, x, and y after it has been made samller. Is there a easy way to do this? To resize the bitmap data and maintain the data that is already set up to construct the model? I can't share the code but the psuedo code is: we create a bitmapdata of a specific width and hight.

We the loop through all the children of a wrapper sprite and do a bitmapData.draw of each of the children and use their matrix for the second param, and then have it build to the bitmap.rect.

View 2 Replies

ActionScript 3.0 :: Bitmap Movie Clip Container Resize

May 5, 2009

I'm using the following code to load a .jpg into a movie clip container the problem is I need the container to be a specific size I tried loader.content.width = 50; and loader.content.height = 50; the height part works but the width doesn't work my image just expands beyond the stage width.How do i set the size of the movie clip container?I don't care if the image gets distorted i have a resize script for the images before they are loaded into flash.[code]

View 1 Replies

ActionScript 3.0 :: Resize Externally Loaded Bitmap Image?

May 6, 2009

I am trying to resize an image and display it on stage but i get the.......... error 1119: Access of possibly undefined property bitmapData through a reference with static type flash.display:BitmapData........this is driving me a bit mad because i got most of the code out of essential actionscript 3.0.....I've tried to debug it myself but my debugging skills aren't very good yet

PHP Code:
package NetConnections.PicClick{
import flash.display.*;

[code].....

View 2 Replies

ActionScript 3.0 :: How To Create Bitmap Of Loader Content And Resize It

Mar 10, 2010

I am loading a fairly large image file and want to create a bitmap of the loader content. I want to then use this Bitmap and resize it according to the current dimension of the stage. However, I also want to keep the loader content as "originally loaded" as a reference in case the stage is resized and the user wants to view this particular image again. The way my AS is written as of now, I am manipulating the loader content. How do I not do this? How do I "copy" the loader content so I can manipulate the bitmap copy while leaving the loader content unaltered?

<AS>
var lightboxImage:Bitmap = new Bitmap();
function resizeLightbox():void{
lightboxImage = myLoader.content;
lightboxImage.width = myLoader.content.width;
lightboxImage.height = myLoader.content.height;
[Code] .....

View 8 Replies

Actionscript 3 :: Resize A Bitmap Image Sized 9000x9000 To 150x150?

Nov 17, 2010

Is it possible to resize a bitmap image sized 9000x9000 to 150x150? I've heard there are some limits...

View 2 Replies

ActionScript 2.0 :: Bitmap Auto-resize - Generate Full Browser Images

Sep 2, 2007

in fact i used fr-ode's full-browser image code. but i dont want to generate full browser images. i want to build a structure like [URL] as you see in site, photos scaling automatically when you resize the window. can anybody write me a statement for this? here is the fr-ode's code which distroyed by me

[Code]...

View 2 Replies

ActionScript 3.0 :: Bitmapdata.hitTest - Bitmap 'emptyBitmap' With Bitmap Data Created

Feb 3, 2009

I'm cutting my teeth in actionscript 3 on a game that has a character running through a world. So, I have set up my Hit Testing by using the bitmap data hit test method, since I figured my world is going to be destructible - it'd be nice to update the level and then redraw it and have the character interact with the new change. (That works beautifully) I am however; a bit confused as to how I have my hit Testing set up. I've been messing around with it, and it works for now - but I'm not sure why.. currently, I have a character set up by using a class I built and using a series of animations I created. So, this character has a walking and falling animation, etc. This is a movie clip.

Then there's a bitmap 'emptyBitmap' with bitmap data created - however; I never really added this as a child to the character. This is sized to the dimensions of my character. My level is created as a movielip, then it's drawn to a bitmap - when the level movieclip is changed, the bitmap redraws, and that's how this updates.

[Code]....

View 1 Replies

ActionScript 3.0 :: Use The BitmapData Property Of A Bitmap And Pass It To The Constructor Of A New Bitmap Object?

Aug 20, 2009

I know the topic of "duplicating" movieclips is a hot issue with the new virtual machine. Luckily, I understand the implications. I only am [currently] interested in duplicating a Bitmap. See, I load an image from an URL using 'flash.display.Loader.load', which is a non-blocking operation in Flash Player.However,I may use multiple copies of the loaded image (which is reported to be a Bitmap, naturally) in the display list at the same time.Hence, I naturally do not want to load the image from an URL every time, because I don't want to wait for a non-blocking call to complete. Nor do I need to - I mean one copy is already loaded, so it should be possible to just "duplicate" it, right?

My idea is to do use the bitmapData property of a Bitmap and pass it to the constructor of a new Bitmap object. I have not tried the following in action, but I want to hear whether any of you did and if the following would not work, what would:

Code:

var original_bitmap: Bitmap;
var copy_of_original_bitmap: Bitmap = new Bitmap(original_bitmap.bitmapData);

LiveDocs mention that the BitmapData being passed to a Bitmap constructor is "being referenced", which to me might suggest it cannot be used twice? There is also the BitmapData::clone() method, which I am not sure is applicable here or not.I know this is a lot of talk instead of just trying this out, but I test so much Flash Player code daily just to see "what works" (which should be documented instead by Adobe),

View 4 Replies

Flex - Function To Redraw Bitmap On Sprite Without Passing In Said Bitmap?

Feb 22, 2011

If I have a BitmapData that's already been drawn onto a Sprite. Is there a way to redraw the BitmapData onto a Sprites Graphics object without having to invoke beginBitmapFill and passing in the same BitmapData?

View 1 Replies

ActionScript 3.0 :: Drawing From Bitmap To Bitmap Overrides Earlier Graphics?

Dec 29, 2010

I'm working on a game, and to keep performance good, instead of addChild'ing 50 new sprites to the stage every second, I decided to have each player draw to their own bitmap, and then to the 'master' bitmap. This introduces an issue though: the second player would override all data the first player has put into to bitmap...My basic debugging proof of concept:

Code:
// bitmap test

import flash.display.Bitmap;
import flash.display.Bitmap;[code]......

View 1 Replies

ActionScript 3.0 :: Copying A Rotated Bitmap Into A Bigger Bitmap?

May 9, 2011

I have a bitmap which has several frames (packed along the horizontal axis). In order to render them I copy it to the backbuffer (larger bitmap) as follows:

Actionscript Code:
public override function copyToBackBuffer(db:BitmapData):void{ if (active)  var drawRect:Rectangle = new Rectangle((currentFrame-1) * frameWidth, 0, frameWidth,

[code].....

View 5 Replies

Actionscript 3 :: Update A Portion Of A Bitmap With A Pixelbender Instead Of The Whole Bitmap?

Feb 17, 2012

In pure AS3, I have a pixelbender and a large bitmap. The pixelbender is configurable with a distance parameter to affect only a small area of the bitmap. The problem is that the pixelbender is executing over the whole bitmap. What would be the best way to update only the effected region of the bitmap? Given this config:

[Code]...

View 1 Replies

ActionScript 2.0 :: Bitmap Font Text Drawn To Bitmap

Oct 8, 2006

Is there a way to write a bitmap font right into the bitmap being desplayed? Mabey better worded: myBitmap.draw(image, t) draws a picture is there a way to draw text? I'm stuck even if its just a work around in some way I would like to know... (the current work around i have in my head is writing it in a movieclip turning that into bitmap data and drawing it... esentially creating a prototype answering my question... but a built in way would be easier probably).

View 2 Replies

ActionScript 3.0 :: Scale Or Resize The Image By Dragging And Resize Option?

Sep 19, 2011

I am working on image and i like to scale or resize the image by dragging and resize option.same working as "free transform tool" in flash (design part); i need same functionality in application.

View 7 Replies

ActionScript 3.0 :: Browser Resize Doesn't Trigger Resize Event?

Jul 7, 2011

I'm having a bit of a problem here. As per the title, my flash swf file works fine when tested from the IDE, but when I publish it and open it through the browser, the stage doesn't seem to resize along with the window.I post below a bare-bones example. The "back" movie clip should resize, only it remains at the starting dimensions

Code:
import flash.events.Event;
import flash.display.MovieClip;

[code].....

View 9 Replies

Actionscript 3 :: Bitmap Too Big - Limitation Is In Bitmap And Loader?

Mar 30, 2011

In AS3, I am loading a png from a zip file (nochump's zip library through ByteArray to Loader). The png can be up to 45k pixels wide but only 120 tall. This creates a problem in flash, as images can only be ~8000 pixels wide. A possible solution would be to split the images into 6 columns somehow. This would probably need to be done in the ByteArray state, because the limitation is in Bitmap and Loader.

View 2 Replies

ActionScript 3.0 :: Draw Bitmap Instead Of Export Bitmap?

Nov 5, 2009

I'm using Sandy to animate some objects in 3D. What I currently do to images which are EXPORTED in the library, I want to do to some bitmaps that I create using the DRAW technique. But it wont work :-(

CODE FOR 'CREATED BITMAP' :
ActionScript Code:
var bData:BitmapData = new BitmapData(myObject.width,myObject.height);
bData.draw(mask5);

[Code]....

Sandy doesn't seem to treat the 'created' bitmap the same as those that are exported from the library.

View 0 Replies

Flex :: Flash - Resize Children When Parent Is Resize?

Jul 29, 2009

I have Buttons which I have rotated vertically within a Canvas, that is working fine. The problem occurs, when the user resizes the window to a small size a vertical scroll bar appears, I would rather have each button squashed upto a smaller size.

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="40" maxWidth="40" xmlns:myComponents="myComponents.*"
horizontalScrollPolicy="off"

[code].....

View 2 Replies

Flex :: Resize Event And Resize Effect Of A VBox?

Dec 8, 2010

I'm having a little issue with the resize event and resize effect of a VBox.

I have something like this:

<mx:VBox id="container"
backgroundColor="0xFFFFFF"
backgroundAlpha=".9"
paddingTop="15"
paddingLeft="15"

[Code]...

View 3 Replies

ActionScript 2.0 :: If Resize The Window Before The Swf Is Loaded - It Misaligns Until Resize

Jan 4, 2009

I have a main movie here that loads in an external swf through a container mc. everything is aligned and positioned to where it should be, and they are also set to that value onresize. the problem is, when my swf is loaded in, it works fine and is in the right position, same when you resize it. BUT, if you resize the window before the swf is loaded, it misaligns, until you resize!!

View 2 Replies

Flex :: Resize Datagrid On Browser Resize?

Sep 28, 2010

I have a datagrid that occupies 100% of browser screen. I want the grid to automatically resize when the browser is resized to small or full screen.

View 1 Replies

Actionscript 3 :: Create A Bitmap From Another Bitmap?

Feb 24, 2012

Letīs say I have a bitmap with 3 colors: red, green and blue (not mixed)

What if I wanted to make a bitmap of the red part of the first bitmap?

Iīd like to take the red pixels from first bitmap (and its positions), and make another bitmap.

View 2 Replies

ActionScript 3.0 :: Find Bitmap In Another Bitmap

Oct 13, 2009

I haven't worked very much with bitmap manipulation and I need to create an app that can find a bitmap (or a pattern of pixels really) in another bitmap.Are there other methods of doing it besides iterating through the pixels and using getPixel()?I'm of course looking for the most effective solution.

View 14 Replies

Flash :: Use The CS4 Tool's On A Bitmap Image After Tracing The Bitmap Image And Applying My Settings?

Aug 7, 2009

Use the flash CS4 tool's on a bitmap image after tracing the bitmap image and applying my settings?

View 10 Replies

ActionScript 3.0 :: Can't Get Stage Resize Listener To Resize Movieclips In "main" Swf

Sep 9, 2009

I've got a large bitmap (1920 x1306) that my client wants as a bg image, scaled to the swf size on load (930 x 575); but that can "grow" up to its original size if/when a user expands the browser window. All the rest of clips in the display list are to remain in place (except for a copyright clip, which they want to always be 14 pix above the bottom of the browser frame. I've tried loading the bitmap dynamically at full size and then using scaleX,scaleY to set it's initial smaller (930x575) size, and I've tried just setting the height/width of the dynamically loaded image using the math of scaleX,ScaleY just in case the scaleX "transformed" the bitmap so that it couldn't return to its original size.  Both make the bitmap the right size. But the resize function below did  nothing to it, (or the copyright.y.) THEN I tried just putting the bitmap into the display list (both sizing methods work here, too). But even as an original member of the compiled display list, the resize event is still not reaching the target. Everything I've seen on the web says this should work - but...no luck.
 
Here's the AS3 code in the 1st frame of my swf:
 
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;

[Code]......

View 1 Replies

Flex :: Flex 3 Resize The Label And Text When Resize The Window?

May 11, 2010

i am creating flex 3 component when i re size the window i need to re size the labels and text.how to do this?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved