[Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Alexander Farber

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;

var my_win:Window;
my_win.contentPath = 'Settings';

function complete(evt_obj:Object){
   var metr_obj:Object = my_win.getViewMetrics();
   my_win.setSize(my_win.content._width + metr_obj.left + metr_obj.right,
  my_win.content._height + metr_obj.top + metr_obj.bottom);

   my_win.content.my_checkbox.label = 'Green';
   my_win.content.my_button.label = 'Save';
}
my_win.addEventListener('complete', this);

And if I try to use an object casting:

   var my_set:Settings = Settings(my_win.content);
   my_set.label = 'Green';
   my_set.label = 'Save';

then I get this misterious error message:

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 17:
The class or interface 'Settings' could not be loaded.
   var my_set:Settings = Settings(my_win.content);

I feel that I've done my homework by rereading the Flash8
help on the Window component and the nice book Advanced
ActionScript Components: Mastering the Flash Component
Architecture, but I'm still missing something... Any help please?

The test case source code is here:
   http://preferans.de/Settings.fla
   http://preferans.de/Settings.swf

Regards
Alex



--
http://preferans.de


--
http://preferans.de
___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Thomas Fowler
So, you have a symbol in your library with a  linkage identifier of 
Settings. Does this symbol also have the name of your class that is 
supporting the symbol? This class would be called Settings also.


- Original Message -
From: Alexander Farber [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, January 17, 2007 8:25 AM
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;

var my_win:Window;
my_win.contentPath = 'Settings';

function complete(evt_obj:Object){
   var metr_obj:Object = my_win.getViewMetrics();
   my_win.setSize(my_win.content._width + metr_obj.left + 
metr_obj.right,

  my_win.content._height + metr_obj.top + metr_obj.bottom);

   my_win.content.my_checkbox.label = 'Green';
   my_win.content.my_button.label = 'Save';
}
my_win.addEventListener('complete', this);

And if I try to use an object casting:

   var my_set:Settings = Settings(my_win.content);
   my_set.label = 'Green';
   my_set.label = 'Save';

then I get this misterious error message:

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 17:
The class or interface 'Settings' could not be loaded.
   var my_set:Settings = Settings(my_win.content);

I feel that I've done my homework by rereading the Flash8
help on the Window component and the nice book Advanced
ActionScript Components: Mastering the Flash Component
Architecture, but I'm still missing something... Any help please?

The test case source code is here:
   http://preferans.de/Settings.fla
   http://preferans.de/Settings.swf

Regards
Alex



--
http://preferans.de


--
http://preferans.de
___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Thomas Fowler

Going to send your .fla w/ a class file here in just a sec...

- Original Message -
From: Thomas Fowler [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, January 17, 2007 8:34 AM
Subject: Re: [Flashcoders] A v2 Window with a Checkbox and a Button

So, you have a symbol in your library with a  linkage identifier of 
Settings. Does this symbol also have the name of your class that is 
supporting the symbol? This class would be called Settings also.


- Original Message -
From: Alexander Farber [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, January 17, 2007 8:25 AM
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;

var my_win:Window;
my_win.contentPath = 'Settings';

function complete(evt_obj:Object){
   var metr_obj:Object = my_win.getViewMetrics();
   my_win.setSize(my_win.content._width + metr_obj.left + 
metr_obj.right,

  my_win.content._height + metr_obj.top + metr_obj.bottom);

   my_win.content.my_checkbox.label = 'Green';
   my_win.content.my_button.label = 'Save';
}
my_win.addEventListener('complete', this);

And if I try to use an object casting:

   var my_set:Settings = Settings(my_win.content);
   my_set.label = 'Green';
   my_set.label = 'Save';

then I get this misterious error message:

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 17:
The class or interface 'Settings' could not be loaded.
   var my_set:Settings = Settings(my_win.content);

I feel that I've done my homework by rereading the Flash8
help on the Window component and the nice book Advanced
ActionScript Components: Mastering the Flash Component
Architecture, but I'm still missing something... Any help please?

The test case source code is here:
   http://preferans.de/Settings.fla
   http://preferans.de/Settings.swf

Regards
Alex



--
http://preferans.de


--
http://preferans.de
___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Thomas Fowler
Looked at this for about 15 min. and for some reason neither component is 
available for me to change. Strange...


- Original Message -
From: Alexander Farber [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, January 17, 2007 8:57 AM
Subject: Re: [Flashcoders] A v2 Window with a Checkbox and a Button


Hello Thomas,

is your question related to the error message:


**Error** Scene=Scene 1, layer=Actions, frame=1:Line 17:
The class or interface 'Settings' could not be loaded.
   var my_set:Settings = Settings(my_win.content);


after me trying the object casting? No I don't have a Settings.as

Regards
Alex

On 1/17/07, Thomas Fowler [EMAIL PROTECTED] wrote:

So, you have a symbol in your library with a  linkage identifier of
Settings. Does this symbol also have the name of your class that is
supporting the symbol? This class would be called Settings also.

- Original Message -
From: Alexander Farber [EMAIL PROTECTED]

 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;

 var my_win:Window;
 my_win.contentPath = 'Settings';

 function complete(evt_obj:Object){
var metr_obj:Object = my_win.getViewMetrics();
my_win.setSize(my_win.content._width + metr_obj.left +
 metr_obj.right,
   my_win.content._height + metr_obj.top + metr_obj.bottom);

my_win.content.my_checkbox.label = 'Green';
my_win.content.my_button.label = 'Save';
 }
 my_win.addEventListener('complete', this);

 And if I try to use an object casting:

var my_set:Settings = Settings(my_win.content);
my_set.label = 'Green';
my_set.label = 'Save';

 then I get this misterious error message:

 **Error** Scene=Scene 1, layer=Actions, frame=1:Line 17:
 The class or interface 'Settings' could not be loaded.
var my_set:Settings = Settings(my_win.content);

 I feel that I've done my homework by rereading the Flash8
 help on the Window component and the nice book Advanced
 ActionScript Components: Mastering the Flash Component
 Architecture, but I'm still missing something... Any help please?

 The test case source code is here:
http://preferans.de/Settings.fla
http://preferans.de/Settings.swf


--
http://preferans.de
___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Muzak
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 flashcoders@chattyfig.figleaf.com
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;



___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Fumio Nonaka

Hi Muzak,

Shouldn't the EventDispatcher.initialize() apply to the prototype of a 
class?

_

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));
  private static var dispatcherInit = 
EventDispatcher.initialize(Settings.prototype);

 // 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});
 }
}


Good luck,
--
Fumio Nonaka
mailto:[EMAIL PROTECTED]
http://www.FumioNonaka.com/
My bookshttp://www.FumioNonaka.com/Books/index.html
Flash communityhttp://F-site.org/

___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] A v2 Window with a Checkbox and a Button

2007-01-17 Thread Muzak
Yup, it should.. Thanx for spotting that ;-)

private static var dispatcherInit = 
EventDispatcher.initialize(Settings.prototype);

regards,
Muzak

- Original Message - 
From: Fumio Nonaka [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, January 18, 2007 2:38 AM
Subject: Re: [Flashcoders] A v2 Window with a Checkbox and a Button


 Hi Muzak,

 Shouldn't the EventDispatcher.initialize() apply to the prototype of a class?
 _
 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));
   private static var dispatcherInit = 
 EventDispatcher.initialize(Settings.prototype);
  // 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});
  }
 }

 Good luck,
 -- 
 Fumio Nonaka


___
Flashcoders@chattyfig.figleaf.com
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