Flash - How To Erase Part Of Sprite Graphics

May 6, 2009

If I have a sprite, with which I have drawn some stuff, how do I erase part of what I have drawn? Preferably I could use drawRect with some "alpha=0" paint. However, I don't believe beginFill lets you set an rgba color (like you can in bitmapdata). Setting alpha = 0 in beginFill doesn't really do anything -- it just draws nothing. In my particular use case, masking isn't an option. Also, calling clear() isn't a good solution since it clears away everything.

View 3 Replies


Similar Posts:


Flash :: Erase A Part Of Flash.display.Graphics Canvas?

Sep 9, 2011

Is there any way to erase a part of flash.display.Graphics canvas? Like

[cODE]....

This produces just a red square (the last 3 calls are noop), and what i need is a transparent square hole in it.

View 1 Replies

ActionScript 2.0 :: Erase Vector Graphics Run Time?

Apr 20, 2005

is it possible to erase vector graphics run time...

e.g. you have some dirt in one layer (a vector shape), the layer below containing an image, and then "wash" the dirt away with the mouse cursor...

View 2 Replies

ActionScript 3.0 :: Erase Tool MovieClip.graphics.lineTo?

Jul 31, 2010

I have one simple app, loads an image and then via class that extends shape the user is able to draw. Now I want to create an eraser tool so the user could erase something that he dislikes. As far as I know the easiest way is to make:

Code:
lineStyle(size, 0xffffff,1);
moveTo(mouseX, mouseY);

[code]......

View 7 Replies

ActionScript 2.0 :: Edit/erase Part Of The Vector Draw?

Mar 26, 2009

I want to create worm game with actionscript. First of all, i will create the ground with vector draw. By using actionscript, is there a way to edit or delete part of the vector draw(ground) when the target(shooting) hit the ground?

View 1 Replies

ActionScript 3.0 :: Edit/erase Part Of The Vector Draw?

Mar 26, 2009

I want to create worm game with actionscript. First of all, i will create the ground with vector draw. By using actionscript, is there a way to edit or delete part of the vector draw(ground) when the target(shooting) hit the ground?

View 1 Replies

ActionScript 3.0 :: Make Earser To Erase Only The Drawing Part Not The Background Image

Aug 13, 2009

how to make eraser tool my problem is i have two sprite one have backgroun image and other one have drawing by pen ,brush. 
 
now i want to make earser to erase only the drawing part not the background image .

View 6 Replies

ActionScript 3.0 :: Erase A Sprite Completely

Dec 31, 2010

I recently saw "Remove or Reuse" by badaboom, in which he set the the invader instance to "null".In my constructor, I have a sprite variable as [code]When the user clicks the start button, the trail sprite is used.[code]After the user click the start button, a timer starts and the trail is drawn [code]Since this is a simulation, the user will want to erase all the trails drawn at some instance to show new examples. In in the reset button, if I set:[cod]Then do I lose the trail variable? Because I need to re-use it later in the start button and in the timer. I also learned somewhere that garbage collection only collect when the variables does not link to any other instances. In this case, the trail is still sticking onto the container_mc right?I have tried container_mc.removeChild(trail) alone, but when I addChild(trail), none of the trails drawn are deleted.

View 4 Replies

ActionScript 3.0 :: Sprite.graphics And Setting Sprite.width?

Jun 19, 2009

It has been a great resource of the years. No my problem. I am trying to dynamically resize a sprite that has a line drawn into it. Here is my code:

[Code]...

View 4 Replies

ActionScript 3.0 :: Flash Clearing Graphics Object Of Sprite When Dispose Off

Jan 29, 2012

When I'm disposing a sprite which has drawings on its graphics object, Do I need to use "graphics.clear()" or is "mySprite = null" is enough?

View 3 Replies

Actionscript 3.0 :: Flash Drawing Board With Erase Function / Erase Line By Line

Jan 9, 2009

Im building a pretty simple drawing board in flash, i got this code from this forum and it works fine (there is more to it but this is the drawing part)[code]This works fine. But i want to be able to erase the drawings, step by step this is ths tricky part, ive looked everywhere(ok not everywhere) but in a whole lot of places but the only thing i found is how i could delete everything with removeChild and that in not what i want. Maybe i need to change the function abowe? Please help me to get in the right direction. What should i read about /look at?

View 5 Replies

ActionScript 3.0 :: Compile A Specific Part Of Vectors And Graphics Definitions

