ActionScript 3.0 :: Delete A Drawn Object From The Stage?
Feb 18, 2009How can I delete a drawn object from the stage to then use the same function to draw it up again?
View 1 RepliesHow can I delete a drawn object from the stage to then use the same function to draw it up again?
View 1 RepliesHow do you add a drawn object to the stage using actionScript 3? Does the object need to have an instance name?
View 2 RepliesI've read many many articles and I've asked others if the can help, but I'm stumped. The functionality I'm looking for apparently works in CS5 of as3, but it's not working in my cs4 version of as3.
This is what I'm trying to do. I've created a first person shooter game. I have bullets come out of a gun and hit the bad guys. When the bad guys are hit, I want to do the following -
1. make the bad guy and bullet invisible - done, works.
2. remove all references to both the bad guy object and bullet object - done, seems to work.
3. delete the bad guy object and the bullet object from the stage - doesn't work, can't seem to figure out why not.[code]...
I have created a class, call it Class1, that has various objects drawn on the stage (drawn in the IDE). It also has a function, called setColour, for changing the colour of those objects. The function works fine if I call it from within Class1.
Now I have another class, call it testClass1, that imports Class1 and calls the setColour function. First of all, none of the stage objects from Class1 are visible. Secondly, when setColour tries to modify the colour of an object, I get the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
This is the code for testClass1:
ActionScript Code:
package
{
import flash.display.*;
[Code].....
So, what is the problem? Is it possible to change objects that are drawn on the stage of an imported class?
When I use MouseEvent.MOUSE_OUT the target is [object MovieClip], but when I use MouseEvent.ROLL_OUT I get [object Bildspel] - and Bildspel is my class. The thing is that when I use ROLL_OUT I'm not able to delete the targets ENTER_FRAME event.
[Code]...
Lets say I have a customMovieClip. I sometimes draw an ellipse with customMovieClip.graphics and sometimes a rectangle. Now I want to know what was the shape ( ellipse/rect) that was created using a particular graphics object. Doing this would enable me to pinpoint what exactly to do with that customMovieClip() instance.
View 3 RepliesI had to create dynamic with AS some rectangular on stage using moveTO and lineTo. I had a button and when I press it should add a new rectangle on stage but it doesn't. Because the array that I am storing the MovieClip created are overriding I guess
var i:Number =0;
button_name.onRelease = function() {
i++;
var instancename:String ="new_mc"+i;
var mcClip:MovieClip=createEmptyMovieClipinstancename,this.getNextHighestDepth);
[Code] .....
I need to drag a component along a programmatically drawn path composed by different kinds of graphic, like lines, curves, etc.
View 3 RepliesLets say I have a customMovieClip. I sometimes draw an ellipse with customMovieClip.graphics and sometimes a rectangle. Now I want to know what was the shape ( ellipse/rect) that was created using a particular graphics object. Doing this would enable me to pinpoint what exactly to do with that customMovieClip() instance.
View 3 RepliesThis time round i need to get the pattern drawn on the drawing board to be repeated on another area of the stage.I need it to be repeated 4x4 tile.
View 1 RepliesI would like to change backgroundColor of an drawn object(square) by mouseover. I acutally found the function for mouseover in action scripts but BackgroundColor("#ccc") does not work.
View 3 RepliesI have made this flash thing. And it makes mcs on stage, and i have a button where i want to delete them all but cuzrrently my button deletes 1 at a time.I want it to delete all of thwem at 1 time
View 1 RepliesNeed to delete a movieclip off of the stage. It's messing with my button focus. Setting it to invisible isn't working.
View 2 RepliesNeed to delete a movieclip off of the stage. It's messing with my button focus.Setting it to invisible isn't helping.
View 2 RepliesHow can I delete Movieclip and its effects from the stage by as3?
View 2 RepliesDoes anyone know how I could remove properties that have been set on a static object in AS3? it would be something like -
foreach(property in GlobalStaticVar.properties) {
GlobalStaticVar.removeProperty(property);
}
I have a contextMenuItem on an object that I want to use to delete the object. The object being deleted will not have an ID so how can I remove this object from the stage?
View 0 RepliesI have a project I'm working on and I am really stumped on making a seemingly simple animation work.The animation is of a coin scratching off a layer to reveal the layer beneath. I have the coin animated, and the layers in place. I am wanting to know if there is a way to erase/delete every place the coin passes over the stage, revealing the layer beneath. I've seen animations where ActionScript is used to allow a user to control the coin/pointer and activate the "scratch-off" effect. However, I am trying to come up with a method that is not a user-initiated animation since I want the effect to repeat in several places in the timeline.For the life of me I cannot figure out how to make this work. I am a moderately skilled Flash user and an ActionScript novice.
View 1 RepliesAll of the bullets are of the "Bullet" class and are stored in an array called "bullets" in the main class. When bullets exit the screen, removeBullet(bulletID) in the main class is called.
private function removeBullet(id:int)
{
removeChild(bullets[id]);
bullets.splice(id);
}
In my Bullet class I have an enterFrame listener that traces "stillHere". So as soon as a bullet is added to the main stage using addChild, "stillHere" starts popping up in my output panel.
My problem is that even after I call the removeBullet, "stillHere" keeps popping up in the output panel, which tells me that the object which I tried to delete is still sticking around somewhere in the memory.
Flash gives access to query-string parameters via calling loaderInfo.parameters() method.And I couldn't delete the field on the object. IS it possible to delete some fields in the object? how can I do this?
View 1 RepliesI have created a delete button, and when the user clicks it.. I want it to delete the selected movie clip. I have created a variable selecteddrawing to store whatever movie clip is currently selected.
when i call the event listener, and tried removeChild(selecteddrawing) it gives me this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at SendLove/deleteListener()
Here is the code that i just wrote for the delete button. I will attach the entire AS3 file as well.
ActionScript Code:
create.delete_btn.addEventListener(MouseEvent.MOUSE_UP, deleteListener);
private function deleteListener(event:MouseEvent):void {
[Code]....
"you cannot delete variables that are declared within a function with the var statement".Which, as it happens, is precisely what I was trying to doI want to delete the object because it holds a bunch variables that are no longer needed, to prevent potential speed/memory issues later on.it's impossible (probably with reason) and I know vars are local to a function, so now I'm wondering if it is actually necessary to remove local variables
View 3 RepliesFlash will automatically remove the objects that you added onto the stage when the frame changes, but leaves all the objects created by actionscript. cleaning them up/removing from stage when the frame changes?
View 8 RepliesI need to remove the value associated with a property in a Flex 3 associative array; is this possible?
For example, suppose I created this array like so:
var myArray:Object = new Object();
myArray[someXML.@attribute] = "foo";
Later, I need to do something like this:
delete myArray[someXML.@attribute];
However, I get this error message at runtime:
Error #1119: Delete operator is not supported with operand of type XMLList.
How do I perform this operation?
in shared object Delete specific Items i her store MovieClip int shared object then show Movie Clips in the posistion x and y wit text field which hold the string value the problem is i cant delete specific movie clip from shared object this code
seevoo._visible = false;
user_co = SharedObject.getLocal("coment");
i=1;
///////////////// if condition to out if the value of shared object undefiend ///////////////
[code]....
I was wondering if it possible to write up some AS that will take line paths that you have drawn and convert them into a Path object? For example say you drew a jagged line from left to write, would there be a way to have AS convert that into a Path object.
View 11 RepliesIs there a quicker way besides iterating thru all entries in the associative array Related to - How do I delete a value from an Object-based associative array in Flex 3?
View 2 RepliesI got these four errors when I tried to create a button on the stage that would delete the text I inputted in the inputtext(ti). Based on the scripts I have and the errors, what should I write to create the delete button?
[Code]....
I am implementing a flex auto-suggest combobox - as the user types in each character: Consider the string 'Stackoverflow' and user input = 'st'
1) the data provider is filtered to show all items starting with 'st'
2) text is set to auto-suggest string such that the un-typed part is highlighted.
So for instance, the combobox text may contain st'ackoverflow', where 'ackoverflow' is highlighted using setSelectedIndex()When I hit back-space or delete, and check the 'this.text' value, I expect that the last un-highlighted character ('t' in the above case) gets deleted and the data provider is filtered to show all items starting with 's'. However the text property contains 'st', as before
I have a library swf (asset.swf), it's document class binded to Asset.as, and in the Constructor function of Asset,[code]as known to all, we cannot visit the stage attribute before the display object added to the stage.so, when my loader.swf try to load asset.swf, it throws exception and the loading come to failure is there some one tell me how to load the asset.swf? I cannot modify the asset.swf.
View 0 Replies