Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 11-14-2003, 12:08 AM
View Complete Forum Thread with Replies
Sponsored Links:
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
View Replies !
View Related
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
View Replies !
View Related
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
View Replies !
View Related
Clear Interval?
Hey,
Sorry for the questions, but I'm working on some new stuff
I'm calling a function called newMap by using setInterval using the folowing code:
code: setInterval(newMap, 540);
Now in the function, I want the setInterval to be removed. I've tried to add this code, but it doesn't work:
code: function newMap(){
clearInterval(this);
}
View Replies !
View Related
[CS3] I Can't Clear An Interval
I'm working in AS2, trying to convert a flash file that was interactive using AS3 to play by itself using a timer. I've tried several ways to clear the interval, but nothing seems to work. This is what I have right now:
trace(_currentframe);
var myInterval:Number = setInterval(thisTimer, 500);
function thisTimer():Void {
gotoAndPlay(_currentframe++);
if (_currentframe>=_totalframes) {
clearInterval(myInterval);
trace("total frames = "+_totalframes);
}
}
There are 4 frames and it all traces, including the "total frames" in the if statement. I've tried putting the clearInterval on the last frame and that didn't work either. (does the clearInterval have to be in the same place as the setInterval?) The only way it works is if it's not in the "if" statement on the first frame with the setInterval, and then of course it doesn't advance to the next frame.
I'm sure this is something simple, but I'm stumped. Thanks!
View Replies !
View Related
Clear Interval
I can't seem to get this code to work. The interval "poll" will not clear after the mp3 loads when placed in the function loadSpeaker.
Code:
this.createTextField("status_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
//
var songTrack:Sound = new Sound();
//
function checkProgress(soundObj:Object):Void {
var numBytesLoaded:Number = soundObj.getBytesLoaded();
var numBytesTotal:Number = soundObj.getBytesTotal();
var numPercentLoaded:Number = Math.floor(numBytesLoaded/numBytesTotal*100);
if (!isNaN(numPercentLoaded)) {
trace(numPercentLoaded+"% loaded.");
status_txt.text = numPercentLoaded+"% loaded.";
}
}
//
songTrack.onLoad = function():Void {
trace("load complete");
status_txt.text = " ";
clearInterval(poll); //<---------------------Doesnt clear the interval when poll is within the function loadSpeaker
songTrack.start();
};
//
function loadSpeaker(speech) {
songTrack.loadSound(speech, false);
var poll:Number = setInterval(checkProgress, 100, songTrack);
}
//
loadSpeaker("anysound.mp3");
View Replies !
View Related
Clear Interval Help
I got this code somewhere on a frame in my movie
Code:
function delay() {
var si = setInterval(function() {
loadMovie("mymovie.swf", 3);
unloadMovie(2);
}, t);
}
delay(8000, 'second');
which creates a delayed loop for my movie now when I click a button I'd like to remove this interval so I placed this on my button
Code:
this.movie1_btn.onRelease = function(){
movie1_btn._visible = false;
clearInterval(delay);
}
Somehow it doesn't seem to work any idea on things I'm missing out on?
View Replies !
View Related
Set And Clear Interval
having problems clearing the following interval
Code:
this.onEnterFrame = function() {
//
};
bttn01.onRollOver = function() {
//clear any interval to hide
//clearInterval(myTimer);
//set text and reset timeout for field to disappear
dog.gotoAndStop("populate");
dog.field.text = "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt";
};
bttn01.onRollOut = function() {
//set timeout going
var myTimer=new setInterval(timeoutHide,1500);
};
/*bttn01.onReleaseOutside = function() {
//set timeout going
myTimer=new setInterval(timeoutHide,1500);
};*/
bttn02.onRollOver = function() {
//set text and reset timeout for field to disappear
dog.gotoAndStop("populate");
dog.field.text = "tttttttttttttttttttttttttttttt";
};
function timeoutHide(){
trace("doing the timeout");
dog.gotoAndStop(1);
clearInterval(myTimer);
}
scope i know, is this the one where i need delegate.create ?
View Replies !
View Related
Interval Won't Clear
Whenever I call the fade_in function that contains an Interval it won't clear. I think it may have something with the fact that I'm calling the fade_in function from a for() command. Please HELP!
Here's my code below:
ActionScript Code:
fade_in = function (mc_name, fade_speed, i):Void {
mc_name._alpha = 0;
mc_name._visible = true;
fading = function () {
mc_name._alpha += fade_speed;
if (mc_name._alpha>=99) {
trace("b");
clearInterval(this["fade_in_int"+i]);
}
trace(mc_name+" = "+stop_num);
};
this["fade_in_int"+i] = setInterval(fading, 30);
};
details = function () {
_root.scroll_func(this.scroll_bar, this.tb);
stat = 0;
pcount = 0;
pp_int = setInterval(function () {
if (stat == 0) {
img = _root.createEmptyMovieClip("sub_photos", 100001);
img_mask = _root.sub_photos.createEmptyMovieClip("masks", 100002);
//thumb._alpha = 1
img.setMask(img_mask);
// _root.sub_photos._visible= false
for (i=1; i<=7; i++) {
img = _root.sub_photos.createEmptyMovieClip("photo_"+i, i);
img._visible = false;
i_mask = _root.sub_photos.masks.attachMovie("data_bkgd", "mask"+i, 300000+i);
i_mask._width = 50;
i_mask._height = 50;
i_mask._x = 325+25+75*(i-1);
i_mask._y = 335;
_root.load_func("photos/"+i+".jpg", img, bbb, "sub_progress"+i, i, 325+25+75*(i-1), 385, 50);
if (i == 7) {
stat = 1;
}
}
}
for (i=1; i<=7; i++) {
img = _root.sub_photos["photo_"+i];
if (img._height>0) {
if (_root["thumbs_ready"+i]<>1) {
pcount++;
trace(img);
i_mask = _root.sub_photos.masks["mask"+i];
i_mask.onRollOver = function() {
};
scale_factor = 50/img._height;
img._width *= scale_factor;
img._height *= scale_factor;
img._x = 375+75*(i-1)-img._width/2;
img._y = 335;
//img._visible = true;
_root["thumbs_ready"+i] = 1;
trace("fade = "+i);
fade_in(img, 11, i);
}
if (pcount>=7) {
trace("pcount:"+pcount);
clearInterval(pp_int);
pcount = 0;
}
}
}
trace("go");
}, 30);
};
View Replies !
View Related
Clear Interval :(
Im using a function found in this forum to simulate a timer
PHP Code:
var numTimeLimit = 60000;
var bolFirstTime = true;
function countDownF() {
if (bolFirstTime) {
numTimeStart = getTimer();
bolFirstTime = false;
}
numTimePassed = getTimer()-numTimeStart;
if (numTimePassed>numTimeLimit) {
trace("done");
clearInterval(countDownI);
}
}
I just can't find a way to pause that timer... Also if i move to frame 2 (this is frame 1) and move back to frame one, it doesn't seem to stop..
can someone help me out please??
View Replies !
View Related
Clear Interval
helo,
I just need to stop interval in this example more afficiently...(if you click scrollbar two times quickly while draging interval doesn't stop)
Can someone please take a look...
thank you
www.galahala.com/easing_slider.zip
View Replies !
View Related
Can't Clear Interval @#$^#$
for some reason i can't clear this interval with the 'killTimer' function. It works fine in the 'switchTimer' function...
any ideas?
code:
Code:
startTimer=function(){
clearInterval(mySI);
mySI=setInterval(switchTimer, 1000);
};
killTimer=function(){
trace("kill timer");
clearInterval(mySI);
}
counter=0;
switchTimer=function(){
trace("counter: "+counter);
if (counter == switchTime){
clearInterval(mySI);
switchIt();
counter=0;
}else{
counter++;
}
}
View Replies !
View Related
Clear Interval :(
Im using a function found in this forum to simulate a timer
PHP Code:
var numTimeLimit = 60000;
var bolFirstTime = true;
function countDownF() {
if (bolFirstTime) {
numTimeStart = getTimer();
bolFirstTime = false;
}
numTimePassed = getTimer()-numTimeStart;
if (numTimePassed>numTimeLimit) {
trace("done");
clearInterval(countDownI);
}
}
I just can't find a way to pause that timer... Also if i move to frame 2 (this is frame 1) and move back to frame one, it doesn't seem to stop..
can someone help me out please??
View Replies !
View Related
Could Not Clear Interval Id?
Hi,
Please help me with clearing the interval id.I have a class like the following.
Code:
class com.saumya.Shell extends MovieClip {
//............Properties.........
private var sName:String = "this is a test";
private var bLoaded:Boolean = false;
private var nId:Number;
//ENd..Properties................
//........making the navigation load............
public function loadInterFace():Void {
this.nId = setInterval(this,"test", 100);
}
//ENd.....making the navigation load............
public function test():Void {
trace(this.nId+"........................");
clearInterval(nId);
}
//ENd.........Methods.......................................
}
everything is fine.But my interval id is not getting cleared.Why?How can i fix that?
View Replies !
View Related
Clear Interval Problem
I was having problem with hit detection in a game because I was using onEnterFrame and hit test so lasers could jump over its target and never hit it. So instead of attempting to do some crazy math to figure out hits, i decided to use setInterval to increase the number of times taht the laser is rendered. This is working great, but I can't seem to get the intervals to clear? I included all relevant code below. Seems to me like it should work?
Thanks for any help
var las = this.createEmptyMovieClip("las" + laserCount, laserLevel);
las.interval = setInterval(moveLaser,20,las,laserCount);
function moveLaser(targ,num) {
targ.lifeSpan++;
if (targ.lifeSpan > 16) {
clearInterval(targ.interval);
targ.removeMovieClip();
}
}
View Replies !
View Related
Clear Interval Within Function
Hello,
I'm working in Flash V8.
I want to clear an Interval within a function but I'm not sure how. setInterval is cleared fine when not within the function, but I want to call it from a MCbutton. Could someone please show me how to do such a thing. Thank You, Jacob
//For Loop to Animate Text
function setAnimate():Void {
//Animated Property Changes
containerMC1._alpha = nChange++
containerMC1._xscale = nChange++
containerMC1._yscale = nChange++
//Counter
nTimes++
//Clears Interval
if(nTimes >= 35) {
clearInterval(nInterval);
}
}
var nChange:Number = 0;
var nTimes:Number = 0;
//Problem Area....!!!
//Start Interval Function
function startInterval():Void {
var nInterval:Number = setInterval(setAnimate, 8);
}
View Replies !
View Related
Clear Interval Haywire
Hello,
I'm working in Flash 8.
My setInterval and clearInterval is working fine when I make a single click. When I push the call button mutiple times, the setInterval just repeats over and over. Is there something I do about this.. Thank You, Jacob
//-------------------------<Text Animation>---------------------------\
var nChange:Number = 0;
var nTimes:Number = 0;
//to be defined later by the call function
var nInterval:Number = undefined;
//For Loop to Animate Text
//50 nTimes Loops * + 2 nChange = 100 _alpha
function setAnimate():Void {
//Animated Property Changes
containerMC1._alpha = nChange += 2
//Counter
nTimes++
//Clears Interval
trace(nTimes);
if(nTimes >= 50) {
clearInterval(nInterval);
//Sets Loop Back...
nChange = 0;
nTimes = 0;
}
}
//Start Interval Function
function startInterval():Void {
//sets TextBox Containter to alpha 0 so text change isn't visible
containerMC1._alpha = 0;
//No strict var so varible is global
nInterval = setInterval(setAnimate, 10);
}
//-------------------------<Text Animation/>---------------------------\
View Replies !
View Related
Why Won't My Clear Interval Work?
smoke_int = setInterval(createSmoke, 1000);
function createSmoke() {
attachMovie("smoke", "smoke_mc", 100, {_x:400, _y:400});
new Tween(_root.smoke_mc, "_y", Regular.easeInOut, _root.smoke_mc._y, 100, 2, true);
}
_root.entire.bull.onPress = function() {
clearInterval(smoke_int);
};
just getting to understand setInterval and clearInterval.
View Replies !
View Related
Trying To Clear/stop An Interval
I've got an automated slide show where the only button is a pause control to stop the movie clips from playing. I've got a couple of setInterval functions that change the slide and start a mask transition effect every 6 seconds. When I click on the Pause button, it does pause the movie but after 6 seconds the slide show starts again. I'm trying to use clearInterval in my button action, but it's not working. Where'd I screw up?
stop();
function undisplay() {
slide_mc._visible = false;
}
unInterval = setInterval(undisplay, 6000);
function displayPhoto() {
pages.nextFrame();
mask.gotoAndPlay(1);
page.nextFrame();
}
photoInterval = setInterval(displayPhoto, 6000);
pause_btn.onRelease = function() {
pages.stop();
mask.stop();
page.stop();
clearInterval(displayPhoto);
clearInterval(undisplay);
}
View Replies !
View Related
Clear Interval Problem
Hello there folks, I have a prob when clearing an interval after calling it over a variable.
I ve created a method to increase the scale of a movie clip. the method is saved to a .as file and goes like this :
Quote:
function addScale(clip1:MovieClip, intsc:Number, scaleNum:Number){
clip1._xscale += scaleNum;
clip1._yscale += scaleNum;
if(clip1._xscale > 100){
clearInterval(intsc);
}
updateAfterEvent();
}
and the call (in the 1st frame of the timeline) goes like this :
Quote:
var intScale = setInterval(addScale, 30, chooseText, intScale, 1.6);
the problem is that my interval is not cleared in my method! dont know why. the movie clips keeps growing and growing...
The function is working (the animation is performed - but as I said doesn't stops), if I put a trace in the if statement, I get the result (the if statement is accessed in other words)....
I dont underestand though why the intScale value is not passed in my function to the intsc parameter , so I can clear this interval...
when I write the function without parametres (thus focused to animate a specific movie clip) the clearInterval works fine ....
but I want it like this, so I can call it 5 times to animate 5 diff movie clips!
View Replies !
View Related
Clear Interval Problem
I can't seem to get this interval to clear, even if i put an onPress in the second function to just clear the interval it still won't clear. I just need this interval to clear when the conditions in the IF statement are met. their must be something simple that i am just missing, any ideas?
private function playInt(but,board) {
if(but._y<(board._height/5)) {
but._x=but._x-10;
}
else {
but._y=but._y-10;
}
if(but._x<100) {
clearInterval(interval);
//trace("hi");
}
}
private function enterTop(b,board,position) {
b._x=board._x+(board._width/1.5);
b._y=board._y+(board._height/3)+((board._height/6)*position);
b.gotoAndStop(18);
interval=setInterval(playInt,10,b,board);
}
View Replies !
View Related
Clear Interval Not Working
I am trying to use set interval to have a 3 sec delay between functions. The 3 seconds is working fine but the clear interval doesn't seam to be working as it keeps looping. I want to set the interval in reorder() and clear it in showText();
Any help appreciated
function reorder(num) {
var showInfoInterval:Number;
var duration:Number = 3000;
showInfoInterval = setInterval( this, "showText", duration, num);
}
function showText(num) {
trace("num " + num);
clearInterval(showInfoInterval);
textY = -120 +(proItemheight * num);
_root.projectInfoArea.projInfoScroll.tween("_alpha ", 100, easingduration, easingstyle);
}
View Replies !
View Related
Clear Interval Problem
okay im not sure how to clear this interval.
PHP Code:
on (rollOut) {
setInterval( function(){ awin.alphaTo("0",1);}, 500 );
}
I want to clear this interval on mouseover of another button.
clearInterval();
View Replies !
View Related
AttachMovie And Clear Interval
Hi everyone,
Im using attachMovie to load movieclips dynamically on the stage.
this works fine except that there is always an extra movieClip on the top, left corner of the stage.
I am using a set interval to place the mc's on stage at regular intervals.
I also have a clearInterval that is not getting triggered. I got the code for this from the flash help files.
my code for attachMovie is as follows:
Code:
var intervalId:Number;
function placeFrogs():Void {
this.attachMovie("frog_id", "frog_mc", this.getNextHighestDepth());
this.frog_mc._x = random (500)+ 10;
this.frog_mc._y = random (450)+ 10;
}
//put the placefrogs function inside another function which will be triggered
//by the setInterval
function timerPlaceFrogs():Void{
placeFrogs();
}
//this loads the frog_mc on the stage after approx 2 secs
function beginInterval():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(timerPlaceFrogs, 1800);
}
beginInterval();
any pointers on where I am going wrong?
Thank you .
View Replies !
View Related
Clear Interval In External Swf
Hi
I have >>this "QUOTER" swf<< which is loaded in main-swf.
"QUOTER"
PHP Code:
this._lockroot = true;#include "mc_tween2.as"stop();var tl = _root;var i = 0;var anz = 8;// Number of MCs var MCpauses = new Array(6, 4, 7, 7, 9, 12, 12, 4);//Pauses - indidual for every MCtl.createEmptyMovieClip("loader", 1);tl.loader._x = 360;tl.loader._y = 200;nextPic();function nextPic() { i = i<anz ? ++i : 1; var mc = tl.loader; mc._alpha = mc._xscale=mc._yscale=mc.phase=0; mc.attachMovie("MC"+i, "MC"+i, 1); mc.id = i; mc.onEnterFrame = function() { if ((this.phase += 3)>100) { this.phase = 100; } this._alpha = this._xscale=this._yscale=this.phase; if (this.phase == 100) { tl.iv = setInterval(fadeout, MCpauses[(this.id)-1]*1000); delete this.onEnterFrame; } };}function fadeout() { clearInterval(tl.iv); tl.loader.onEnterFrame = function() { if ((this.phase -= 5)<0) { this.phase = 0; } this._alpha = this._xscale=this._yscale=this.phase; if (this.phase == 0) { nextPic(); } };}//Buttons Play-Stop play_btn._visible = false;pause_btn._visible = true;pause_btn.onRollOver = function() { attachMovie("TOOLTIP_S", "TOOLTIP_S", 10); TOOLTIP_S._x = _xmouse; TOOLTIP_S._y = _ymouse; TOOLTIP_S.startDrag(true); TOOLTIP_S.alphaTo(0, 6, "linear");};pause_btn.onRollOut = function() { TOOLTIP_S.removeMovieClip();};pause_btn.onRelease = function() { play_btn._visible = true; pause_btn._visible = false; clearInterval(tl.iv);};play_btn.onRollOver = function() { attachMovie("TOOLTIP_P", "TOOLTIP_P", 10); TOOLTIP_P._x = _xmouse; TOOLTIP_P._y = _ymouse; TOOLTIP_P.startDrag(true); TOOLTIP_P.alphaTo(0, 6, "linear");};play_btn.onRollOut = function() { TOOLTIP_P.removeMovieClip();};play_btn.onRelease = function() { stop(); play_btn._visible = false; pause_btn._visible = true; nextPic();};
Now I have to clear the interval of QUOTER before loading another swf in the main.
The most logical thing to me , was to do it like this
PHP Code:
this["btn"+i].onRelease = function() { //trace(this); n = this.ID; for (j=1; j<=8; j++) { this._parent["btn"+j].enabled = false; this._parent["btn"+j].gotoAndStop("up"); } //disable buttons var con:MovieClip = this._parent.createEmptyMovieClip("con"+this.ID, this._parent.getNextHighestDepth()); con._x = 0; con._y = 0; con._alpha = 0; con.clearInterval(tl.iv);//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< con.loadMovie(swfArray[this.ID-1]); this.onEnterFrame = function() { this._parent.loadbar._visible = true; var percent:Number = int(Math.round(con.getBytesLoaded()/con.getBytesTotal()*100)); this._parent.loadbar._xscale = percent; if (percent>=100) { //after swf is loaded, do the Tween delete this.onEnterFrame; loadbar._visible = false; trace("prev= "+prevCon); trace("con= "+con); this.gotoAndStop("press"); fadeTrans(prevCon, con); prevCon = con;.................................
Infortunately, this does not work.
Can somebody tell me why and help find a solution?
Would be nice.
Thanks a lot.
View Replies !
View Related
Clear Interval Problem
okay im not sure how to clear this interval.
PHP Code:
on (rollOut) {
setInterval( function(){ awin.alphaTo("0",1);}, 500 );
}
I want to clear this interval on mouseover of another button.
clearInterval();
View Replies !
View Related
Clear Interval Problem
I was having problem with hit detection in a game because I was using onEnterFrame and hit test so lasers could jump over its target and never hit it. So instead of attempting to do some crazy math to figure out hits, i decided to use setInterval to increase the number of times taht the laser is rendered. This is working great, but I can't seem to get the intervals to clear? I included all relevant code below. Seems to me like it should work?
Thanks for any help
var las = this.createEmptyMovieClip("las" + laserCount, laserLevel);
las.interval = setInterval(moveLaser,20,las,laserCount);
function moveLaser(targ,num) {
targ.lifeSpan++;
if (targ.lifeSpan > 16) {
clearInterval(targ.interval);
targ.removeMovieClip();
}
}
View Replies !
View Related
AttachMovie And Clear Interval
Last edited by force10x : 2007-05-30 at 05:44.
Hi,
Im using attachMovie to load movieclips dynamically on the stage.
this works fine except that there is always an extra movieClip on the top, left corner of the stage.
I am using a set interval to place the mcs on stage at regular intervals.
I also have a clearInterval that is not getting triggered. I got the code for this from the flash help files.
my code for attachMovie is as follows:
Code:
var intervalId:Number;
function placeFrogs():Void {
this.attachMovie("frog_id", "frog_mc", this.getNextHighestDepth());
this.frog_mc._x = random (500)+ 10;
this.frog_mc._y = random (450)+ 10;
}
//put the placefrogs function inside another function which will be
//triggered by the setInterval
function timerPlaceFrogs():Void{
placeFrogs();
}
//this loads the frog_mc on the stage after approx 2 secs
function beginInterval():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(timerPlaceFrogs, 1800);
}
beginInterval();
any pointers on where I am going wrong?
Thank you .
View Replies !
View Related
Can I Use Clear Interval To Speed This Up? (if So Not Sure How To Use Properly)
Hello,
I am using some code that was posted in this thread: http://www.kirupa.com/forum/showthre...ghlight=vanish
(it was created by virusescu)
Anyway, I think I need to use a clear interval in here because it runs great if used once, but if I try to repeat the code at a later time everything runs slow and lags. I am going to try and get by without posting the fla, but I will give a link to the page I am using the swf on and here is the code. Please let me know if I do need to post the fla. (this code is used in frame 30 and then again in frame 200, which is the point where it slows everything down.
for (a = 0; a < 20; a++)
{
for (b = 0; b < 10; b++)
{
_root.attachMovie("dot", "x" + a + "y" + b, z++);
_root["x" + a + "y" + b]._x = 20 * a;
_root["x" + a + "y" + b]._y = 20 * b;
}
}
a =0;
b =0;
function vanish()
{
for (b = 0; b<15;b++ ) {
_root["x" + a + "y" + b].play();
}
a++;
}
this.onEnterFrame = function() {
asd = setInterval(_root.vanish,30);
}
SWF can be viewed here:
http://www.cbservices.org/cbs/test/msi/index-new.html
View Replies !
View Related
Clear Interval Doesn't Work
Using clearInterval (streamingID); and clearInterval (playingID); works fine for me in one place but doesn't work well in another (for playing MP3) yet it doesn't work in another place (for playing FLV).
Both systems are similar in the fuctionality, yet different in the way they achieve it (because treating MP3 and FLV is different with flash).
It's easy to see the interval problem when trying to drag the "scrubber" - it's like struggling with the computer on the scrubber's place on the timeline.
Because I'm aware that information is not enough, I've attached the file and you're welcome to help me. thanks...
- edit -
file deattached
also after another day of trying I found something recalling the interval again... In fact I'm not sure how I fixed it... I was focused on another thing while this problem was fixed... strange world indeed
View Replies !
View Related
Can I Use Clear Interval To Speed This Up? (if So Not Sure How To Use Properly)
Hello,
I am using some code that was posted in this thread: http://www.kirupa.com/forum/showthre...ghlight=vanish
(it was created by virusescu)
Anyway, I think I need to use a clear interval in here because it runs great if used once, but if I try to repeat the code at a later time everything runs slow and lags. I am going to try and get by without posting the fla, but I will give a link to the page I am using the swf on and here is the code. Please let me know if I do need to post the fla. (this code is used in frame 30 and then again in frame 200, which is the point where it slows everything down.
for (a = 0; a < 20; a++)
{
for (b = 0; b < 10; b++)
{
_root.attachMovie("dot", "x" + a + "y" + b, z++);
_root["x" + a + "y" + b]._x = 20 * a;
_root["x" + a + "y" + b]._y = 20 * b;
}
}
a =0;
b =0;
function vanish()
{
for (b = 0; b<15;b++ ) {
_root["x" + a + "y" + b].play();
}
a++;
}
this.onEnterFrame = function() {
asd = setInterval(_root.vanish,30);
}
SWF can be viewed here:
http://www.cbservices.org/cbs/test/msi/index-new.html
View Replies !
View Related
Problem With Countdown Timer, Should I Clear Interval?
Hi,
I have used this code as a count down script for my application, on entering each frame, the countdown function is call, the timer should stop when the count reached 0 OR a button clicked to go to next frame.
If the timer countdown and reached 0, the application is working fine. But if user clicked the button, the timer goes out of expectation. I am suspecting because the timer is still counting when it enters next frame. Is there a way to clear the timer when user click the button and start at a new frame.
Code:
import mx.transitions.Tween;
function counter(theTextField, time, sec, dir) {
var t:Array = time.split(":");
for (i in t) {
t[i] = Number(t[i]);
}
var m:Number = t[1]*60;
var s:Number = t[2];
var total:Number = m+s;
var sec:Number = (!sec || sec == "no") ? total : sec;
var min:Number = total/60;
var obj:Object = {};
obj.rr = 0;
var twn:Tween = (!dir || dir == false) ? new Tween(obj, "rr", None, min, 0, sec, true) : new Tween(obj, "rr", None, 0, min, sec, true);
twn.onMotionChanged = function() {
var _min = ((obj.rr/60-((obj.rr/60)>>0))*60)>>0;
var _sec = ((obj.rr-((obj.rr)>>0))*60)>>0;
if (_sec<10) {
_sec = "0"+_sec;
}
if (_min<10) {
_min = "0"+_min;
}
theTextField.text =_min+":"+_sec;
};
twn.onMotionFinished = function() {
theTextField.onCounterFinished();
};
};
I've used it this way, is there a way to clear or stop the function when it gotoandplay(20)?
Code:
onCounterFinished = function() {
gotoandplay(20);
}
View Replies !
View Related
Change The Interval Of An Interval?
Hey,
I was wondering if there is a way to change the interval of an interval? With this I mean, the amount of MS's it waits before the function is called.
I would also like to know if there is a noticable difference on different computers when using intervals <60?
Thnx,
SaphuA
View Replies !
View Related
Set Interval
Hi I am trying to get a countdown timer to work.
I am using the code below which I got of the sticky set interval at the top of the forum.
My problem.
After the interval the function is called which plays the movie then it starts again. This works OK but the set interval seems to compound every time. With the countdown getting faster and faster the more times it plays.
I want to have the set interval start fresh each time. I am clearing the set interval by clearing it although that seems to be the problem..
Any Ideas?
On first frame...
//
treecountDown = function (message) {
displayTime--;
if (displayTime == 0) {
trace("trees");
clearInterval(this.timer);
gotoAndPlay("next");
}
};
displayTime=10;
this.timer = setInterval(treecountDown, 1000);
stop();
//
View Replies !
View Related
OOP With Interval
hi! i have a strange problem with setInterval and Objects, take a look at this code:
PS! this code is simplyfied for this example
code: _global.loadingO = function(){
this.percentF = function(targetSizeV, currentSizeV){
trace(targetSizeV)
trace(currentSizeV)
trace((100 / targetSizeV) * currentSizeV)
this.percentV = (100 / targetSizeV) * currentSizeV;
trace(this.percentV)// ERROR this variable will not be set when called from an interval
}
this.loadingInt = setInterval(this.percentF, 10, 120, 50);// interval messes up the variable
//this.percentF(120, 50);// this works just fine
}
loadingCake = new loadingO();
when i call the function inside the object with an interval the "this.percentV" variable is not set, but if i call the function normally it all works fine. is there some serious issues to using setInterval in Object or is my code simply wrong.
TOYTOTA
View Replies !
View Related
Interval
aight all! basically i want my movie to start after 6.5 seconds, now i know i can use dis script for a setInterval:
setInterval(myfunction, 6500);
function myfunction()
{
....
but how do i do it so that it waits 6.5 secs, then starts the prog, and leaves it to carryon playin rather than kepp looping, is there another kind of interval way!
Ta
Oh yeah today is the first day of me new life, yo, u get me, i am LEE J SPOONER,
View Replies !
View Related
Set Interval For 1 Second?
I have tried do while loops to take out the whole I part and makeAloop function, But found that I mostly need to use a setInterval to slow down the proccess. What I need is for the interval to be i second or even half a second before the this. FaderOperations function is run again.
here is the code to my class.
class Fader extends MovieClip{
var fade = false;
var i:Number = 0;
var n:Number = 0;
function Fader()
{
this.faderOperations(fade, i, n);
}
function faderOperations(fade, i, n)
{
if (fade == true){
this.nextFrame();
i = i + 1;
makeAloop(fade, i, n);
} else {
this.prevFrame();
i = i + 1;
makeAloop(fade, i, n);
}
//--------Here is the set Interval-------------------------------
setInterval(faderOperations, 10, fade, i, n);
}
function makeAloop(fade, i, n)
{
if (i <= n){
faderOperations(fade, i, n);
}
trace(i);
}
}
Any help would be great.
Thank You
Quince
View Replies !
View Related
Interval After Interval
I have a problem. I need an interval to take a women mc("barn_lady") to walk to one stable pen and that uses a setInterval() function to stop her there. Now, the problem happens when I try putting in another interval to make her walk to another stable pen. The women, will go in between the pens and stop. The solution I am looking for is something that will separate the intervals. Does anyone know how to fix this? If someone does, can you help me? Please?
-Thanks for reading
Cobra
View Replies !
View Related
Interval Help
Ok, hi I'm new here but not new to flash and was wondering if someone could help me?
So I've making this small mini game which you can see here:
http://img40.imageshack.us/my.php?image=fall4ol.swf
(please ignore the cruddy art)
It's working fine acept for 2 things.
Firstly when you run out of lives the duplicated MC's dont leave the screen, is there anyway remove the via action script? I know I could just add a green MC with a higher depth than the duplicated MC's so it you cant seem them, but there must be a better way.
Secondly, and more importantly, when you die and start again instead of the MC's duplicating one every second, 2 appear every second, so I guess the code producing the MC's is running twice, so I also assume on the game over screen I'll need to disable the interval, so how would I do that?
Any help is appreicated and I'm using MX04 and AS2.0
Thanks in advance
Kirk_C
View Replies !
View Related
Set Interval?
Color.prototype.setBrightOffset = function(offset){
var trans = new Object();
trans.rb = trans.gb = trans.bb = offset;
this.setTransform(trans);
};
MovieClip.prototype.setBrightness = function(offset){
var c = new Color(this);
c.setBrightOffset(offset);
};
r1_lmc.onRollOut = function(){this.setBrightness(0);};
r1_lmc.onRollOver = function(){this.setBrightness(100);};
this works good but would someone be able to help me with a set inverval function to help ease the brightness transition out?
View Replies !
View Related
How To Set Interval
Hi guys,
I'm making a poker game right now.
Is there anybody who could help me set an interval between each card that been drawed. I really appreciate anybody who could help me.
this is the card drawing code.
picked = new Array();
for(i=0 ; i<52 ; i++) {
picked[i] = 0;
}
pos_x = 92;
for(x=0 ; x<5 ; x++) {
card = new Array();
card[x] = "";
do {
n = (Math.round(Math.random()* 51)) + 1;
} while(picked[n]==1)
picked[n] = 1;
card[x] = n;
c = _root.attachMovie(card[x],"card"+x,x);
c._x = pos_x;
pos_x += 100;
if(x%2) { c._y = 450; }
else { c._y = 420; }
}
View Replies !
View Related
Interval S
i making a game in which ,when a zombie touches the player the player loses health. however, i want it to wait 3 seconds before the zombie can actually cause harm again. the frame rate is set to 40. and i no i can use set interval but none of theways iive tried worked. here is the code that handles the hittest. its within an onClipEvent(enterFrame) inside of the zombies MC
Code:
if (this.touchx.hitTest(_root.alex)) {
if (_root.alex.zombiecanbite == 1) {
_root.alex.HP -= 10;
_root.alex.Inf += 5;
_root.alex.zombiecanbite = 0;
} else {
_root.alex.zombiecanbite = 2;
//This is where i need the code to wait 3 seconds and then set the zombiecanbite to 1 again.
}
}
sorry if its hard to understand. if you have any advice please write it out in complete code form.
View Replies !
View Related
Getting Value Of Interval
I've set an interval to show an image for 5 seconds, then go to a fade-out script on another frame. I wish to enable a "pause/play" feature on so I can pause the "imageTime" interval below. I know I can do this by clearing and setting the interval, but I'm curious to know if I can calculate the time remaining in the interval and resume when I click play. For instance, if my image is being displayed, then somewhere around 4 seconds I click pause, can I find that remaining 1 second value and reset the interval to play only the remaining time?
Code:
function showImage() {
clearInterval(imageTime);
gotoAndPlay("fadeOut");
}
imageTime = setInterval(showImage, 5000);
View Replies !
View Related
Set Interval
Hello...
I have written a small function that simply moves an object to a new position on stage depending on a variable passed to the function. It works just fine, but instantly rather than in intervals -- mimicking a tween. I was wondering how I would integrate a delay into this function to allow it to work in increments.
The function is as follows:
function moveIt(thePosition) {
while (theName._x != thePosition) {
if (theName._x<thePosition) {
theName._x += 5;
} else if (theName._x>thePosition) {
theName._x -= 5;
}
}
}
Can I use set Interval? If so, how? Would I strip out the while loop to do so?
Help would be greatly appreciated.
Thanks
View Replies !
View Related
|