ActionScript 3.0 :: Flex BitmapData Dimensions (Width And Height)
Jan 20, 2012
I'm new to flex and I have a question concerning bitmapData and its width and height. Normally you set up bitmapData like this in AS3:
Code:
var bd:BitmapData = new BitmapData(100, 100, true, 0x00000000);
var bm:Bitmap = new Bitmap(bd);
But in Flex embedding an an image works like this:
Code:
[Embed(source="../../../../../assets/sprites/asteroids/asteroid_32_full.gif")]
public static const Asteroid1:Class;
var imageBM:Bitmap = new Library.Asteroid1();
When using the bitmapData (e.g. imageBM.bitmapData) I don't have to set up width and height any more. Does the Flash player know the width and height of a bitmapData automatically even when NOT setting up the bitmapData's width and height? I'm totally unaware about this topic because I don't know whether the Flash player always knows the dimensions of a bitmapData. Could this cause problems when not setting up the dimensions of a bitmapData?
View 2 Replies
Similar Posts:
Jan 20, 2012
I'm new to flex and I have a question concerning bitmapData and its width and height. Normally you set up bitmapData like this in AS3:
Code:
var bd:BitmapData = new BitmapData(100, 100, true, 0x00000000);
var bm:Bitmap = new Bitmap(bd);
But in Flex embedding an an image works like this:
[Code]...
View 2 Replies
Aug 17, 2004
have a square on the stage that should change in dimensions depending on which button is pressed. This is the code for the buttons:
[Code]....
Is it possible and if yes how to place the different dimensions in an aray and then call them in the on release?
View 14 Replies
Aug 17, 2004
have a square on the stage that should change in dimensions depending on which button is pressed. This is the code for the buttons:[CODE]function setButton() {
for (var i in menuMc) {
if (menuMc[i]._name.substr(0, 4) == "btn_") {
clip = menuMc[i];
[code]......
View 14 Replies
Oct 28, 2009
anyway, so i'm having an issue when getting the dimensions of an image that is masked. I want to get only the dimensions of the visible image, but AS3 seems to only return the height/width of the whole image, even the areas that are not visible (because of the mask).
I could create a custom class that extends the DisplayObject and overwrites the height and width getter to return the dimensions of the mask, but my problem is that I'm placing these masked images into a container DisplayObject, and scaling that container to fit the browser window.
View 6 Replies
Oct 11, 2011
I am cropping a bitmap image into tiles using the following function:
function crop( _x:Number, _y:Number, _width:Number, _height:Number, callingScope:MovieClip, displayObject:DisplayObject = null, pixelSnapping:Boolean = false):Bitmap
{
[Code]....
The width and height being passed in is a non integer value, for instance 18.75. When the new BitmapData is created it always rounds down the value to an integer, since the arguments for BitmapData are typed as such. In the case of my needs here, the width and height will not likely ever be integers. Is there a way to create these bitmap pieces of another image at the exact width and height I need or can a new bitmapData only be created with integer values for height and width?
EDIT: I realize you can't have a fraction of a pixel, but... What I am trying to achieve is dividing an image into tiles. I want the amount of tiles to be variable, say 4 rows by 4 columns, or 6 rows by 8 columns. the division of an image into X number of parts results in widths and heights in most cases to be non integar values like 18.75 for example. The goal is to divide an image up into tiles, and have that image appear, assembled seamlessly, above the source image, where I would then manipulate the individual tiles for various purposes (puzzle game, tiled animation to new scene, etc). I need the image, when assembled from all the tile pieces, to be an exact copy of the original image, with no lines between tiles, or white edges anywhere, and I need this to happen with non integer widths and heights for the bitmapData pieces that comprise the tiles.
View 2 Replies
Jan 29, 2010
I wrote a collision detection class that works off using BitmapData.hitTest. Basically, every update, the .draw method is called and then two BitmapData's are hitTest'ed against each other to see if there is a collision.It works pretty well, however if I start rotating the source MovieClip I use for the BitmapData, the transformations don't get registered in the draw method. So what I did was pass through a Matrix in the draw method. That works. But here's the actual issue. If I output the BitmapData to a Bitmap on the stage, I see that Bitmap is, in fact, rotating, but now it's exceeding the bounds (width and height) of the BitmapData. Which is cropping / clipping the image of the source MovieClip.
UPDATE: Basically, when the Bitmap clone of the MovieClip rotates outside the positive co-ordinate space, it doesn't get drawn. It rotates outside the bounds of the BitmapData set width and height. I can multiply the bounds by 2, and then center the bitmap inside the set bounds, but then the origin point is never fixed and the object is always being moved around. Works pretty well, but makes aligning the object to any specific point impossible.Here's my isolated test code. It requires you to have a MovieClip on the stage named "iTest". I used a fairly vertical arrow shape (higher than it is wide) so I could keep track of rotations visually accentuate the clipping problem:
var rotateTimer:Timer = new Timer(10);
function rotateObject_init():void
{
[code].....
View 2 Replies
Aug 20, 2009
The template is built under Flash and has .swf, .fla and html files and was setup on an html background. To make things look nice I decided to use an XML web template as a background to his template. The problem starts from there.The XML web template allows us to add our own SWF files, so I decided to add the swf file of my friend's template.
The swf file was set to "noscale" and when I imported it into the web template it didn't fit properly. So I took the "noscale" off from the actionscript and imported it again. Even then the scaling of the swf file was not correct.As soon as you load the file, it scales towards the left and not center.My question is how can I write a code within the fla file so that when the swf file is loaded it automatically centers itself?2nd question is how can I setup the dimensions of the file as in terms of height and width of the file without getting it cropped. I tried to set it up from 840x610 to 650x430 however the swf content got chopped off (even with noscale off).
View 2 Replies
Jul 29, 2010
I am trying to reference to top level (stage) width and height of the main stage for the placement of something located inside a movieclip on the stage.
My code is:
Code:
my_loader.x = (stage.stageWidth - my_loader.width)/2;
my_loader.y = (stage.stageHeight - my_loader.height)/2;
But this seems to just relate to the width/height of the mc that my_loader is nested in...
I have tried the following and had no luck:
stage.stage.stageWidth
root.stage.stageWidth
parent.stage.stageWidth
MovieClip(root).stage.stageWidth
View 8 Replies
Jun 12, 2009
i want to load external images of different height and width into same height and width.
View 3 Replies
Feb 24, 2010
i want to load external images of different height and width into same height and width.
View 0 Replies
Mar 25, 2011
I would like to use a movieclip to load a flv video. The problem I have is that I want to change the video dimensions. I've tried several software to change the video dimensions but as far as it seems all of them keep the same height-width ratio than in the original video. Is there any software that would allow me to change the height and width without keeping the same height/width ratio as in the original video file?
View 1 Replies
May 17, 2011
I'm looking to print my view to an A5-printer but when I test the print functionality to pdf, I always get a narrow and long printout.
Is there a way to set the pageheight and width? According to adobe help it's read-only.
View 3 Replies
May 7, 2010
I wahnt to place a container (alpha red) on top of my chart like on the image.How to get the x, y (point A), width, height of this area?
View 1 Replies
Jul 30, 2010
I have an actionscript, which makes a dynamic image wall. It gets parameters from FlashVar and changes the width and height dynamically.
When I use
[SWF(width="584",height="290")]
It's fully centered, but when I remove it, it's appear ~+50px from left. How can I set dynamically the SWF metadata or what I need to set for the correct view?
Top of the picture with SWF tag and the bottom is without SWF tag.
View 1 Replies
Feb 21, 2011
How can I make an application with the same ratio width/height? I have an application with width = 800 height = 600. Its width = 1.33*height and when I change the width to 1024 I want the height to change to 768 automatically.
View 1 Replies
May 3, 2011
I'm trying to set width/height of a FlexSprite object in ActionScript but it doesn't seem to work at all. I'm still a rookie when it comes to ActionScript and I don't understand why I can't set the dimensions of that object. I know I could use a UIComponent but I need something more lightweight since I'm going to add hundreds of them.
public class MyComp extends UIComponent
{
public function MyComp()
{
[Code].....
I plan to add other objects inside the FlexSprite and I need to set their dimensions explicitly as well so I really need to figure out how to do that.
View 1 Replies
Dec 14, 2011
I am loading an external swf using the SWFLoader component. The swf that is being loaded is masked so that only a portion is being shown. However, when it's loaded the actual size of the swf (loader.content.width/loader.content.height) is the complete swf including the masked area. Therefore, the loaded swf does not display properly in the itemrenderer Is there a way to to grab the size of the just the masked area as opposed to getting the size of the entire swf's contents? also i need to re size the masked area
View 1 Replies
May 12, 2005
I have an actionscript, which makes a dynamic image wall. It gets parameters from FlashVar and changes the width and height dynamically.When I use [SWF(width="584",height="290")]It's fully centered, but when I remove it, it's appear ~+50px from left.How can I set dynamically the SWF metadata or what I need to set for the correct view
View 4 Replies
Oct 23, 2009
Given this code:
[Code]...
Why does changing the width and height of uiComp not affect the Sprite? Wouldn't UIComponent provide Sprite with a Graphics object, which limits that area where Sprite can draw?
View 1 Replies
Nov 16, 2009
In my Flex application, I've got a component that extends UIComponent where I'm loading images at runtime and try to display them. I've tried lots of different approaches (using beginBitmapFill(), using different containers), but I can't get things to work as I want. The problem seems to be related to the width and height properties of the image, which aren't updated correctly.The idea is:
var sprite:Sprite = new Sprite();
addChild(sprite);
var im:Image = new Image();[code].....
The image's width and height doesn't seem to be correct when it's loaded. I get width==0 (and nothing is displayed), but the property $width seems to be correct. How can I assure that width and height of the loaded image is updated?
View 2 Replies
Nov 18, 2009
I want to create a text box with a fixed width that will fit itself to its current text. So I went ahead and wrote this simple application[code]...
View 2 Replies
Jul 13, 2010
I thought I had a handle on AS3, DisplayObjectContainers, etc. but this basic thing is really confusing me: changing the width/height of a sprite does not affect it's visual contents - either graphics drawn within it or any children it may have.[code]...
View 2 Replies
Jul 25, 2010
I'm playing around with code like this:
<s:Button id="test" label="test" transformX="{Math.floor(test.width/2)}" rotationY="20" x="20" y="20" />
The button is rotated on the Y axis and the rotate pivot is in the middle of the button.
This will create a button that looks something like this[code]...
I put together a sample to show off the various approaches for calculating this that people are suggesting. The source code is also available. Nothing is quite working like I'd expect. For example, turn the rotationSlider to 85. The button is effectively invisible, yet all approaches are still giving it height and width.
View 3 Replies
Aug 29, 2010
Is it possible to dynamically (not in the project's options) change the dimensions of the stage by using ActionScript 3? I'd want to create a 400x300px loader, but I also want it to load animations that have bigger or smaller dimensions. I would then change the width and height of the loader to make the loaded animations fit well. Is there any way to do that?
View 1 Replies
Dec 2, 2010
I have objects placed on the screen using x/y coordinates. I want a way to update that based on changes in Screen Width/Height. So if used re-sized browser window x/y should change. How do I cick off a function every time the screen is re-sized.
View 3 Replies
Jun 13, 2011
I have the follow declaration :[code]How can i determine "img6" width and height ?
View 1 Replies
Jul 22, 2011
Using Flex 4 AIR, what is the maximum widtha and height I can set for line and the bordercontainer?
bc:borderContainer = new borderContainer();
bc.width = 80000;
bc.height = 80000;
View 1 Replies
Mar 25, 2011
I would like to use a movieclip to load a flv video. The problem I have is that I want to change the video dimensions. I've tried several software to change the video dimensions but as far as it seems all of them keep the same height-width ratio than in the original video. Is there any software that would allow me to change the height and width without keeping the same height/width ratio as in the original video file?
View 3 Replies
Jul 28, 2009
i use cs4 make as3 loader from SharedObject.getLocal, load flex make swf file, so width/height is not Ok
load cs4 make swf file is Ok,
as3code:
// copy right china summer xiatian qq 11602011
package{
import flash.net.SharedObject;
import flash.utils.ByteArray;
[Code].....
View 2 Replies