ActionScript 3.0 :: Crop A Specific Irregular Shape From An Imported Image?
Jan 18, 2010
How can I crop letteraly crop a part of an imported image into a specific irregular shape that already exists on the stage as a MovieClip... a jigsaw puzzle piece for example ? (it would be prefered not to use masks).
I have a little question:How can I crop letteraly crop a part of an imported image into a specific irregular shape that already exists on the stage as a MovieClip... a jigsaw puzzle piece for example ? (it would be prefered not to use masks)
I've been following this tutorial to crop images in flex: [URL]
At the heart of its cropping is using a method called "copyPixels". However, this method takes as one of its arguments a rectangular shape for its crop region. Are there other strategies I can use to crop it not using a rectangle.
I am going after letting the user specify the region that should be cropped using a series of points.
I am having some problems regarding image crop.I am able to crop an image but with the use of rectangle class or in rectangular shape.But i would like to crop in circular shape(for example go to URL...).
Does anyone know a way to crop a SWF like you would crop an image in Photoshop? I'm building a Flash Banners application in my Flash portfolio website and I'm loading a SWF using addChild via a URL loader object. There is no way to mask the outsides of the SWF because addChild puts the SWF at the front of the display list so the masks would just show up anyway and the masks will just be huge white sheets that will look dreadful. I need to LITERALLY crop the SWF down to 550 X 325 pixels.
How can I attachBitmap to an irregular shape?I load a pattern into my movie (pattern.jpg), it is a square image 500x500. I want to draw that image onto an irregular shape. If I do the following it simply shows the large square overtop of my shape. The pattern isn't actually applied to my shape.
Code: var bitmap:BitmapData = new BitmapData(500, 500, true, 0x00000000); myShape.attachBitmap(bitmap,1,"auto",true); bitmap.draw(pattern);
In my app, a user must drag and release a rectangular mc object (rectx) over an irregular shape within another mc object (irregx). There are 13 rect/irreg pairs. Each obj shares an AS2 file that checks whether rectx is over irregx, and proceeds _only_ if the check is true. The script uses hitTest, on mouse release, to grab the number (x) of the rectx being dragged and checks whether it's over irregx. Right now, the check comes back true when rectx is _anywhere_ inside irregx's bounding box whether it's over the actual image or not.
I've noticed that, when the (unpressed) mouse rolls over any irregx, it's oblivious to irregx's rectangular bounding box. It only reacts when it reaches the edge of the irregular shape inside, toggling from arrow to hand at the image edges. Since the mouse knows where the irregx image boundary is, is there a simple way to tap the mouse's 'eyesight' to verify whether rectx is over the correct irregx shape (meaning not just within the bounding box, within the shape inside it)? This can't be that hard.
I am trying to draw a line that goes from point A to Point B. Along the way there are objects (of any shape) that force the line to go around them in order to reach point B. It cant go through them. This is like directing someone using a map. You can only draw a line between the blocks / along the streets.
I tried that using collision tests. Fine, I can now find the coordinates at that instance, but I still cant get the line to go around the object before proceeding to point B.
I'm using actionscript to place a bitmap into an empty movieclip like so:
var bitmap_mc:MovieClip = new MovieClip; addChild( bitmap_mc ); bitmap_mc.addChild( bitmapPNG );
bitmapPNG is an irregular shaped png of a person, but when I use the movieclip as a button, the hit area is the square shape of the movieclip, not the silo. How do I make the irregular shape of the silo the hit area, and not the surrounding square of the moviclip?
I'm a novice to Flash and I've been trying unsuccessfully to display video with defined irregular dimensions (practically a quadrilateral with various edge size). Would that be possible? I see that there are only several customization options: 1. Positioning in a plane defined by (x,y) that corresponds to the position of the top left corner of the video. 2. Width and height. If it's not possible in flash, are there any other options with programmable features like that of flash?
In my design I've got a button which is styled in a unique shape. It ties in directly with another button. The simplest way to describe the button is a regular square split into two diagonal shapes (except the hypotenuse is curved).Well, I said Button, I've actually created the button as a MovieClip.Inside the movieclip I use code resembling the following:
ActionScript Code: this.addEventListener(MouseEvent.ROLL_OVER, myFunction); function myFunction(event:MouseEvent) {
I have modified the code from the Interactive Image Panning AS3 version (found here) and I have come to a standstill. If you look at my .fla (link) or the image (link) you can see its not a rectangle but has two of the top corners cut off. So it can't really be panned using the usual method because the corners need to be avoided.I have managed to trace 'white' or 'not white' when the areas i don't want panned are visible but I can't figure out how to get the scrolling to stop! My code is as follows:
I've been croping my pictures to use in my flash in photoshop but I want to crop the pictures so they fit the size of my page in flash. Does anyone know how to crop pictures in flash?
I have this image over which i have a circular crop. The user can move the underlying image and when he is ok with the result hits the crop button. How can i crop only that part of the image which is under the mask?
I'm doing a mini app in AS2 where the user can upload an image into Flash and be able to crop, scale, and rotate and image, and after they're done, save the edited image to the server.I know I have to load an image into the BitmapData, after that I'm lost.
I'm doing a mini app in AS2 where the user can upload an image into Flash and be able to crop, scale, and rotate and image, and after they're done, save the edited image to the server.I know I have to load an image into the BitmapData, after that I'm lost.
I am creating an application where users can upload their images on the canvas and they can resize the image. I need to know if its possible to make some handles for the uploaded image so the users can use those handles to crop the image? [URL]drag a clipart onto the stage and take a look at those Orange handles around the image.I just need to create that kind of effect in flash actionscript 2.
I'm running a web application built on Seam. I would like to have an image upload + crop component. Preferably on client side, so the image uploaded to the server would be the result of the crop. I read this can be made with Flash 10. I was thinking flex is also a possibility. Does anyone has good hints to give me, what component to choose or what is the best way to connect the backing bean I have with the flash/flex?
I just started working with bitmaps and I do not get them at all, I've read the entire page adobe has on bitmap and bitmapdata. I've got this code together but all it does is displays a white rectangle and not my image.
function makeSquare(sgu:String,clo:uint):void { var squ:Sprite = new Sprite(); addChild(squ);
[code]....
Now my problem is; that i'm from another function would like to make a call, that deletes a specific rectangle previously generated by the above function.
I've been playing with the Jpeg encoder now for a while and haven't come much further than just realising how to turn an image into a ByteArray of numbers. The code below is incredibly useful at turning a movieclip on the stage into a Jpeg and downloading it to the user. Unfortunately I need to amend the Bytearray first with a crop tool before creating the jpeg. e.g. delete the array value if the image is outside of the rectangle? And a rotate tool, e.g. all the values in the array switch places 90 degrees!? (the X and Y values switch over).Also it downloads to the user, but I need it to save onto the server so I can keep using it in flash, before then emailing the jpeg to a known email address.
(E.g. if a 10px x 10px bitmap, would have 100 values in the array, to crop it into a 5 x 5 image, I would delete array entries where X < 2 and X > 7 and Y < 2 and Y> 7. Or to rotate it, X for 1st pixel becomes the Y for the 1st pixel and vice versa)....
I'm currently using a script I picked up from these forums to attach movieclips from the library based on how many child's there are in an XML document.I was wondering if it was possible though, to have each movieclip placed in a random location on the stage; but restrict that random location to a SHAPE I draw? For example if I drew a giant star, and wanted the movieclips to randomly attach anywhere within the boundaries of the star?
I know there are methods of restricting the random placement by using x and y values to keep it below or above a certain line, but is it possible to restrict placement within custom drawn shapes?
Here is the script I'm using atm:
Code: function loadXML(true) { if (true) { xmlNode = this.firstChild; title = [];
Array of color id-s represents a 3D Array of values. I've represented each value with a color(Blue is 1, Red is 2 and Green is 3). So for the example the array for the image would be:
ActionScript Code: var myColorArray:Array = []; myColorArray = [ [0,0,0,0,0,0,0,0,0,0],
[code]....
Now, I have an array of predefined shapes/objects. I'd like to replace the grouped colors with the shapes that I have. I'd like this to follow the rule of finding the largest shape first and then down to the smallest one.Now let's assume that the L shape is A, the Z shape is B, the third one is C and the last one is D. Now our new Object array would look like:
ActionScript Code: var myObjectArray:Array = []; myObjectArray = [ [0,0,0,0,0,0,0,0,0,0],