Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » adding time-out to this


adding time-out to this

Reply
  #1 (permalink)  
Old 07-21-09, 08:43 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
adding time-out to this

Hi there...


I got a piece of actioncode to scale an image (big to small --> small to big) in a loop.
This is the "turning point" for the loop:
Code:
scaleX.onMotionFinished = function() {
      this.yoyo();	
};
Now I want to make a delay to this..

Code:
scaleX.onMotionFinished = function() {
       setInterval(this.yoyo(), 2000);
};
But this isn't working. where did I go wrong?..

_j
Reply With Quote
  #2 (permalink)  
Old 07-21-09, 09:25 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Try this:
Code:
setInterval(this, 'yoyo', 2000);
Reply With Quote
  #3 (permalink)  
Old 07-21-09, 09:39 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
unfortunately not the wanted result..

it restarts after 2seconds.. that;s correct. but the zoom-back is not completed.
So I thought I need to add clearinterval.. I made it like this:
Code:
var myInterval = setInterval(this, 'yoyo', 2000);
		clearInterval(myInterval);
but now the zoom-back doesn't even start.. :s

_j
Reply With Quote
  #4 (permalink)  
Old 07-31-09, 05:34 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
Hi..

still an issue I can't solve..
in this piece of AS I want to delay the "mclListener.onLoadInit" function and
tried to achieved this by the function delayFrames. But it's not working the
right way.. I'm trying for several days now.. can someone help me out here?

Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var speed:Number = 20;
var tel:Number = 0;

this.createEmptyMovieClip("tester_mc", 1);
var mclListener:Object = new Object();

var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip(_root.foto, tester_mc);

//delayFrames = function(){
	mclListener.onLoadInit = function(target_mc:MovieClip) {		

		target_mc.setMask(mask_mc);
		target_mc.forceSmoothing = true;
	
		var scaleX:Tween = new Tween(target_mc, "_xscale", None.easeNone, 80, 100, 10, true);
		var scaleY:Tween = new Tween(target_mc, "_yscale", None.easeNone, 80, 100, 10, true);	
	
		scaleX.onMotionFinished = function() {
			this.yoyo();	        
	    };			
	};
//};
//delaySet = setInterval(delayFrames, 6000);

tandwielen.swapDepths(this.getNextHighestDepth());
Reply With Quote
  #5 (permalink)  
Old 07-31-09, 10:23 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I don't know AS at all, but in JavaScript, the following would not work:
Code:
scaleX.onMotionFinished = function() {
    this.yoyo();
}
this would not make reference to the actual class you're trying to call. Try it this way:
Code:
var self = this;

scaleX.onMotionFinished = function() {
    self.yoyo();
}
This is probably pseudocode, but it might give you a hint.
Reply With Quote
  #6 (permalink)  
Old 08-03-09, 01:50 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
in my AS the code I provide the part you talk about above is working correct.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert to time from a string Godwin PHP 2 09-26-06 12:25 AM
having Loop issues, help... Advanced todayscoffee PHP 2 02-27-06 12:36 AM
Super class seo services extreme90 General Advertisements 0 12-28-05 12:45 PM
adding date and time in mysql darkcarnival PHP 5 11-27-04 12:41 PM


All times are GMT -5. The time now is 06:43 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.