Deleting A Function
I am modifying a slider I made using this tutorial http://www.kirupa.com/developer/mx/slider.htm I am trying make it so if you click on the line the slider button will move to where your mouse clicked. I also want it to ease to that position. I used the as below which works fine, but after you click the line the dragger is disabled well sort of if you try and drag it it keeps easing back to where you last clicked the line. So I need to delete the onEnterFrame on the dragger right. Well I tried an if statement but its not working. Can anyone help
ActionScript Code: function slide(){ xMove = line._xmouse; dragger.onEnterFrame = function(dragg) { loop = this._x += (xMove-this._x)/easeSpeed; if (dragger._x == _parent.xMove) { delete dragger.onEnterFrame; } }}line.onPress = slide
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 06-01-2005, 09:43 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Deleting A Function- ?
I used this tut here
http://www.kirupa.com/developer/mx/fadegrid2.htm
And I am wondering if there is a way to make the fading functions be deleted temporarily, just like a "delete this.onEnterFrame" would. It conflicts with part of my move, and it goes like this:
On one layer, I have the script, image, and box for the above tut. In another layer (above the other) is one that contains a container MC for loading in the various areas (portfolio, contact, etc).
The problem is, if you click the "contact" button, then "back", then "contact" again before the grid stops it's fade routine, the effect will transfer over to the externally loaded MC. Oy.
Here's the URL to see what I mean.
http://www.stevegeer.netfirms.com
Only contact works, and at that, the PHP isn't offered for the free names, it's just a holder until I get a "real" domain name.
-S
Deleting Function?
If I wanted to Delete the function... say it's called myFunction. I would put the as code: delete myFunction
but i want it to be called once again later on in the movie how would i go and do that? is there a better method to delete/hold a function until it's called again? thanks!
Other Than Deleting A Function?
Here is a question.
If your using the easing equations by Rob Penner and your creating the tweens using a function and then deleting them after the function is run. Is there a way to recall the function instead of deleting the function?
Thanks.
[F8] Deleting An OnEnterFrame Function
How do I go about deleting an OnEnterFrame Function after it's completed it's task, since it's just going to loop forever and ever.
Does that also chew up your memory if it's not removed?
Deleting Function From Timeline
How would I go about deleting a global function from a movie. This basically is a function that pauses the timeline. I want to be able to delete this function at a certain point so it can't be used again.
ActionScript Code:
MovieClip.prototype.wait = function(n:Number) {
this.stop();
this.myInterval = setInterval(mx.utils.Delegate.create(this, function () {
this.play();
clearInterval(this.myInterval);
}), n*1000);
};
Thanks.
Deleting Vars Local To A Function In A Class
Is there any advantage to deleting vars instantiated within public or private functions in a class, or are they removed from memory after the function has been invoked/run? The function below is completely arbitrary for example:
ActionScript Code:
private function someFunctionHere(_ar:Array):Void {
var _swf:String = _ar[0];
var _nm:String = _ar[1];
var _num:Number = 5;
//use them here
delete _swf;
delete _nm;
delete _num;
}
Deleting Vars Local To A Function In A Class
Is there any advantage to deleting vars instantiated within public or private functions in a class, or are they removed from memory after the function has been invoked/run? The function below is completely arbitrary for example:
ActionScript Code:
private function someFunctionHere(_ar:Array):Void { var _swf:String = _ar[0]; var _nm:String = _ar[1]; var _num:Number = 5; //use them here delete _swf; delete _nm; delete _num;}
Deleting
Hi there,
I've tried to find a previouse post that covers this but can't.
I am loading data from a database into flash (with PHP) and the variables get named item_1, item_2 ... using the code:
loadVariables ("products.php3", "_root.temp", "POST");
on a btn and in the php I generate the suffix for the variable name.
Anyway all this is fine but HOW can I use the delete function to refer to these variables to delete them all.
The problem is that when I load in 26 of them and the next search produces 2, the first 2 are replaced but the rest still remain.
TIA
Slarti
Deleting SO
I am deleting items from the sample guestbook that comes with flashcom, with this code:
function itemClicked(pictureID){
_root.entries_so.data[pictureID] = null;
_root.doRefresh();
}
Strange things happen such as deleting more than 1 object. Also once I delete an object this way, I can no longer add objects to the server. I have to clean out the server side data and reload the application and start fresh.
Since this doesn't work, how would I use the stream.clear() to delete and object?
I know you would put the something like the following code into main.asc
application.onConnect = function(client, id){
s = Stream.get("foo");
if (s){
s.onStatus = function(info){
if(info.code == "NetStream.Clear.Success"){
trace(info.description);
}
if(info.code == "NetStream.Clear.Failure"){
trace(info.description);
}
};
s.clear();
}
}
I have no clue if this is how I would setup up this function on the server side and I am not sure how to call it saying that I want pictureID deleted.
Any help would be greatly appreciated.
Chris
Deleting This.Mc
hey dudes
this does not work, any other way to delete a movie clip when pressing it??
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.button.removeMovieClip();
}
}
cheers
AS For Deleting A MC
Whats the AS for deleting a MC? I have a dragable box and I want to create a button to close it...but dont know what the action script is to delete the MC...do i need to use removeMC? Thanks.
Deleting Mc's
i have a button that duplicates mc's; the code is:
-----------------
on (press) {
i = i + 1;
duplicateMovieClip (ce, "ce" + i, i);//ce is the mc name
}
-----------------
i have another button that i want to delete those duplicates; the code is:
-----------------
on (release) {
while (count >= 0){
removemovieclip(_root.ce + i);
var count;
count= count+1;
}
}
----------------
But this last code doesnt work at all
How can i improve it?
this last code was inspired from here:
www.macromedia.com/suppor...e_clip.htm
(but i dont understand it at all)
Deleting A MC
Well, the problem is this:
I´m working on a menu, that apears firstly closed. Only a button is visible. Button is working like this:
An empty button (with only the active zone in the right form and size) isa placed over a mc, wich offers the appearance of the button. On clicking the button, the mc gets the play() command, and changes it´s placing and content. At the same time (an triggered aswell from the button) the menu is opening below. As this is the only action I want the button to do, I want to delete it, to avoid bothering and erroneus repetitions of the action I just explained. Any way to fix this? If there is a way of making the button useless (deleting in any way the actions it does when clicked) I would really agree too. TIA
Deleting An Mc
if I am creating an mc in a class like this:
var t_mc:MovieClip = target_mc.main_mc.createEmptyMovieClip("temp", -100);
How do I delete it when i'm done with it.
Deleting XML
hey guys i have this XML slideshow thing, and a company can pick out the pictures(comming in by XML) that they want and i want to delete the rest(of the XML) so when they run the program again, it wont be there.
I thought about using php to do this by putting the elements in an array, but then i cant really tell how many lines to delete
Code:
<slideshow>
<imgsrc>www.google.com/images/waterever.jpg</imgsrc>
// if there is a link
<linker>www.something.com</linker>
so im wondering if there is something like in php where i can look for the "<" character or something
Deleting Word In .swf
I have a .swf file and I want to delete one word at the end. I do not have the .fla file. What can I do and does that action script program let you do this. Maybe delete the last layer. Please help.
Mike
Deleting A File
How do i delete a .txt file from within flash 5.
i tried doing a
fscommand("delete","test.txt");
but it didn't work. Any suggestions?
Deleting Words
is this possible in flash5?
I'm currently doing a vocabulary exercise and i would like the user to delete off some unwanted words from a sentence. Thereafter, i need to check if what they have deleted is correct. How can i do this? Any help appreciated
Deleting Variables
Hi all,
I have a bunch of variables set. Can I use the delete Variable command to delete all of them in one command? or I still have to mention all the variables I want to delete?
please help!
thanks
nixthinx
Deleting UI Components
I dragged some components onto my movie but then deleted them because I wanted to publish in Flash 5 format. Anyway if I publish my movie as Flash 5 format I am getting these error messages:
Symbol=FScrollSelectList, Layer=Methods, Frame=1: Line 1: You must export your movie as Flash 6 to use this action.
#initclip 2
How do I get rid of these directives? I cannot find where flash places this code. I've even deleted everything in my movie and I still get these error messages.
Thanks.
Deleting Frames In Mx
uhh, yeah, i don't know if this is glitch with my copy of flash mx but i just got it yesterday and i am unable to delete useless frames i dont need. i'll highlight them and hit delete, cut frames, or clear frames and none of them work. help anyone?
Deleting Button
What Im doing is creating a jeopardy game. After I click on a price value(button) on the categorie frame, i want it to go to the frame that i have that question on. thats easy. But I want it to also delete that button permanently so that when i return from the quesiton to the categories that button is gone. IM me if you want to discuss this. evman182 on aim
Deleting Arrays
If I do this:
var = new Array(2);
var[0] = new Array();
var[1] = new Array();
do I need to:
delete var[1];
delete var[2];
delete var;
or can I just:
delete var;
? (don't wan't any nasty memory leaks)
Tweens - Deleting
i have made an animation for an assessment and find i have tweens, I have managed to delete %90, the remaining%10 when deleted would also dissappear from the stage. I have tried pasting them into a new file, then deleting them from the original. Then i have tried to convert them into symbols and bring them back in to the original file, the tweens are now back and they keep their old tween numbers.
Can anyone suggest a way to remove all the tweens and not lose work.
Thanks.
Deleting An Object. Help
hi!
im trying to delete an created object. it really doesnt work. anoyone who has had the same problem?
PS! if i export this in flash 7 with actionscript 1.0 it works. but that is not a option.
code:
_global.internalPopAndFadeO = function(){
this.waitF = function(){
trace("hi!")
delete myObject;
//delete this // this should also work but it dont
}
this.waitInt = setInterval(this, "waitF", 200);
}
myObject = new internalPopAndFadeO();
TOYTOTA
Deleting Stuff...
hey people, i need a hand here, what code or whatever would i use to set a button so that when i release the mouse on it, it deletes itself?
help pleeease, 4 hours of today wasted, you guys are my last resort, dont let me down!!
<--TheOrangeJigger-->
Deleting Manually Placed MCs?
Can manually placed MCs be deleted thru AS? I pretty sure the reply is going to be 'no'.
Next question then:
Is it possible to acheive the same effect of AS that is placed upon a MC, for a MC that is generated via AS?
I have MCs in my Flash project that have been manually placed. Upon those MCs I have placed AS. Now I want to delete those MCs.
(After rereading what I have wrote, it looks confusing as to what Im try to say...hope someone understands)
Thanks.
Deleting Movieclips
Hello,
This is a weird one. I want to delete a movieclip. When I select the movieclip and press the delete button nothing happens. Even trying to move it won't work anymore. I thought I just delete the entire layer, but doing that only results in Flash shutting down.
Anybody any suggestions here?
thanks.
Deleting A Level?
Is it possible to delete a level from a movie? and if so, can i delete level0? or hide it somehow? I thought about loading a blank movie after the 2nd movie is finished loading so it wouldn't effect anything... so i'm trying to load a movie over _level0, but still have level0 active until level1 is finished loading and displayed, but people told me that i can't swap levels like layers, so i think this is my only option unless there's a way to delete levels?
Deleting Buttons
After a button is clicked I want all of the button to be deleted.
code:
on (release) {
n = 1;
button._visible = false;
gotoAndPlay(2);
}
I've tried this, but it's still there. Is there an easy way to get rid of it?
Deleting Scenes
Hi,
Quick question, how do you delete a scene?
One more, I just added a new scene, I want this new scene to be the first scence, how do I bring it up and make it play before the other scene?
Thanks.
Vars Keep Deleting
In the first frame it creates a variable called usernames with a value of 0. In the second frame its undefined! What is going on!
Attached is the .fla.
(Note: I had to delete the combo box that was on frame 2 due to size problems.)
Deleting Components
in the process of learning how to edit components i have managed to add a stream of usless custom components to my components menu in the flash authoring page. but i can't figure out how to clean these up. I tried deleting all the .swc files from the components directory in (flash/en/firstrun etc).
that didnt work
after a while i got frustrated and deleted the entire components and compontsfla folders from my computer just to see what would happen. But when i relaunch flash (even after restarting the computer) nothing has changed! I guess i am missing something basic about how flash handles this stuff....Any help/insight would be much appreciated.
Deleting Scenes
I have created some scenes in my flash movie that i no longer need, how can I get rid of them? Im working on a mac
Deleting Movieclips
Hello,
I am creating duplicate movieclips using action script when i click a button.
eg: newbox1
newbox2
newcircle3
newbox4
newcircle5
now i am trying to find a way to delete all these with the press of one button. Including the fact that there maybe upto 50 new clips created.
Any help or ideas would be appreciated.
Thanks,
Rian
Deleting OnEnterFrame?
code:
function tweenFill(){
this.onEnterFrame = function() {
this._width+=(_root.newWidth-this._width)/5;
this._height+=(_root.newHeight-this._height)/5;
//aplha effect (blink/fade in)
if(this._alpha <100) {
this._alpha +=5;
}
//once target dimensions is reached, stop running code
if (this._width == _root.newWidth && this._height ==_root.newHeight){
delete this.onEnterFrame;
trace("onEnterFrame was deleted");
}
}
}
I cant seem to get my onEnterFrame to delete?
is this because it never really "IS" the newHieght/newWidth ? Im looking to add a line that will remove this onEnterFrame so its isnt constantly running.
Thanks
Deleting A Movieclip
I need to know the action script to delete a movieclip if I click on it. I need to delete it write out of the animation, so it can't be seen again, or perform its duties that it was going to do.
Deleting OnEnterFrame
I have a main movieClip that has nested movieclips (acting as buttons). These movieClips react to this function (in the root) that creates the rollOver effect.
function hTest(clipName:Object) {
clipName.onEnterFrame = function(){
if (clipName.hitTest(_root._xmouse, _root._ymouse, true)) {
if (clipName._currentframe < clipName._totalframes) {
clipName.nextFrame();
trace(clipName._currentframe);
}
} else {
if (clipName._currentframe > 1) {
clipName.prevFrame();
}
}
}
};
When I click other buttons on the stage a "detail" movieClip slides in on top of these nested movieClips. I am trying to 'delete" the "onEnterFrame" of the nested movieclips so the user will not see the "little hand" coming in and out because of the movieClips that are under this new pannel.
I want to put whatever code on another button on the main menu... if it is possible.
Deleting An Action?
Hello...
On frame one of my timeline i have the following script:
Quote:
but1.onRelease=function(){
gotoAndPlay("california");
}
...where 'california' is a frame label and 'but1' is my button's instance.
Once the user clicks on the button and and leaves frame 1, I want to disable this script. I think it's causing a conflict in my movie. I tried adding a new keyframe to frame 2 of my buttons layer and deleted the instance name, but remarkable the button still works for some reason.
Is there a way to "else-null" or somehow delete the action as of frame 2?
Cheers
!!!
[F8] Deleting A Var With Attach MC's
Okay I have a movieClip attached to a var, now when I press 1 I want it to goto the frame "code" and delete the movieClips
PHP Code:
onEnterFrame = function(){
if(Key.isDown(49)){
place_tiles = false;
delete c;
gotoAndStop("code");
}
if(e<130){
if(e == 13){
align_tiles_y = 60;
}
if(e == 26){
align_tiles_y = 100;
}
if(e == 39){
align_tiles_y = 140;
}
if(e== 52){
align_tiles_y = 180;
}
if(e== 65){
align_tiles_y = 220;
}
if(e== 78){
align_tiles_y = 260;
}
if(e== 91){
align_tiles_y = 300;
}
if(e== 104){
align_tiles_y = 340;
}
if(e== 117){
align_tiles_y = 380;
}
if(e== 130){
align_tiles_y = 420;
}
var c = attachMovie("align_tile","align_tile_"+_root.getNextHighestDepth(),_root.getNextHighestDepth(),{_x:align_tiles_x[0+e],_y:align_tiles_y});
c.onEnterFrame = checkCur;
e++;
}
align_tile_ = c._name;
}
I've tried [align_tile_].removeMovieclip();
delete [align_tile_];
delete c;
delete var c;
etc.
I just doesn't work.
P.S: this isn't the full code that I'm using just the part that has something to do with my problem.
Deleting A Variable
can we delete a variable?
for example I create a global variable for a class
var _a:Object = null
can I ever delete or remove _a ?
Deleting Variables
can we delete a variable?
i.e. I have made a global variable that i don't want to use it any more. Is there any way i can delete it?
i.e.
Code:
//in the class definition
var _parent:Object={}
//somewhere else in the class
_parent.child = "a"
is there such thing as remove(_parent.child, _parent) or anything close to that
more over, I was using Object as associative array. but in array, we do have a function named splice, do we have anything like it here?
thanks
[F8] Deleting Objects
hi!
I'm making a game and I need some help . I don't think it's necassary to go into all the details. So here's the problem. I have made a class. In this class I have some properties of raw data (String, Numbers and such). I also have a propert holding a MovieClip. Now for the sake of optimizing I want to remove the entire object after using it. In my code I use the
PHP Code:
delete this;
statement to delete the object. But it does'nt work at all! It keeps returning false. So for now I use the
PHP Code:
removeMovieClip(this.container);
method just to get rid of the graphical appearance. But does anybody know why I can't delete an instance of this class? Here's the class:
PHP Code:
class ActionInterface {
// properties:
private var container:MovieClip;
private var menu:String;
private var args:Array = new Array();
private static var ELEMENT:String;
private var point:Object = new Object();
//constructor:
public function ActionInterface(menu:String, mc:MovieClip, args:Array) {
if (ELEMENT == undefined) {
trace("ERROR: element is undefined!");
break;
}
this.menu = menu;
this.args = args;
this.container = _root.createEmptyMovieClip("container" + this.menu, _root.getNextHighestDepth());
this.point.x = mc._width;
this.point.y = -2 * (mc._height);
mc.localToGlobal(point);
this.container._x = this.point.x;
this.container._y = this.point.y;
var am:ActionManager = ActionManager.getInstance();
var actionsArray:Array = am.getActionMenu(this.menu);
this.loadUI(actionsArray);
}
public static function setElement(element:String):Void {
ELEMENT = element;
}
// methods:
public function loadUI(actionsArray:Array):Void {
var objRef:ActionInterface = this;
for (var i:Number = 0; i < actionsArray.length; i++) {
this.container.element = this.container.attachMovie(ELEMENT, ELEMENT, i);
this.container.element._y = i * this.container.element._height;
this.container.element.action = actionsArray[i];
this.container.element.element_txt.text = actionsArray[i].getDesc();
this.container.element.onPress = function() {
objRef.executeCommand(this.action);
};
}
}
public function unloadUI():Void {
removeMovieClip(this.container);
trace(delete this);
}
public function executeCommand(action:Action):Void {
if (action.getRoot() == "Lopen naar") {
trace(" ");
trace("commencing move...");
trace(" ");
var user:User = User.getInstance();
user.goToRoom(action.getDesc());
}
this.unloadUI();
}
}
Deleting Hierarchy
Heres one for the smart folks...
If I have a movie clip and I put any number of instances inside of it, when I delete that movie clip, do those instances go with it? Or do they still exist somehow?
I'm using a "contentBox" movieclip to as a box to add things to the stage and move them as a unit, which works great. When I delete it, they go too, but I want to be sure that theyre REALLY gone. Is that so?
e.g.:
(and this is made up, it's not my actual code):
Code:
var contentBox:MovieClip = new MovieClip();
addChild (contentBox);
contentBox.addChild(object1);
contentBox.addCHild(object 2);
//etc etc etc
//and then:
removeChild(contentBox);
Is that gonna kill object1 and object 2?
God I hope so...
Deleting SharedObject
Is it possible to delete a SharedObject when the browser window is closed?
I have a banner that appears on every page with a background sound, with a sound off button. I am using a SharedObject so the sound does not replay every time a new page loads. I would however, like the sound to play by default when a user first arrives at the site - even if they visited it on a previous day and switched it off. Is it possible to remove this SharedObject after the site has been left or the browser window is closed?
Here is the code I am using (adapted from an Ultrashock posting, but I can't get a reply over there...)
stream = new Sound();
//uncomment on the next 2 lines so this can be used for testing
//delete cookie_so.data.soundIsOff;
//cookie_so.flush();
var cookie_so = sharedObject.getLocal("myFlashCookie");
// CHECK FOR EXISTING DATA
if (cookie_so.data.soundIsOff == undefined || !cookie_so.data.soundIsOff) {
var turnTheSoundOn = true;
} else {
var turnTheSoundOn = false;
}
if (turnTheSoundOn) {
turnSoundOn();
} else {
turnSoundOff();
}
function turnSoundOn() {
//SOUND-ON CODE HERE
stream.setVolume(25);
_root.frame = sound;
cookie_so.data.soundIsOff = false;
cookie_so.flush();
}
function turnSoundOff() {
//SOUND-OFF CODE HERE
stream.setVolume(0);
_root.frame = nosound;
gotoAndStop("nosound");
cookie_so.data.soundIsOff = true;
cookie_so.flush();
}
sound_bt.onRelease = function() {
gotoAndStop("nosound");
if (_root.frame == nosound) {
turnSoundOn();
} else {
turnSoundOff();
}
};
//save frame number into a SharedObject
_root.frame_so.data.frameNumber = _root._currentframe;
_root.frame_so.flush(); //saves the cookie
stop();
Thanks
Deleting A Button
Hi there,
A quick beginner question -
I want to delete a button (button 2) when another button (button 1) is pressed.
What is the actionscript to delete an object?
I'm guessing it's something like
on(press){
???????????
}
cheers
Deleting An Instance
is there a way to delete or remove an instance (created from a class) or a variable from memory comletely in AS2?
TIA
|