Jul 27, 2009

I've been trying to implement and make classes out of some code that was written in the timeline by someone else; some problems have inevitably arisen. One of these problems is that I can't seem to compile a specific part of it concerning vectors, given that it tells me that there were no property definitions for the variables and that upon importing, these definitions could not be found:

[Code]....

It also tells me that Vector is not a compile-time constant, and its methods or properties could not be found. Besides this, I can't seem to find the definition for BlendMode for applying a filter with the BitmapData draw() method. Below I list the pertinent piece of code for you to be able to help me in case there's something wrong in my writing. Oh and BWT, what does this declaration mean? var i:Vector.<int>=new Vector.<int>([1,2]); I don't understand why the array brackets inside an int Vector.

[Code]....

View 4 Replies

ActionScript 3.0 :: Copy Graphics From MC To Sprite?

Jun 4, 2010

I have a MovieClip with pictures on all its frames. How can I copy the contents of MC's current frame (picture) to a Sprite?

View 1 Replies

Actionscript 3 :: Displaying Huge - Scrollable Graphics In Flex - Part 2: BitmapData Into An Image?

Aug 6, 2009

I have the code to copy parts of a huge loaded BitmapData to a target BitmapData that is just the size that I can display. I think I have set the scroll bars of an enclosing Canvas to show the size of the larger image and allow the user to scroll. Now I need to put the selected pixels on the screen. When I try to add a Bitmap component as a child of the Canvas, it get an error because Bitmap is not a UIComponent. What's the best way to put the target BitmapData into an Image component?

View 1 Replies

ActionScript 3.0 :: Fading Out Part Of A Sprite?

Aug 7, 2009

I have sprite object (a rectangle) with a line dividing it into 2 parts and a text field in the 2nd part. Now, I want to gradually fade out only the 2nd part of this rectangular object to alpha=0.2. How can I achieve this?

View 3 Replies

ActionScript 3.0 :: Sprite / Mouseover And Display Graphics Name

Dec 14, 2011

I am using a third party flash as3 code to load graphics using sprite. There is a class (load) that takes care of the loading of the graphics.In a new class(getname), I want to be able to1. Load the graphics (done)2. On mouseover change the color of graphics(done)3. Display name of rolled over graphic (not working). I have tried the following in
getname:var feature : load;feature.name;
I get a null object error. Now I have used the mousevent routine(e.target.name) and can display the instance #(instance149). But what I really want is the name of the graphics that the load function loads (graphics and the dbf with all the attributes including the name).

View 9 Replies

Actionscript 3 :: Graphics - X And .y Property Of A Sprite In Measured From?

Jun 29, 2010

Where does the .x and .y property of a movieclip in actionscript 3.0 measured from? from the centre of the object? or..

[Code]...

View 2 Replies

ActionScript 3 :: Direct Access To Sprite Graphics

Jul 27, 2010

I"m new to AS3 and I would like to know how can I get to graphics of a Sprite so I could draw it directly from it. I mean I don"t want to use Sprite class as my concrete objects I just want Sprite to hold graphics so if my own object needs to be drawn it asks for graphics to SpriteManager which returns Sprite with required graphics and draws it exactly where I want to not where Sprite's coordinates points to.

View 1 Replies

ActionScript 3.0 :: Glow Filter To Part Of Sprite?

Sep 19, 2011

Im creating a sprite rectangle and put individual lines in the middle. Certain lines I would like to apply a glow filter to, but I don't want to apply it to the whole sprite.

View 7 Replies

ActionScript 3.0 :: MovieClip Sprite Versus Drawing With Graphics

Jan 26, 2012

I have a program that dynamically draws a polygon wherever the user clicks on the screen. (using lineto, moveto) However this polygon is always behind the other symbol objects on the screen even though its added last in the childlist. Is there an issue with depth when drawing symbols vs. drawing with lines? How can I ensure my dynamic object will display in front?

View 3 Replies

Actionscript 3 :: Mouse Over Change Sprite Graphics Color?

Sep 16, 2010

I have created a sprite as below:

