List Info

Thread: interval scope




interval scope
country flaguser name
United States
2007-09-03 17:19:19
Hello Everyone,

Once again I am struggling with finding the right scope for
my  
Interval. Please follow if you have the patience. What
happens is, I  
am trying to call a function from my setInterval but this
function  
doesn't seem to be in the scope of the class for some weird
reason.  
Am I missing something here?

best,
ilteris


class EquipmentManager {
	
	
	private var xml:XmlLoader;
		
	private var equipArr:Array;
	public var xmlInterval;
	public function EquipmentManager(container_:MovieClip) {
		xml = new XmlLoader("studio.xml");
		
		equipArr = new Array();
		
		buildTimer(container_);
		
	}
	
	
	
	private function buildTimer(container_:MovieClip) {
		xmlInterval = setInterval(this, "isLoaded",100,
container_); //  
this function never gets called!
		trace(this.isLoaded()); // when I try to trace the method
it gives  
me undefined.

	}
	
	
	public function isLoaded(container_:MovieClip):Void {
		
		if(xml.isDone()) {
			for(var i:Number = 0; i <
xml.getTotalNumOfEquipment(); i++) {
				var equip = new Equipment(container_);
				equipArr.push(equip);
				//trace(equipArr[i]);
			}
			clearInterval(xmlInterval);
		}
		
	}
	
	

}





_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

RE: interval scope
country flaguser name
United States
2007-09-05 10:58:20
> trace(this.isLoaded()); // when I try to trace the
method it
> gives
> me undefined. 

Drop the parens:
trace(this.isLoaded);// [type Function] 

I had to comment out the code relating to XMLLoader (since I
don't have it)
in order to eliminate compile errors. Otherwise I am not
seeing any problem
with the interval scope. 

Regards, 

-Keith 
http://keithrei
nfeld.home.comcast.net
 


> -----Original Message-----
> From: flashnewbie-bounceschattyfig.figleaf.com
[mailto:flashnewbie-
> bounceschattyfig.figleaf.com] On Behalf Of ilteris kaplan
> Sent: Monday, September 03, 2007 5:19 PM
> To: Flashnewbie Mailing List
> Subject: [Flashnewbie] interval scope
> 
> Hello Everyone,
> 
> Once again I am struggling with finding the right scope
for my
> Interval. Please follow if you have the patience. What
happens is, I
> am trying to call a function from my setInterval but
this function
> doesn't seem to be in the scope of the class for some
weird reason.
> Am I missing something here?
> 
> best,
> ilteris
> 
> 
> class EquipmentManager {
> 
> 
> 	private var xml:XmlLoader;
> 
> 	private var equipArr:Array;
> 	public var xmlInterval;
> 	public function EquipmentManager(container_:MovieClip)
{
> 		xml = new XmlLoader("studio.xml");
> 
> 		equipArr = new Array();
> 
> 		buildTimer(container_);
> 
> 	}
> 
> 
> 
> 	private function buildTimer(container_:MovieClip) {
> 		xmlInterval = setInterval(this,
"isLoaded",100, container_);
> //
> this function never gets called!
> 		trace(this.isLoaded()); // when I try to trace the
method it
> gives
> me undefined.
> 
> 	}
> 
> 
> 	public function isLoaded(container_:MovieClip):Void {
> 
> 		if(xml.isDone()) {
> 			for(var i:Number = 0; i <
xml.getTotalNumOfEquipment();
> i++) {
> 				var equip = new Equipment(container_);
> 				equipArr.push(equip);
> 				//trace(equipArr[i]);
> 			}
> 			clearInterval(xmlInterval);
> 		}
> 
> 	}
> 
> 
> 
> }
> 
> 
> 
> 
> 
> _______________________________________________
> Flashnewbiechattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.c
om

_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )