ActionScript 3.0 :: ClipRect - Cropping An Image With Draw?

Nov 18, 2009

Using DRAW I want just a part of the original image. I am using the "Rectangle" bit of the paramaters, but I can't get the start of the crop away from the top left corner.

Here's my code :

ActionScript Code:
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.text.TextField;

[Code].....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Draw() While Using ClipRect?

Jul 1, 2010

I've tried working this problem out several times, but I've never been able to get it to work. What I want to do is draw a PART of a bitmapdata onto another bitmapdata while using transparency effects. My code looks something like this:

[Code]...

The problem SEEMS lies in the new Rectangle. Whenever I try using it, nothing gets drawn onto bmdScreen. So, what's the deal? How would I draw a 32X32 rectangle of bmdSource while using the draw method? Is this even possible? (By the way, the only way I found a workaround to this is to create a separate bmdSource that is the rectangle itself. It's kind of a clunky system and it'd be nice to do away with it.)

View 3 Replies

Flash :: BitmapData.draw ClipRect Not Working As Expected?

Jun 29, 2011

I have a component that contains 4 layers: (in ascending depth order) bgImage:Sprite, dropZone:Sprite, dropMask:Sprite and line:Sprite. The bgImage is at 0,0, and the other objects are placed at various positive coordinates. dropMask is masking dropZone.At the point of bitmap capture I want to only draw from the dropZone and dropMask layers, so I'm trying this:

removeChild(bgImage);
removeChild(line);
var bmd:BitmapData = new BitmapData(dropMask.width,dropMask.height,true,0);
bmd.draw(this,null,null,null,dropMask.getBounds(this));

Despite the dropMask being located at 50,60 the capture always starts from 0,0. I've also tried getting the boundary rectangle and forcing the x,y, but it makes no difference. should I just forget clipRect and use a matrix instead?

View 2 Replies

Flex :: ClipRect Parameter Of The BitmapData.draw Method Really Clips The Source?

Dec 10, 2009

The documentation says that clipRect parameter of the BitmapData.draw method sets clipping for the source.Reading this I wrote an AnimatedObject class for my potential flash game. This class draws a frame from a .png animation strip, and doesn't work with Flash scene hierarchy.

[Code]...

View 4 Replies

Flash :: Rotate BitmapData When Using Draw Method. Width Height Bounds Clipping / Cropping?

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

Flex :: Advanced Image Cropping And Image Resizing?

Apr 26, 2011

I have created a image cropping tool in flex using core copyPixel method.croppedBitmapData.copyPixels(croppedBitmapData, clipCan, new Point(0, 0));I have to crope area of dementions 20*20 and show this cropped area in an image of demention 250*350. Every thing going well.My problem is image distortion.Even i am using this method for smoothing image contents on complete.

