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


Similar Posts:


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

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

ActionScript 3.0 :: Using BitmapData.draw(stage) - Error #2123 Security Sandbox Violation: BitmapData.draw

Jan 9, 2012

I am having an issue with using BitmapData.draw(stage). I am getting the following error:

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Documents%20and%20Settings/bla...bla...bla.swf cannot access null. No policy files granted access. Here is a portion of my code:

var bd:BitmapData = new BitmapData(2800, 2100); bd.draw(stage);//this is where the error happens All of the files referenced (.xml/.jpg/.swf) are located in the same local folder as the main .swf. How do I get around this error? The main objective is to print the stage using PrintJob(). I am using Flash Professional CS5.5 and publishing to Flash 10.0/10.1. Let me know if I need to supply any more info.

View 4 Replies

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

ActionScript 3.0 :: BitmapData With Draw Not Working?

Nov 17, 2009

When is a Bitmap not a Bitmap ?I can apply (using Sandy) an image as a texture :

var material:BitmapMaterial = new BitmapMaterial(new myImage(1,1));
myCone.appearance = new Appearance( material );
I can trace an object and form a bitmap :

[code]......

View 1 Replies

ActionScript 2.0 :: Load A Swf Then Use BitmapData.draw() Not Working?

Apr 13, 2006

I am trying to load a external swf and then use the BitmapData.draw() method to draw the loaded swf to a bitmap. This does not seem to work. If I draw some lines into the loaded swf using the .lineTo() method and then use BitmapData.draw() i do see the lines that are made by this method, but not the content i put in the swf. Is it just not possible to do this

View 1 Replies

Actionscript 3 :: Quickly Rotate The Pixels That Make Up BitmapData Without Using BitmapData.draw()?

Dec 29, 2011

I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.

View 3 Replies

Flex :: AddChild A BitmapData Or Draw A BitmapData To Screen?

Jul 15, 2009

I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?

View 2 Replies

ActionScript 3.0 :: BitmapData Draw() Method - Draw The Bitmap On The Stage At Design Time?

Mar 18, 2009

I am using the draw() method of the BitmapData to encode a jpeg of part of the image. Now this should be easy enough given the object I want to draw to the bitmap is on the stage at design time so I know its location and dimetions exactly! Heres the code I have in place.

Code:
var myBitmapSource:BitmapData = new BitmapData ( street.width, street.height, false, 0x333333);
myBitmapSource.draw(street, null, null, null, new Rectangle( 96, 5, 571, 450 ), true );

I know for a FACT that no part of the street clip I am drawing out is in negative space, and it's registration is (0,0). However, it cuts off A lot of the top of my image. y=5 in the above rectangle is where I need the top to be, but it cuts the top off of the image... even if I change it to 0, it has no effect.

View 2 Replies

ActionScript 3.0 :: Youtube Api Draw - Error #2121: Security Sandbox Violation: BitmapData.draw

Jun 30, 2011

I'm making something that requires me to draw() the youtubeplayer Giving me this pretty error:

[Code]...

View 4 Replies

ActionScript 3.0 :: BitmapData.draw() Failing To Draw Entire MovieClip?

Dec 15, 2009

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.

View 5 Replies

Flash :: Gallery Template Not Working As Expected?

Jul 6, 2009

I have created a flash gallery using the in built template in Flash8, which works fine. The gallery forms part of my gallery page of a separate SWF flash site. I load the gallery using a loder component. Since the gallery navigation works by targeting the root folder, my site gets screwed up. The question is, how do i modify the ActionScript in the gallery.fla file (flash inbuilt template), so that once loaded into the main site, it doesnt target the root timeline, but targets its own timeline i.e.Please see below for the code in the Flash Gallery. PS: I didnt write the code - its inbuilt into the template:

