ActionScript 3.0 :: Coloring (or Erasing) An Object And Checking When Complete
Jul 21, 2011
I've got to build a kids game at the moment for my school, and I was planning to have a sort of archaeological dig, with the kids required to rub the screen (it's for a touch-screen) to "un-earth" the bones underneath.I was thinking of either erasing an overlay and checking for a hitTest between the two objects, or coloring in with a line or something.Is it possible to color something in and check when the object has been completely colored? or possible to erase an overlying object? and if so, can you point me in the direction of a tutorial or a quick explanation?
View 2 Replies
Similar Posts:
Feb 2, 2010
I'm working with Threshold on BitmapData class. I need the threshold return the modified pixel (the pixels match with the equation).I need to detect how many pixel have changed to get the percentage of the complete erasing! I did it with getPixel32/setPixel32 but it's faster with threshold (i'm doing it on 15 bitmapdata at the same time)
pixelChanged += bmp.bitmapData.threshold(bmpBrush, bmpBrush.rect, new Point(this.stage.mouseX, this.stage.mouseY), ">", 0);
so, each pixel bigger than 0 should match this equation ... and they will be set to 0 after that (default color value). Next time, because they are 0, pixels are not suppose to change again because 0 is not bigger than 0 ! But it still return me a value, like if the pixel have changed! I've tried with different combinaison of mask/threshold .I join a sample of my problem (drag the triangle and check the output window ... the number increase even if the pixel is transparent 0x00000000)
View 1 Replies
Sep 12, 2006
Is there a way to add a listener or something to a function so when it's finished it will run another function?
I need to run a function in a class, and when it's completed run a function on the main timeline or elsewhere.
View 1 Replies
Aug 6, 2010
In my script I create a button that when clicked, creates a blue square. However, I want to remove any blue squares that exist before creating the new square (because as it is a low opacity square creating another one will make it more solid, as well it's just more objects that the system has to keep track of).Here is my code:.as
ActionScript Code:
package{
//importing required classes for this to work
[code].....
View 2 Replies
Feb 18, 2009
How can I check for the presence of something on the stage? I want to disable mouse clicks on the currentTarget while an image is loading, and I'd like to use the presence of a progress bar as the determinant to proceed.
Code:
If (progressBar is somewhere on the stage)
{
currentTarget.mouseChildren = false;
currentTarget.mouseEnabled = false;
}
View 2 Replies
Dec 11, 2009
I want to do something like this in Actionscript 3:
if(variable is Object) ...;
else ...;
Where variable could be a String(), Number(), Array(), Object()...Currently the above check returns true for all of these types, which makes sense. I only want it to return true for objects made with new Object(), however.
View 2 Replies
Oct 6, 2011
I have a spinning sphere, built using the away3D engine, it is wrapped in a bitmap. I need to be able to check the color value of the pixels in the sphere, however BitmapData only plots the 2D image, not the 3D sphere. So, the values become wrong. If I try to apply it to the sphere I get nasty errors. I have literally been stuck on this for days.
View 1 Replies
Aug 7, 2009
Is there a way to check whether a loader object is in the process of loading something? I need to create an if statement that checks if the loader has an open connection. So far, what I thought of is:
ActionScript Code:
if(loaderInstanceName.contentLoaderInfo.bytesLoaded > 0)
{
// do something
}
Here, I'm just assuming that if bytesLoaded is greater than 0, than it's probably loading something. But I don't think it will revert back to 0 after the loader finishes loading an external resource. So after that, bytesLoaded will always be greater than 0 even though it isn't in the process of loading anything. Is there any other property that I can use which says whether the loader object has an open connection?
View 2 Replies
Feb 10, 2010
I have a name for the object, but it doesn't seem to work.Anyone know why this doesn't work?
Code:
if (sprite) {
removeChild(sprite);
[code]......
View 8 Replies
Dec 16, 2011
I want to check whether the color = a certain color then appropriatly react. This is done in flash AS3.
the code I've got is
if(cal_mc.color == 0x0000FF) {
p1score = p1score + 25;
(cal_mc being the object)
It executes without any errors but doesn't work. Can anyone tell me what I'm doing wrong with the if statment?
View 1 Replies
Nov 28, 2011
I'm attempting to make a platform game. Each level is contained within it's own MovieClip, which has it's own class. Each of these classes extend the Level class, which provides basic functionality for all levels.
Each individual level has a numPlatforms variable which stores the number of platforms in that particular level. I currently have a for loop that runs from 1-numPlatforms and sets the level area (the image, more or less) the platform contains:
[Code]....
Is there any way to check if a variable exists within a MoveClip? I've trying comparing it to null and also to undefined, but neither works.
View 2 Replies
Apr 10, 2010
Sound object. Event complete doesn't work
function init() {
this.soundsArray[i-1].addEventListener(Event.COMPLETE, completeSoundHandler);
this.soundsArray[i-1].play();
this.blHit=false;
} function completeSoundHandler():void {
[Code] .....
View 1 Replies
Nov 10, 2009
I've one loader which load a png file. I used contentLoaderInfo to intercept COMPLETE event like this:
loader.contentLoaderInfo.addEventListener(Event.Complete, handler); The problem is that at the complete event I want to push this object into an array, like this:
function handler(e:event){
var array:Array = new Array();
array.push(e.target);
}
E.target is the reference to the contentInfoloader, while I need the reference to the loader itself. How can i resolve this issue?
View 3 Replies
Apr 14, 2012
I can't add name and image from Facebook contacts to SqLite, becouse adding is inside in loop and loader start when Event is Complete. Fllowing code adds data to the database, but in the name of the object is the last person out of the loop.
private var person:PersonVO;
protected function handleFriendsLoad(response:Object, fail:Object):void
{
if (fail) { return }
[Code].....
View 1 Replies
May 1, 2011
Is it possible to get autocomplete-functionality on objects keys?
var obj:Object = new Object();
obj.name = "AName";
obj.weight = "100";
When I type obj. -> i would like to see the keys(name,weight);
View 2 Replies
Jan 13, 2010
In Actionscript 3, I'm trying to build a button to go back from a content frame to a main menu. When the button is clicked, IF the content frame has a movie in it, that movie should stop playing. Flash keeps throwing a "null object reference" error on all pages that don't include a movie. I even tried putting in a check to see if the movie exists, but that doesn't work, either.
ActionScript Code:
function return_to_menu( me:MouseEvent ):void {
if ( flashmo_contents.flv_movie ) { //this line produces errors in frames where the movie
[code]....
View 2 Replies
Dec 11, 2010
I want to trace how URL looks when it is sent like in following example when using params:
[Code]....
How to trace complete URL with added parameters that is sent? Also, I used Charles debug proxy, but could not get which URL was sent.
View 1 Replies
Jan 18, 2011
I am a bit stuck here for the past few days. I have a SWF running in Security.LOCAL_TRUSTED sandbox. I can load my JPEGs and simple SWFs without any problems
[Code]....
View 2 Replies
Aug 24, 2011
I am having an issue with a class I'm working on. I currently load an image as a bitmap and store its data into regState:BitmapData so that I may make new instances of that image later on. When I test if I can use the loaded data at a later time with my newBitmapIntance() function, it says that regState is null. I'm lost as to why this is the case, since it works flawlessly to create an instance of itself in my loadContent() function.
Class so far For reference:
package {
import flash.display.MovieClip;
[code].....
View 1 Replies
Jun 14, 2011
I made a test where I download a file using URLLoader - something like this:
[Code]....
in the middle of the downloading process I physically disconnect the internet connection. the download stalls - but after aproximately 30 seconds downloadSuccessful is invoked, although only half of the data was downloaded. how can I make sure that the data to be downloaded is complete and correct?
View 2 Replies
Feb 17, 2011
I am loading in binary files with the url class which can be quite large 10mb + and it works fine on my server but another server I am testing on it can sometimes not work. Sometimes it will not load the file and other times it will only load about 20% and it throw a complete event??? Then of course other times it works fine. This server is https maybe that has something to do this it?
View 0 Replies
Mar 9, 2011
I have no experience with Object Oriented Programming, so I wonder about the following:
1) Will the code past the .LOAD line (in red) be executed only after the image completes loading?
2) Can I nest several listeners as seeing in my code below?
[Code]...
View 7 Replies
Oct 14, 2010
I have a fully working flash application, made in as3. Now i dynamicly added a movieclip and i would like to be able to erase that movieclip with a eraser of some sort, my goal is to be able pick up a sponge with the mouse and then start dragging over the movieclip and erasing the parts where i dragged over it.
View 2 Replies
Jan 12, 2010
I tried to erase whatever was drawn on the stage by using a similar function in a recent previous post but I'm not getting it.when I try to use it an error says that this is no longer supported. I tried addChildAt() and inserted different Num but it only erased everything including my button.the current code is:
var drawing:Boolean = false;
this.graphics.lineStyle(5,0x000000);this.graphics.moveTo(mouseX,mouseY);
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false,0,true);stage.addEventListener(MouseEvent.MOUSE_UP, onUp, false,0,true);
[code]....
View 2 Replies
Oct 6, 2010
The problem is when background of top or below label is changed, the top or below button is erased.
<mx:Canvas width="100%" height="100%">
<mx:LinkButton icon="{icon1}" width="25" x="10" y="10"/>
<mx:LinkButton icon="{icon2}" width="25" x="10" y="100" />
<s:VGroup width="100%" height="100%" id="lst" click="highlight(event.target as Label)" gap="0">
<s:Label />
[Code]...
So do anyone know the possible solution for this problem?
View 1 Replies
Jul 18, 2011
I got the following question.
i added the following elements to the stage:
homeBg = new HomeBg();
homeMask = new HomeDrawBg();
addChild(homeBg);
addChild(homeMask);
I allready instantiated them in the beginning of the document. But my problem is the following. the homeBg layer is a image, the homeMask layer is the same image but it has a pencil scetch look. What i want is that wherever i move my mouse, the homemask layer should be erased so the bottom layer becomes visible(only where the mask is erased). So how can i tell the mask layer to erase itself if the mouse is over it?
View 2 Replies
Feb 25, 2009
I'm attempting to create a dry erase board style animation effect in my flash movie where I'm erasing the text, like a dry erase board type effect. I've tried doing a frame by frame mask animation and it's not turning out very well. Has anyone attempted this before? Are there any tutorials or maybe after effects > flash tricks?
View 2 Replies
Mar 20, 2009
I'm in need, again, of some assistance. I'm making a game with 2 pictures. and the concept is built on that you erase part of the top-bitmap to see the bitmap under.How can I accomplish this?I tried to wrap my head around the bitmaps and the draw and the FillRect but can't get it to work completely.Basically I want 2 bitmaps, and a cursor which erases parts of the top one to show the one underneath.
View 5 Replies
Nov 10, 2009
I am trying to erase one movieclip from another using the blendmode="erase" setting, but can only get it to work on the stage as the parent. This means it erases a hole through everything! The attachmovie also doesn't seem to work as I was expecting and I was hoping that when you drag the movieclip, the attached clip would move with it? If you check out the FLA [URL] you can see whats happening right now and what I want to achieve (diagrams provided in FLA).
View 1 Replies
Sep 29, 2009
I'm trying to create sort of an eraser to remove sections of a bitmap on stage.
I have achieved this by creating a MovieClip in flash that is a circle and exporting it as a Class called Hole.
Now I use this MovieClip to erase a circle section of the image using the following.
var mat = new Matrix();
var ct = new ColorTransform();
var hole = new Hole();
mat.translate(x,y);
image.draw(hole, mat, ct, "erase");
Now what im trying to do is scale the size of the circle depending on a certain variable but no matter what I try the scale doesn't seem to change and. The size seems to stay the same as I drew it in Flash. I tried adding the following line
hole.width = hole.height = size;
I even created a class file called Hole and the size as a parameter
var hole = new Hole(200);
This didn't work either it still appeared to have the same size. I have even tried altering the scaleX and Y values with no success.
View 2 Replies