Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-06-2006, 03:54 PM   #1
As2John
Registered User
 
Join Date: Jul 2006
Posts: 13
Default window component - locate button in movieClip

Hi,
Does anyone know how to access a button in a movieClip that is loaded into Window component? I tried following but it does not work.

HTML Code:
import mx.managers.PopUpManager;
import mx.containers.Window;
var my_win:MovieClip = PopUpManager.createPopUp(this, Window, true, {closeButton:true, contentPath:"aa"});
var winListener:Object = new Object();
winListener.complete = function(evt_obj:Object) {
	my_win.setSize(my_win.content._width+50, my_win.content._height+50);
};
my_win.addEventListener("complete", winListener);
my_win.content.aa.b_btn.onRelease = function() {
	trace("Button pressed");
}
Thanks
As2John is offline   Reply With Quote
Old 01-05-2007, 06:58 AM   #2
tuor
Registered User
 
Join Date: Jan 2007
Location: Zurich
Posts: 11
Send a message via Skype™ to tuor
Default

Quote:
Originally Posted by As2John View Post
Hi,
Does anyone know how to access a button in a movieClip that is loaded into Window component? I tried following but it does not work.
Hi John,

There are two things you must correct for the button to work. First, when targeting the window content, you don't need to include the target movieclip as well. You wrote:
Code:
my_win.content.aa.b_btn.onRelease
instead you should use:
Code:
my_win.content.b_btn.onRelease
Also, put the onRelease function into the complete function so that you can be sure the button is loaded (and can be targeted) when you click it. The working code looks like this:
Code:
import mx.managers.PopUpManager;
import mx.containers.Window;
var my_win:MovieClip = PopUpManager.createPopUp(this, Window, true, {closeButton:true, contentPath:"aa"});
var winListener:Object = new Object();
winListener.complete = function(evt_obj:Object) {
	my_win.setSize(my_win.content._width+50, my_win.content._height+50);
	my_win.content.b_btn.onRelease = function() {
		trace("Button pressed");
	}
};
my_win.addEventListener("complete", winListener);
tuor is offline   Reply With Quote
Reply


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
open MXML component + button click ljonny18 Flex 2, 3 & 4 5 10-25-2006 08:50 PM
nested button in movieclip to target frame label warrens3 ActionScript 2.0 1 09-27-2006 05:45 PM
Calling an Alert component from the content of a Window component mrand01 Components 1 04-24-2006 03:32 PM
Window Component depth issues? yossarianpickwick Components 0 04-04-2006 06:22 PM
Path to movieclip inside button inside movieclip . . . tim_massey ActionScript 1.0 (and below) 1 12-05-2002 10:43 PM


All times are GMT. The time now is 04:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.