function updateFrame (inc) { // send slides to new frame newFrame = _level1._currentFrame + inc; _level1.gotoAndStop(newFrame);
updateStatus();

[code]......

View 1 Replies

ActionScript 3.0 :: Flash Buttons Not Working As Expected

Dec 23, 2011

I've followed this tutorial and made a functional photo gallery.

Now, I want to add that photo gallery on my site. I've created a flash button and assigned it this action:

Code:
on (release) {
_root.contents.loadMovie("Pictures.swf");
}

"contents" is the container movie clip, and "Pictures.swf" is photo gallery i've made. Now, when i click on button, Pictures.swf does load (arrows are being shown), but when i click on them, nothing happens.

View 4 Replies

Flash :: BitmapData.draw Method Or Bug?

Oct 2, 2009

I have problem when drawing transparent png image on transparent bitmapData.

code of first frame:
 
stop();import flash.display.Bitmap;import flash.display.BitmapData;import flash.display.BlendMode;import flash.geom.ColorTransform;import flash.geom.Matrix;
var bmd: BitmapData = new BitmapData(500, 400, true, 0);var bitmap: Bitmap = new flash.display.Bitmap(bmd);addChildAt(bitmap, 1);

[Code]...

View 1 Replies

Flash :: Use BitmapData.draw With NetStream.appendBytes?

Apr 9, 2011

I am using NetStream.appendBytes() to play a local video (no server involved) in Adobe AIR. I would like to use BitmapData.draw() to take a picture of the video output, but I am getting this error:

Error #2123: Security sandbox violation: BitmapData.draw: cannot access null. No policy files granted access.

Here is some sample code:

package
{
import flash.display.Sprite;
import flash.filesystem.File;

[Code].....

This is only sample code use for an explanation. The error would happen when calling the getImage method while the video is playing. The error mentions a policy file not found. Since the file is loaded locally there isn't really a place to put a policy file. Is there a policy setting somewhere that needs to be set or is the BitmapData.draw feature just not available when using appendBytes?

View 5 Replies

Flash :: Intermittent Bitmapdata Draw With Scaling Matrix?

Sep 10, 2009

We have discovered that when we draw one bitmapdata into another bitmapdata using draw, there is an upper bound on the scaling transformAt some point the IBitmapDrawable parameter ceases to be rendered on the target bitmap.Does anyone know what the parameters of this upper bound are? Is this documented somewhere?

View 4 Replies

Actionscript 3 :: Flash BitmapData .draw Memory Leak?

Jul 7, 2011

I have a large sprite...and I'm splitting it into several smaller ones with function bellow. The function works great but the memory usage of my .swf grows dramatically.

private function split_sprite(sp:Sprite,the_parrent:Sprite) {
var region:Rectangle = new Rectangle();
region = sp.getBounds(the_parrent);

[code]....

View 1 Replies

Actionscript 3 ::- Flash - Draw TextField To BitmapData With Rotation?

Sep 21, 2011

I want to draw text to a bitmapData and allow it to be rotated but rotating the text makes it disappear :(The code I am using resembles something like this :

var tf : TextField = new TextField();
tf.text = "testing";
var mat : Matrix = new Matrix();

[code]....

View 1 Replies

AS3 :: Fonts - Flash BitmapData.draw() Affects Text Formating?

Nov 17, 2009

I need to display antialiased systemfonts (because the swf filesize must be small, therefore i can't embedd fonts). So I wrote this script in order to manually antialias the text

Code:
public function renderTextField():BitmapData{
var w:int = this["mainTextField"].textWidth+10;

[code]......

View 1 Replies

ActionScript 3.0 :: BitmapData.draw Causes Mouse To Act Funny (flash Player Bug?)

Jul 21, 2009

i have the following setup:

-a container sprite that holds a bunch of sprites being used as buttons (listening to their onMouseOver, out, down, etc etc)

-a class that takes a bitmap snapshot of this container sprite onEnterFrame.it seems that doing a draw of that sprite onEnterFrame and then rolling over a button, causes it to fire rollover and rollout events repeatedly even without rolling off the button! it is definitely the draw that does it because if i comment it out it stops.

View 4 Replies

Flex :: BitmapData Draw - Set Where To Draw?

Dec 16, 2010

i have a class thats create a class with bitmapData that merge 2 IBitmapDrawable. one of them is 24*20 while the other is 16*16.i want to draw the smaller first in a bitmapData object which its width and height are 24*20 but i want to draw it in the center of the big bounds.

[Code]...

View 2 Replies

ActionScript 3.0 :: Import 3D Models From 3D Programs Into Flash, And Draw Views To BitmapData?

Jun 8, 2011

This is somewhat of an unusual topic, but hopefully you guys will have a reply that will allow me to go on. I am working on a 2D game following an unusual workflow that is very much 3D based. The workflow is 3D based but the game is flat! This is very important: Graphics are flat images.

Here's the general question. I need a Flash library that loads and is able to deal with 3D models, orient them and convert them in various ways to 2D BitmapDatas. Do you know anything that can do this? To elaborate, I was thinking of the best possible workflows for myself and artists' needs and there is one that I would really enjoy but need serious help to break through. Here it is: Import a textured 3D model from 3DS Max or other similar tools, into Flash At runtime, orient the model the way I want and draw it to BitmapData as a flat 2D colored image. This image is what is supposed to be displayed ultimately. Ideally there shouldn't be a need to display the model at all; just like you can draw MovieClips into BitmapDatas without adding them to the display list. The 3D model is non existent to the user, it's only a workflow convenience for developers, it's a data holder as well as a means to reduce file size.

- Still at runtime, I have to be able to generate a height map: Basically a BitmapData entirely black with, instead of the real texture, a gradient along the 3D Y axis that would have the same 2D shape as the model under its current orientation (i.e. it overlaps perfectly with the flat 2D colored image we made earlier; let's call colored images diffuse maps.) Remember it's along the 3D model's Y axis: If it's a character and its orientation makes the model's shoulder have the lowest Y 3D coordinate while his hips are the highest, the gradient will start from the shoulder. (i.e. it's not always "feet to head", depends on the model's orientation.)

View 7 Replies

Media Server :: It Doesn't Allow Flash Clients To Make Stream's Screenshot (with BitmapData.draw)

Mar 23, 2011

I got serious issue while using adobe flash media server (I have media server streaming license). It doesn't allow flash clients to make stream's screenshot (with BitmapData.draw) because this is restricted from server side by default. I found that this trouble can be resolved my updating main.asc file but it seems like replacing main.far with mine main.asc causing error. Could you please help me with resolving this issue because it's extremely important  to allow this screens making for user.I used CentOS 5.3 and FMS 4.0.1 r2009 (instaled in /opt/adobe/fms include Apache 2.2). All video is stored in a directory  /opt/adobe/fms/applications/vod/media and I put the main.asc file in the directory /opt/adobe/fms/applications/vod/ from the directory  /opt/adobe/fms/samples/applications/vod.

View 5 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

ActionScript 3.0 :: Mouse Controls Not Working As Expected In IE?

Mar 31, 2010

I am developing a simple galaga clone for my site, its at [URL] . You will notice the controls work fine in firefox, opera, safari, chrome, etc. However, in IE, the controls are only triggered if the mouse cursor is hovering directly over the player ship.

The playership object is created in the main document class which passes a reference to the stage to the playership class.

private var ourShip:playerShip = new playerShip(stage, ourHUD);

Which is then added to the stage from within the document class (gameMain)

stage.addChild(ourShip);

The playership class then monitors the mouseX and reacts accordingly. The code for the ship controls which are linked to the enter_frame eventhandler is

Code:
public function controlShip(e:Event):void {
var a1 = stageRef.mouseY - e.target.y;
var b1 = stageRef.mouseX - e.target.x;
var radians1 = Math.atan2(a1,b1);

[Code]....

View 2 Replies

Flex :: MouseEnabled Where Transparent Not Working As Expected

Feb 28, 2011

I just cannot understand why mouseEnabledWhereTransparent does not work on this skin. The Skin this creates is basically a Button with a transparent background and a little triangle to the left side, like so: >ButtonText But the empty space around the Triangle does not receive mouse events. I've tried wrapping another group around the triangle path and I've tried wrapping it into a Graphic Object, also without success. I could create a Rect with 0 alpha below everything, but isn't that exactly what mouseEnabledWhereTransparent should be doing?

<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="[URL]" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fb="[URL]" minWidth="21" minHeight="21" alpha.disabled="0.5" mouseEnabledWhereTransparent="true">
<!-- host component -->
<fx:Metadata>
[Code] .....

View 2 Replies

Actionscript 3 :: Using Graphics.clear Not Working As Expected?

Mar 12, 2012

Would anyone know why using graphics.clear(); in this example is preventing the graphics from being drawn?

e.g. the following code works and the lines are drawn.

var my_shape:Shape = new Shape();
my_shape.graphics.lineStyle(2, 0x00FF00, 1);
addChild(my_shape);

[Code]....

I'm wanting to animate the line moving so would like to clear the previous drawing before redrawing the lines.

View 1 Replies

ActionScript 3.0 :: Try/catch Statements Working But Not As Expected?

Aug 21, 2009

I've got some try/catch statements in an XML parser I've written that don't seem to be doing what I want them to be doing.

The code:

ActionScript Code:
try
{[code]........

The problems:

-In the case the type is analysis or info (with other tags being alright) the "Default Text" is staying blank, even without a text tag.

-If I purposely malform the option tag, no alert window shows up and none of the other properties in the catch block (optionText,selType, etc.) get set properly

View 3 Replies

ActionScript 2.0 :: Loop SlideTo Is Not Working As Expected?

Jan 16, 2007

In the following code, I create 12 buttons, label them, and control their onRollOver,onRollOut, and onRelease actions. Everything is working fine except for the line containing the "slideTo" method. Reading from the two arrays for the x and y values, it appears to be inserting the largest number in each array instead of stepping through all 12 values. Currently, clicking on any of the buttons moves the object (ralphMC) to x=100 and y=800. I am pretty stumped about this, as I've inserted quite a few various numbers into each array during testing. Can anyone tell me what I am doing wrong?slideTo is part of the mcTween package, in case anyone wanted to know. code follows:

Code:
//Creates an array of numbers that will evenly space the buttons out vertically
var mcPosY:Array = new Array();

[code].....

View 1 Replies







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