Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loaded movieclip AS...works one way but not another

Status
Not open for further replies.

fedtrain

Instructor
Jun 23, 2004
142
US
Ok
I have a container movieclip that is my stage. I have multiple secondary clips that are loaded to the stage in two ways.

-- Click button
-- Passed variables from web page

If the secondary clip is loaded from button click within the stage movieclip the AS in that secondary clip runs fine. (Hovers, textboxes, etc.)

If the secondary clip is loaded because of the variable passed from the webpage (it is loaded) then none of the AS works.

Following that second scenario...if the button for that clip is clicked on then all the script works.

Both the variable and the button use THE EXACT SAME FUNCTION!!! GAH!

Please tell me what is going on here. I seem to be searching the web incorrectly so far...

Stage -
Code:
//===Variables for the container movie
var desk:MovieClip
	desk.buttonMode = true;
	desk.addEventListener (MouseEvent.MOUSE_UP, collectChoice)
var elev:MovieClip
	elev.buttonMode = true;
	elev.addEventListener (MouseEvent.MOUSE_UP, collectChoice)
var paramPassed = root.loaderInfo.parameters.htmlvar

//===Variables for the lobby scene located in lobby movieclip

//===Functions for the Container movie
var theMovie
function collectChoice(event:MouseEvent):void {
	 theMovie = event.target.name
	 loadClip(theMovie)
}
var movieRecall
var thisClip:MovieClip	
function loadClip (whichone){
	var whatMovie = whichone
		if (movieRecall != undefined){ //Test to see if a module is loaded, and then remove
			movieStage.removeChild (thisClip)
		}
		if (whatMovie == "desk"){
			thisClip = new lobby()
			movieStage.addChild (thisClip)
		}
		if (whatMovie == "elev"){
			thisClip = new elevator()
			movieStage.addChild (thisClip)
		}
	movieRecall = whatMovie //Sets up the variable to track if a module already loaded
	module_name.text = whatMovie
}
if (paramPassed != undefined) {
		paramsField.text = paramPassed
		loadClip (paramPassed)
}

Secondary clip -
Code:
var frs_groups:MovieClip;
	frs_groups.buttonMode = true;
	frs_groups.addEventListener (MouseEvent.MOUSE_OVER, showThought);
	
//===Functions for the Lobby Scene!!
var thoughtMovie:MovieClip;
function showThought (event:MouseEvent):void{
	var theDesc  = event.target.name;
	if (theDesc == "frs_groups"){
		event.target.removeEventListener(MouseEvent.MOUSE_OVER, showThought);
		thoughtMovie = new frs_groups_thought();
		addChild(thoughtMovie);
		thoughtMovie.x = 120;
		thoughtMovie.y = 100;
		event.target.addEventListener (MouseEvent.MOUSE_OUT, clearThought);
	}
		
}
function clearThought (event:MouseEvent):void{
	this.removeChild(thoughtMovie);
	event.target.addEventListener (MouseEvent.MOUSE_OVER, showThought);
}

"Credit belongs to the man who is actually in the arena - T.Roosevelt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top