The checkbox and button aren't ready (initialized) by the time the Window
complete event is triggered.
To found out when the Settings movieclip is ready, attach a class to the
movieclip (call it Settings), which extends the MovieClip
class.
Define an onLoad method and dispatch an event.
import mx.events.EventDispatcher;
class Settings extends MovieClip {
private static var dispatcherInit =
EventDispatcher.initialize(Object(Settings));
// EventDispatcher methods
public var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
//=================================
// CONSTRUCTOR
//=================================
function Settings() {
trace("Settings ::: CONSTRUCTOR");
}
//=================================
// PRIVATE METHODS
//=================================
private function onLoad() {
trace("Settings ::: onLoad");
this.dispatchEvent({type:"ready"});
}
}
And use the following in the main timeline to achieve what you want:
import mx.containers.Window;
var my_win:Window;
this.my_win.contentPath = 'Settings';
// window content ready event handler
function ready(o:Object) {
trace("Application ::: ready");
this.my_win.content.my_checkbox.label = 'Green';
this.my_win.content.my_button.label = 'Save';
}
// window complete event handler
function complete(o:Object) {
trace("Application ::: complete");
var m:Object = this.my_win.getViewMetrics();
var content = this.my_win.content;
// listen for ready event on window content
this.my_win.content.addEventListener("ready", this);
this.my_win.setSize(content._width+m.left+m.right,
content._height+m.top+m.bottom);
}
this.my_win.addEventListener("complete", this);
regards,
Muzak
----- Original Message -----
From: "Alexander Farber" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, January 17, 2007 3:25 PM
Subject: [Flashcoders] A v2 Window with a Checkbox and a Button
> Hi,
>
> I've drawn a red rectangle, then pulled a v2 Checkbox and
> a Button inside of it, named them my_checkbox and my_button
> and then converted all of that into a MovieClip which I called
> "Settings" and removed from the stage.
>
> Finally I've pulled a Window on the stage and called it my_win.
>
> While I'm able to resize the my_win in its "complete" event,
> I can't find the way to change the labels of the checkbox and
> the button programmatically:
>
> import mx.containers.Window;
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com