var arrowHeadRight:Sprite = new Sprite();
with(arrowHeadRight.graphics){
beginFill(0xDDDDDD, 1);
moveTo(50,0);
lineTo(0,50);

[Code]...

On Mouse Over, I wish to change the color of the fill on this shape? Can this be done or do I have to re-draw the graphics with an updated beginFill line?

View 1 Replies

Actionscript 3 :: Passing A Rectangle To Sprite.graphics.drawRect( )

Mar 5, 2011

Is there a neat minimal way of doing this? (this produces an error):

var freeSpace = shape.freeSpace() // returns Rectangle
var s:Sprite = new Sprite();
s.graphics.drawRect(freeSpace);

Just looking for a more cleaner way other than something like .drawRect(freeSpace.x, freeSpace.y, freeSpace.w, freeSpace.h) I know you can do it with bitmapData.fillRect(rectangle), but need sprites in this case.

View 1 Replies

ActionScript 3.0 :: Graphics Stuff On A Sprite When Imported All That Was Required?

Jan 20, 2010

I wrote this code and it doesn't work:

[code]....

Did I miss a class that I have to load? What's wrong with it?

View 4 Replies

IDE :: SWF Optimization - Heavy Graphics - Convert A MovieClip To Sprite

Jun 19, 2009

I'm coding games that come with the graphics done. Unfortunately the designer has some bad practices, such as not using Sprite symbols - never. And the files have dozens (even hundreds) of symbols in the library, very few of them with any animation. I would like to re-brand such symbols as Sprite to save some CPU (and maybe even kB), but my graphics-related skills are very low. Where should I start? Check and convert the symbols at authoring time or it's possible to do this at runtime? Can I effectively convert a MovieClip to Sprite (I'm guessing casting to sprite won't help much) or another light image type?

View 3 Replies

Actionscript 3 :: How Does Graphics Class Work Without Needing To Extend Sprite / Shape

Nov 21, 2010

So I'm playing with a project where I want my class to be able to use the functionality of the Graphics class without needing to extend Sprite/Shape. My goal aside, I guess I'm confused as to how it works at all? It's methods don't seem to return anything, and since it's added as a child property of the Sprite/Shape classes , I can't seem to figure out what it's actually doing? It's also one of those classes that can't be instantiated.

At this point, I'm just plain curious. EDIT: I should provide more clear distinction of what I'm looking for as answer. I have read the documentation, but the documentation doesn't account for what AS3 is actually doing. I'm looking for educated guesses about the programatic relationship between Graphics and the the classes that use it.

View 1 Replies

ActionScript 3.0 :: 1119: Access Of Possibly Undefined Property Graphics Through A Reference With Static Type Flash.display:Graphics.

Oct 8, 2009

i am trying to receive in my function as a parameter either a shape or a sprite and then access their graphics property, but this gives me an error:

Code:
public static function makeRect( obj:DisplayObject, ...
var g:Graphics;
if(obj is Sprite){

[code]...

//1119: Access of possibly undefined property graphics through a reference with static type flash.display:Graphics.

View 1 Replies

ActionScript 3.0 :: Make A Sprite Button With Graphics And Can't Make It Work?

Aug 22, 2011

* I have a flash project called contact

* The document class is ContactClass

I am trying to make a sprite button with graphics and can't make it work. I have successfully added text fields so I know the path is correct. I suspected my code was correct and confirmed it should be, after reading several tutorials showing the process for creating sprite buttons with graphics. Anyway, I imported nearly every class on Earth, but certainly everything which needs to be. Stage is gray and 800x600.The graphics code by itself with appear, but not when linked to the sprite. Also, the sprite won't appear no matter what. Another interesting piece of the puzzle: nothing will trace, not even objects such as textfields which actually appear and function on the stage when I text the code.

public class ContactClass extends Sprite {
public function ContactClass() {
var home_btn:Sprite = new Sprite();[code]....

View 3 Replies

Flash :: Erase A LineTo Line In AS3?

Apr 5, 2011

I have this file http:[url].... Basically lines gets drawn where ever I tween the animation.arrow MovieClip. What I'm wanting to do is be able to rewind the MovieClip and have the line erase its self step by step.

View 1 Replies

Flash :: Erase Algorithm To Be Implemented Using AS3?

Jun 10, 2011

Is there any algorithm to perform erase operation in a bitmap? I would like to create functionality similar to how photoshop or other graphic application performs erase. Is erase operation so difficult that there isn't much help (for bitmaps) available? I am OK even with name of an algorithm, I can proceed from there.

View 2 Replies

Flash: `sprite.visible = False` Doesn't Hide Sprite Immediately?

Apr 4, 2011

I've got a sprite which I want to temporarily hide... But changing the .visible property doesn't do what I expect. The code looks roughly like this:

[Code]...

View 1 Replies







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