private function smoothImage(event:Event):void
{
var bitmap: Bitmap = ((event.target as Image).content as Bitmap);

[code]....

View 2 Replies

ActionScript 2.0 :: Dynamically Cropping (masking) An Image

Aug 24, 2009

I made an xml loaded dynamic image gallery and I cannot figure out how to crop the image should it be too big. Masking appears to work only with a movieclip created outside of actionscript (which cannot be created dynamically).

View 2 Replies

ActionScript 3.0 :: Use Object Handle For Image Cropping And Rotation?

Feb 14, 2011

i have downloaded the rogue object handle 2.008 i need to know how to Use it to cropp and rotate the Image.

View 1 Replies

Actionscript 3 :: Scaling And Cropping An Image With Fixed Dimensions?

Dec 10, 2011

I want to display an image, and it should be transformed like this:If for example, my original image is 200x300 pixels in size, I want it to have a width of 150, and then scale the height accordingly. Then I want to crop the image, so that the result has a dimension of 150x150 pixels.

View 2 Replies

ActionScript 3.0 :: Using Text To Draw An Image

Oct 13, 2009

I need to do everything with AS3 since both the image and the text is loaded with an XML. Practically I have a picture and above it I'll put a white level with alpha 70%, but as you can see in the jpg the white level has a "hole" in it that is created by a text.I thought that a way could be to convert the text in a bitmap and then, if it is possible, to use the newly created bitmap to create the "hole" with the white level.

View 7 Replies

ActionScript 2.0 :: Draw An Image Dynamically?

Feb 8, 2005

I am trying to draw this image dynamically (attached image) so for example if user gives me value of 24 the graph has to be able to draw circles like in the image and split circles into 24 sectors ( draw 24 angled radiuses from the origin) ... How could this be done ?

The trick is once I accomplish this stage I need to be able to track intersections between each radius and 3 circles!!! Well the idea of the graph is that each radius is an answer to a question and can have a dot in the origin , intersection with first circle , second or third (each one represents answer 1 or 2 or 3 or 4... then it connects all dots on each radius depending on the 24 (in this example 24) answers. I've done this witha static graph where I knew there were gonna be 24 but now it needs to be first drawn dynamically because user chooses the number of question.

View 1 Replies

ActionScript 2.0 :: Cropping A Loadmovie?

Mar 15, 2006

I m building a site whit transparency so my background HTML can bee viewed, at some point I load a movie on level1, it's supposed to bee smaller than the Level0 movie but instead I end up getting flaps on the level0 movie because the original content of the level1 movie sticks out, I can't put a mask for it will occlude the HTML background, and it doesnt matter if I keep shortening the loaded movie it still shows up like it has a mind of its own...

View 3 Replies

ActionScript :: Draw A Border Around A Masked Image?

Jan 20, 2010

I'm trying to write some ActionScript which will accept a mask and an image, then mask the image and put a border around the result (assuming that the mask is always 100% opaque).

For example, if my mask is a poorly drawn star, and my image is a bunch of flowers, I want the result to be a poorly drawn star with flowers inside it and a border around it. Something like this:

View 2 Replies

Actionscript 3 :: Flex : Draw Ellipse On Image?

Jul 18, 2011

I have an Image object, and i wish to draw an elipse on it.

i have tried with

imageObj.graphics.beginFill( 0x0000FF, 0.5 );
imageObj.graphics.drawEllipse( position.x, position.y, 10, 10 );
imageObj.graphics.endFill();

but it doesnt draw anything at all.

how to draw graphic primitive on Image object ?

View 1 Replies

ActionScript 3.0 :: Flex - How To Draw On Loaded Image

Jan 20, 2012

How can I draw on my Loaded Image? I can Load a Image, but I cannot draw on my Image with my pencil. My pencil is in my Main.as class. How to be able to draw on my loaded picture?

Here comes the code in my LoadImage.as class:
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.net.FileReference;
[Code] .....

View 2 Replies

ActionScript 2.0 :: Draw Lines That Show On Top Of An Image?

Oct 21, 2004

OK I have an empty MC. I want to draw lines that show on top of an image, but everything I try draws the lines below my image.This code is ran from the main timeline.This is my code so far.

Code:
_root.attachMovie("Audiogram_Chart","Show_Audiogram",100000); //this is my MC that will hold the graphics

[code]......

View 1 Replies

Professional :: Cropping A Flash Document?

Dec 1, 2010

I recently made a flash document with animations and some AS at 1600 pixels wide. It turns out that my web developer is having trouble using the file and would like it cut down to 1200 pixels wide. I can make the document 1200 wide, but then everything is off-center. Is there any way that I can crop it to 1200 my taking 200 pixels off of each side instead of just 400 off of one side? If not is there an easier way to just select every layer and tween at one and move them over

View 1 Replies

Media Server :: Video Is Cropping In Swf

Mar 9, 2011

The Camera  video is played well in other applications, but when I am using Camera in flash applications to play the live video, then video is cropped.

View 1 Replies

Flex :: Cropping/Clipping A Sprite?

Jul 7, 2010

How is cropping/clipping accomplished on a Sprite in Flex?

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="Init()">
<mx:Script>
<![CDATA[

[code]....

Notice that the lineTo completely leaves the UIComponent and Panel.How can I cause my UIComponent or Sprite, Or Panel for that matter, to be cropped/clipped? I realize I could just change the hard-coded 2222's to something more reasonable, but I need a generalized solution to this, since the actual project doesn't involve hard-coded values that I can alter, but works with dynamic data.

View 2 Replies

ActionScript 3.0 :: Cropping Out Whitespace In BitmapData

Jun 4, 2008

Does anyone know of a way to crop out whitespace/transparent pixels in a BitmapData object? I've got this movieclip I'm rendering that has a huge amount of whitespace all around it. I'd like to crop all of that out before I convert it to a JPEG (with corelib). Is there a way to do this? I can't seem to find a way to figure out where the first opaque pixel starts on each axis to determine the extents.

View 6 Replies

Flash :: Using Bitmap Data To Draw Massive Image?

Feb 18, 2011

I am making a snow boarding game in AS3. The problem I am having is that I want to leave a trail in the snow behind the board.

I have had a think and feel that the best way of achieving this would be to use the lineTo() method to draw a line form the snowboards previous position to its current position. If I do this all of the way down the slope I would end up with a line almost 23000 pixels long which seems extremely large and will have a major impact on performance.

If I were to convert the trail movieclip to a bitmap would it improve performance? I am targeting a minimum of flash player 9 which I have found to have issues when handling bmp's over 2880 pixels so I think this method might not work.

View 2 Replies

ActionScript 2.0 :: Cube Rotation In Flash - Draw Own Image

Dec 13, 2002

i need to do something like the swf file am attaching instead of the cube revolving... i need to draw my own image. how to bring this effect in flash. as if now, i have created the cube rotatoin in swift 3d and have exported it as a swf file. also can we draw our own images in swift 3d? (instead of the readymade cube?)

View 1 Replies

Professional :: Sprite Sheet Cropping Funny

May 2, 2010

SO I am working on animating a 20/fps sprite (an SCV from Starcraft 2). The animation is 1 second long, and thus 20 frames. I have made a sprite sheet in photoshop, and have each frame as a separate layer. I import the PSD into my library and have it convert the layers to "Flash Frames". I get each frame nicely tucked away as a layer in my library. Problem is, it gives an ugly white border (about 1 to 2 pixles thick) around my sprites, making it look like I did a terrible crop job. However, the crop job is fine (I can change the background in the PSD to black, and the cropped sprite frames look perfect! What have I done wrong or need to do?

View 1 Replies

ActionScript 3.0 :: Scaling In Aspect Ratio Without Cropping?

Jun 8, 2010

I want to know how can i make something like if any one scale browser my site will scale in aspect ratio without cropping

something like jimcarrey website [URL]

View 2 Replies

ActionScript 2.0 :: Make Movie Clip Container Draw A Box Behind The Image?

Jul 28, 2009

I am trying to create a gallery where the thumbnails scroll across the bottom and when you click on the thumb a new large image opens up on top of it from the same image.

What i would like to do is open up the large image but draw a box around this image so it blanks out the background of the site and all you see is that picture.

Its a similar function to the way this site works;

[URL]

View 2 Replies

ActionScript 2.0 :: BitmapData.draw() From MovieClip Draws Blank Image?

Aug 10, 2010

I have a MovieClip that has 2 images inside it:

1) An image from the FLA's library.

2) An image that is loaded dynamically from a server (read from XML file).

When I try to draw the MC into the BitmapData, I get a blank image.

Code:

ActionScript Code:
var destImg:BitmapData = new BitmapData(_root.picW,_root.picH,false);
destImg.draw( mcPicture );

View 1 Replies

ActionScript 3.0 :: Bitmap.draw Twitter Image Sandbox SecurityError

Nov 30, 2010

So i've got a piece of an app that's grabbing the JSON result from a Twitter search, then calling a Loader to grab profile images for each result to place next to the text of the result.[code]when it's trying to rescale and draw the bitmapdata.I have a LoaderContext checkPolicyFile = true set when it loads the actual user image source, I have allowDomain and loadPolicyFile set for crossdomain.xml at URL... and I basically have looked at and tried everything in all of google and I still keep getting these security errors and not having the images shown properly.

View 2 Replies

ActionScript 2.0 :: BitmapData - Calculations Of The X,y Coordinates Of The Rectangle Cropping ?

Oct 6, 2007

After seeing the I've been told that movieclips aren't suited for games, what do you use? thread, I thought I would try to incorporate the approach into a game I'm currently programming to make it a little less processor intensive.

I have a giant movieclip of a football field, of which only 5-10% is shown at any given time. I'm guessing that flash still has to make calculations for the other 90-95% of the field every frame, even though it's of no use. From what I understand (not much), copyPixels seems like the perfect candidate for such a situation.

It seems simple, but I'm having trouble actually implementing it, and I'm not sure which actions are needed and what might be introducing unnecessary work. I have a movieclip (mc_field, exported for as), but if it would save the processor some effort,I could easily save this as a bitmap and export that for actionscript. The width and height of the final product (bitmap/BitmapData) will be Stage.width, Stage. height,respectively,and I can handle making the calculations of the x,y coordinates of the rectangle cropping (which part of the source bitmap I want to crop).I'm sure it's only 3 lines of code, and I know that there are a few examples online, but for some reason.

Say, for frame one, I want to take the field (either mc_field or bm_field) and copy 500px x 300px, starting at 140,230 from the source bitmap to mc_container.Then, for frame two, I want to copy 500px x 300px starting at 240,540 from the source bitmap to mc_container.

View 4 Replies

ActionScript 3.0 :: Cropping Externally Loaded SWF To Stage Bounds?

Jul 27, 2009

When using the Loader class to load an external SWF into another timeline and then displaying that SWF using addChild on the loader.content, one discovers to one's consternation that elements positioned off the stage of the external SWF are still displayed.To illustrate this with an example: suppose you have a 500x500 pixel "main" SWF, and it loads an external SWF at runtime and positions it in the center of the stage. And suppose that this external SWF's document properties set the stage width to 200 x 200 pixels. However, when authoring this external SWF, we draw a box that's 300 x 300 pixels, so part of this box is actually off-stage.

When you play the external SWF in the standalone Flash player, it is sized correctly at 200 x 200 pixels, and the rest of this box is cropped off.When you load this external SWF into the "main" SWF and use addChild() to put it on the stage, you will see the full 300 x 300 pixel boNow of course, we can simply solve the issue using a mask, but I'm wondering whether there's a more elegant solution that's built in, either to the MovieClip or the Loader or the LoaderInfo classes. Something that says "respect the document bounds of the original SWF" or "crop to stage dimensions".

View 1 Replies

Professional :: Mask Layer Not Working In Cropping To Stage Flash

Apr 1, 2010

I've read through umpteen Flash threads of frustrated users who export SWF and anything visible outside the stage appears in the SWF when opened in a browser.None of the solutions have worked for me.My file is called statement_onlineheader.fla.URL...I have my mask layer above a folder containing all other layers.I have also tried moving the mask layer above individual layers.Stuff outside the stage appears in the exported SWF.

View 5 Replies







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