Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 12th, 2006, 10:03 AM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
Actionscript/Javascript Hide Movie Clip with Buttons

Hi all, and thanks for reading.
I have an embedded Flash movie which I'm manipulating with JavaScript.
I basically want to hide certain "layers" which have essentially become groups of symbols in an embedded movie clip. The goal is to hide everything, which worked well using the Alpha property when the symbols in the movie clip were just graphics, but, now that I'm converting them to buttons to add interactivity, it's become problematic: the buttons, although invisible, are still active.
Is there some way that I can just outright hide or turn off the movie clip or make each button in that movie clip inactive (without using a for loop) so that these buttons will disappear?
Putting an invisible rectangle over it is not an option, as there are many different "layers" and possible combinations that would make it impractical.

Thanks in advance.

Reply With Quote
  #2  
Old October 12th, 2006, 10:13 AM
b3n's Avatar
b3n b3n is offline
Prisoner of the Sun
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jul 2004
Location: The Mews At Windsor Heights
Posts: 4,389 b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level)b3n User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 2 Months 2 Days 2 h 58 m 10 sec
Reputation Power: 883
Facebook Orkut
All symbol objects have an attribute called _visible. You can set that to false to hide something. It's less CPU-intensive than _alpha. I think it also disables the symbol.

Some objects also have an enabled attribute.

Disabling a movie clip doesn't disable the objects inside it - you have to disable each object individually.

Why don't you want to use a for loop?

Here is a recursive function that can disable objects. It was started by me and finished by 'blockage' at www.actionscript.org
Code:
function disable(scope:Object, stack:Array):Void
{
	// create a stack to avoid circular references
	if (!stack) var stack:Array = [];
	
	trace ("SCOPE: "+scope);
	
	var j:Number;
	var i:String;
	var circular:Boolean;
	for (i in scope)
	{ 
		if (typeof (scope[i]) == "movieclip")
		{ 
			// search the stack to make sure we not looking at a circular reference to an anscestor movieclip
			circular = false;
			j = stack.length;
			while (j--) {
				if (scope[i] === stack[j]) {
					circular = true;
					break;
				}
			}
			
			// avoid any anscestors
			if (!circular) {
				trace("scope[name] = "+scope[i]);
				trace("I have a movie clip child named "+i);
				trace("Disabling: "+scope[i]);
				scope[i].enabled = false;
				
				// add this clip to the stack 
				stack.push(scope[i]);
				
				// recurse down the branch
				disable(scope[i], stack);
				
				// done this branch so pop the stack
				stack.pop();
			}
		} 
		else if (typeof(scope[i]) == "object")
		{
			if (scope[i].enabled)
			{
				scope[i].enabled = false;
			}
		}
	}
}
disable(this);
// if called from main timeline, the entire movie will be disabled!
__________________
.
Save The Developers! :: How To Ask Questions The Smart Way :: Cheat Sheets :: PHP :: MySQL :: Flash :: 13 Moon Facebook App.

My Delicious

"All matter is merely energy condensed to a slow vibration. We are all one consciousness experiencing itself - subjectively. There is no such thing as death, life is only a dream. We are the imaginations of ourselves."
- Bill Hicks


"Truth is hidden in the subtle nature of the heart of everything, although it is invisible. One cannot see it from inside and neither from the surface. One can only live and experience it."
- Heart Sutra

Last edited by b3n : October 12th, 2006 at 10:29 AM.

Reply With Quote
  #3  
Old October 12th, 2006, 10:18 AM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
Thanks for responding.

I didn't use visibility because I didn't see where you could set that property for the movie clips besides on the actual layer, which I could never figure out how to access in JavaScript.
Is there a way to do this, or do I just need an ActionScript to turn off the visibility of the unwanted movie clips when the movie loads?

Thanks again.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Actionscript/Javascript Hide Movie Clip with Buttons


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT