All pastes #979687 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-10 15:09 UTC
rendered paste body

goSection("bedroom", "HOUSE"); .. we want to swap to the HOUSE area and load in the bedroom movie

// -------
// $eq=EventQueue.initialize()

public function goSection(newSection, newLoc) {	

	_nextLoc=newLoc; // main container (eg HOUSE_mc, GARDEN_mc)
	_next=newSection; // name of subsection to load (ie section + ".swf")
	
	$eq.prepare(); // clears all items after currently active item
	$eq.addEvent({fn:Delegate.create(this,fadeOffSubsection), args:[_current,_loc]});
	$eq.addEvent({fn:Delegate.create(this,unloadSubsection), args:[_current,_loc]});
	$eq.addEvent({fn:Delegate.create(this,fadeOffArea), args:[_loc]})
	$eq.addEvent({fn:Delegate.create(this,fadeOnArea), args:[newLoc]});
	$eq.addEvent({fn:Delegate.create(this,loadSubsection), args:[newSection,newLoc]});
	$eq.addEvent({fn:Delegate.create(this,fadeOnSubsection), args:[newSection,newLoc]});
	$eq.start();
		
}

	
private function fadeOffSubsection(section,area)
{
		
   if(section && (section == _current)) // only fade off if they've asked to fade off the current section
   {
	_isFading=true;
	_root.temp.tween("_alpha",0,1,"linear",0,Delegate.create(this,fadeOffSubsection_CallBack));
   }
   else
   {
       $eq.nextEvent(); // get next event in queue
   }
}

private function fadeOffSubsection_CallBack()
{
   _isFading=false;
   _current="";
   $eq.nextEvent(); // get next event in queue
}