[flexcoders] Re: how to show icon in ToggleButtonBar

2009-09-07 Thread nathanleewei
--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 
  Are icons shown in ToggleButtonBar?
 
 Yes
 
  What's your flex sdk version?
 
 3.3


OK, I will take a try with flex sdk 3.3. Thanks!



[flexcoders] how to show icon in ToggleButtonBar

2009-09-02 Thread nathanleewei
package com
{
import mx.controls.ToggleButtonBar;
import mx.events.FlexEvent;

public class MyToggleButtonBar extends ToggleButtonBar
{
[Embed(source=assets/java.gif)]
public var iconJavaClass:Class;

[Embed(source=assets/flex.gif)]
public var iconFlexClass:Class;

[Embed(source=assets/cvs.gif)]
public var iconCVSClass:Class;


public function MyToggleButtonBar()
{
super();
this.addEventListener(FlexEvent.CREATION_COMPLETE, 
onCreationComplete);
}

private function onCreationComplete(event:FlexEvent):void
{
var perspectiveToggleItem:Array=[];

var xmlList:XMLList=dataXml.perspective;
var xml:XML;
for (var i:int=0; i  xmlList.length(); i++)
{
xml=xmlList[i];

perspectiveToggleItem.push({ //
label: x...@label.tostring(), 
//
perspectiveName: 
x...@name.tostring(), //
icon:  
Class(systemManager.getDefinitionByName(x...@icon.tostring())) //
//icon: x...@icon.tostring()//
});
}

this.dataProvider=perspectiveToggleItem;
}


private var dataXml:XML=xml
perspective label=Java name=java 
icon=iconJavaClass/
perspective label=Flex name=flex 
icon=iconFlexClass/
perspective label=CVS name=cvs 
icon=iconCVSClass/
/xml;
}
}








?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:com=com.* 
layout=absolute
mx:Script
![CDATA[
[Embed(source=assets/java.gif)]
public var iconJavaClass:Class;

[Embed(source=assets/flex.gif)]
public var iconFlexClass:Class;

[Embed(source=assets/cvs.gif)]
public var iconCVSClass:Class;
]]
/mx:Script

mx:XMLList id=dataProvider
perspective label=Java name=java icon=iconJavaClass/
perspective label=Flex name=flex icon=iconFlexClass/
perspective label=CVS name=cvs icon=iconCVSClass/
/mx:XMLList

mx:MenuBar id=menuBar dataProvider={dataProvider} 
labelField=@label iconField=@icon/

!-- mx:ToggleButtonBar dataProvider={dataProvider} 
labelField=@label iconField=@icon/ --

com:MyToggleButtonBar y=50/

/mx:Application



Why do icons not shown in MyToggleButtonBar?Thanks




[flexcoders] Re: how to show icon in ToggleButtonBar

2009-09-02 Thread nathanleewei
Are icons shown in ToggleButtonBar?

What's your flex sdk version?


--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 Works for me. Do you get any errors?



[flexcoders] Re: how to wait for one event to finish?

2009-08-28 Thread nathanleewei

sorry, my mistake!

import flash.events.EventDispatcher;

public class MessageEventBus extends EventDispatcher {




--- In flexcoders@yahoogroups.com, coder3 rrhu...@... wrote:

 
 i see that you create a singlton to dispatch and addeventlistener. that makes
 sense.
 
 but what is this class EventListener?
 
 thanks!!



[flexcoders] Re: how to wait for one event to finish?

2009-08-26 Thread nathanleewei
public class MessageEventBus extends EventListener {
public static getInstance(): MessageEventBus {

}
}
//
public class ParentApplication {
var messageEventBus:MessageEventBus = MessageEventBus.getInstance();
public ParentApplication {
   
}

public function onHttpServiceResult(event:ResultEvent):void {
//...
//...
messageEventBus.dispatchEvent(new Event(ParentApplicationFinish));
}
}


//
public class AModule {
var messageEventBus:MessageEventBus = MessageEventBus.getInstance();
public ParentApplication {
   messageEventBus.addEventListener(ParentApplicationFinish, 
onParentApplicationFinish);
}
public function onParentApplicationFinish(event.Event):void {
//do what you want.
}
}



--- In flexcoders@yahoogroups.com, coder3 rrhu...@... wrote:

 
 Hi
 
 I have a module, that needs to wait for the parentApplication to finish the
 httpservice so that it can get the data and do some stuff.
 
 so the httpservice has a result handling function, 
 
 how can the module know when to get the result? i guess i need to use
 eventlistener, how?
 
 thanks!
 c
 
 
 -- 
 View this message in context: 
 http://www.nabble.com/how-to-wait-for-one-event-to-finish--tp25067200p25067200.html
 Sent from the FlexCoders mailing list archive at Nabble.com.





[flexcoders] Re: Find Actual Width After Setting Percent Width

2009-08-26 Thread nathanleewei
this.addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);

public function onCreationComplete(event:FlexEvent):void {
ChangeWatcher.watch(this,width, showWidth);
}

public function showWidth(e:Event):void {
Alert.show(this.width);
}


--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 What does canvas.measuredWidth give when the user clicks the button?
 
 
 --- In flexcoders@yahoogroups.com, jmfillman jmfillman@ wrote:
 
  I have a canvas container with=100%. When the user clicks a button, the 
  container is set to percentWidth=20, and I need to immediately know the new 
  width so that I can properly re-size elements in the container to match the 
  new width.
  
  From what I can tell, the LayoutManager doesn't get to measuring the new 
  width of the container right away. If the user clicks the button again, the 
  LayoutManager has done it's thing and has set the width value of the canvas.
  
  So the question is, how do I get the new width of the canvas as soon as I 
  set percentWidth=20?
 





[flexcoders] Ridiculous Thoughts...

2009-02-17 Thread nathanleewei
Have you developed Commands/Front Controller of Cairngorm?
Have you developed Event Map of Mate?
Have you thought about a much nicer Framework?

Here is my Ridiculous Thoughts of Open Infrastructure Solution for 
Flex Application Architecture.

http://code.google.com/p/flexrock/

Any ideas or suggestions?



[flexcoders] Re: Custom event--please help me

2008-12-15 Thread nathanleewei
BasePanel uses another EventDispatcher instance which is inherit from 
UIComponent.


So U can try 
var basePanel:BasePanel = your BasePanel instance;
basePanel.dispatchEvent(ev); 

instead 

var dipsatcher:EventDispatcher = new EventDispatcher();
dispatcher.dispatchEvent(ev);

And U should have a look at;
http://tech.groups.yahoo.com/group/flexcoders/message/66101
http://www.helihobby.com/html/alon_desingpattern.html
also CairngormEventDispatcher


--- In flexcoders@yahoogroups.com, lorenzo.boaro lore...@... 
wrote:

 Hi
 
 i've a problem..anibody can help me?
 
 i created this class:
 
 public class CompleteEvent extends Event
   {
   private var array:ArrayCollection
 
   public function CompleteEvent(type:String, 
array:ArrayCollection)
   {
   super(type);
   this.array = array;
   }
 
   public override function clone():Event {
   return new CompleteEvent(type, array);
   }
 }
 
 the main class create the array through a socket connection within 
the
 socket listeners for Socket.DATA...in the method listeners dispatch
 the event...
 
 [Event(name=newEvent, type=CompleteEvent)]
 
 public class MainApp{
 
 socket.addEventListeners(ProgressEvent.SOCKET_DATA, socketData);
 ...
 private function socketData(event:Event):void {
 
 ...some code to create array from server data...
   //dispatch event
 var dipsatcher:EventDispatcher = new EventDispatcher();
 var ev:CompleteEvent = new CompleteEvent(newEvent, array);
 
 dispatcher.dispatchEvent(ev);
   }
 }
 
 and this other class listens for the event
 
 public class BasePanel extends Panel
   {
 
   private function dataEventHandler():void {
   trace(Array retrieved);
   }
 
   public function BasePanel()
   {
   super();
   this.addEventListener(newEvent, 
dataEventHandler);
   }
 }
 
 but not working the BasePanel class doesn't listen for the event..
 
 thanks a lot 
 
 Regards 
 Lorenzo






[flexcoders] Re: Screen Resolution

2008-12-14 Thread nathanleewei
precentWidth
precentHeight


http://flexrock.googlecode.com/ 




[flexcoders] Is there anything like EventListnerList in JAVA?

2008-12-10 Thread nathanleewei
Is there anything like EventListnerList in JAVA?



[flexcoders] Re: Is there anything like EventListnerList in JAVA?

2008-12-10 Thread nathanleewei
To maintain a clear communication among all components / objects, especially 
for objects do not in the same event bubble path.

+---+
| containerObject   |
| +-+  +-+  |
| | objectA |  | objectB |  |
| +-+  +-+  |
+---+

When a event/change occurs in objectA, objectB would fire some fun().

Method A: Let the containerObject catch the event and invoke objectB.fun()

Method B: binding somedata of objectA with objectB, register 
dataChangeEvent in objectB.

Both above will get more and more complex and un-maintainable with 
system growth.

Thus, I need a Global centralized event(message) controller Like 
EventListenerList used in Java Swing

Maybe I find what I need:

http://tech.groups.yahoo.com/group/flexcoders/message/66101 

http://www.helihobby.com/html/alon_desingpattern.html

also CairngormEventDispatcher






[flexcoders] Re: problem with a simple XML Loader :(

2008-12-08 Thread nathanleewei
could u give the detail of modification?
I am facing the same problem. thx



[flexcoders] How to set variableRowHeight = true in MenuBar

2008-12-02 Thread nathanleewei
I want make the same effect as following url:

http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-
to-a-flex-popupbutton-controls-pop-up-menu-redux/


I haved tried 2 methods to solve the problem,

//method 1
private function onMenuBarInitialize():void {   
var menu:Menu;
for (var i:int = 0; i  menuBar.menus.length; i++) {
menu = menuBar.menus[i];
menu.variableRowHeight = true;
}
}

//method 2
private function onMenuShow(event:MenuEvent):void {
var t:MenuBar = event.currentTarget as MenuBar;
event.menu.variableRowHeight = true;
}


mx:MenuBar id=menuBar width=100% labelField=@label 
initialize=onMenuBarInitialize iconField=@icon styleName=menuBar 
itemClick=onMenuBar(event) menuShow=//onMenuShow(event)
mx:XMLList
menuitem label=File
menuitem label=New icon=documentIcon /
menuitem label=Open... 
icon=documentIcon/
menuitem type=separator /
menuitem label=Close /
menuitem type=separator /
menuitem label=Save /
menuitem label=Save as... /
menuitem type=separator /
menuitem label=Import... /
menuitem label=Export... /
menuitem type=separator /
menuitem label=Exit /
/menuitem
menuitem label=Edit
menuitem label=Cut /
menuitem label=Copy /
menuitem label=Paste /
menuitem type=separator /
menuitem label=Select All /
menuitem type=separator /
menuitem label=Find /
/menuitem
 /mx:XMLList  
/mx:MenuBar


But, child menu of MenuBar still presents some space at feet when it 
shown(click on MenuBar) for the FIRST time, and It presents normally when it 
shown for the second time.


Maybe it's a BUG of FLEX?! 







[flexcoders] Re: How to embed icons in MenuBar?

2008-12-02 Thread nathanleewei
It must be 
public var documentIcon:Class;


--- In flexcoders@yahoogroups.com, nathanleewei [EMAIL PROTECTED] 
wrote:

 no shown :(






[flexcoders] Re: How to make a Docking Window Framework/component like Eclipse/InfoDock/JDock

2008-12-02 Thread nathanleewei
http://flexrock.googlecode.com

--- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 Somebody on this list has created exactly what you're looking for, 
and it's
 pretty reasonably priced, google the archives.
 
 -Josh
 





[flexcoders] Re: How to make a Docking Window Framework/component like Eclipse/InfoDock/JDock

2008-12-02 Thread nathanleewei

--- In flexcoders@yahoogroups.com, Michael Schmalle
[EMAIL PROTECTED] wrote:

 Yeah, I forgot about that.
 There are probably 20 different ways you could implement something
like
 this. From my experience you want to start out thinking abstraction
and not
 program to much into your views.

 Mike

 On Thu, Oct 9, 2008 at 7:16 AM, nathanleewei [EMAIL PROTECTED] wrote:

maybe I should get some idea from
  SuperTabNavigator(flexlib/dougmccune)
 
 
 



 --
 Teoti Graphix, LLC
 http://www.teotigraphix.com

 Teoti Graphix Blog
 http://www.blog.teotigraphix.com

 You can find more by solving the problem then by 'asking the
question'.





[flexcoders] Re: How to embed icons in MenuBar?

2008-12-02 Thread nathanleewei
Thanks, it works!

[Embed(source=/assets/document.png)]
public var documentIcon:Class;


mx:MenuBar id=menuBar width=100% labelField=@label 
iconField=@icon styleName=menuBar itemClick=onMenuBar(event)
mx:XMLList
menuitem label=File
menuitem label=New icon=documentIcon /
menuitem label=Open... 
icon=documentIcon/



--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Try public instead of private
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
On Behalf Of nathanleewei
 Sent: Thursday, November 27, 2008 3:31 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] How to embed icons in MenuBar?
 
 
 [Embed(source=/assets/document.png)]
 private static const document_icon:Class;
 
 mx:MenuBar id=menuBar width=100% labelField=@label
 iconField=@icon styleName=menuBar itemClick=onMenuBar(event)
 mx:XMLList
 menuitem label=File
 menuitem label=New icon=document_icon /
 
 it has no effect?!






[flexcoders] Re: How to embed icons in MenuBar?

2008-12-02 Thread nathanleewei
no shown :(



[flexcoders] Re: How to make a Docking Window Framework/component like Eclipse/InfoDock/JDock

2008-12-02 Thread nathanleewei
What I am looking for is different from DockAreaFX.

Pls see my project: http://flexrock.googlecode.com


--- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 Somebody on this list has created exactly what you're looking for, 
and it's
 pretty reasonably priced, google the archives.
 
 -Josh






[flexcoders] Re: How to set variableRowHeight = true in MenuBar

2008-12-02 Thread nathanleewei
The first time I click the MenuBar, the sub-menu show as below:

+---+
|  New  |
+---+
|  Open |
+---+
|  Close|
+---+
|  Save |
|  Saveas.. |
+---+
|  Import...|
|  Export...|
+---+
|  Exit |
|   |
|   |
|   |
|   |
+---+


The second time I click the MenuBar, the sub-menu show as below:
The first time I click the MenuBar, the sub-menu show as below:

+---+
|  New  |
+---+
|  Open |
+---+
|  Close|
+---+
|  Save |
|  Saveas.. |
+---+
|  Import...|
|  Export...|
+---+
|  Exit |
+---+


Anyone has any idea?





[flexcoders] Re: How to set style of buttons' border in ButtonBar?

2008-11-28 Thread nathanleewei
I found the answer

.buttonBar {
firstButtonStyleName: mybuttonBarButtonStyle;
lastButtonStyleName: mybuttonBarButtonStyle;
buttonStyleName: mybuttonBarButtonStyle;
}

.mybuttonBarButtonStyle {
selectedOverSkin: ClassReference(xx.MyButtonBarButtonSkin);
upSkin: ClassReference(xx.MyButtonBarButtonSkin);
overSkin: ClassReference(xx.MyButtonBarButtonSkin);
selectedDownSkin: ClassReference(xx.MyButtonBarButtonSkin);
selectedDisabledSkin: ClassReference(xx.MyButtonBarButtonSkin);
}


public class MyButtonBarButtonSkin extends Border
{
override protected function updateDisplayList(w:Number, h:Number):void
{

//var borderColorDrk1:Number =
//  ColorUtil.adjustBrightness2(borderColor, 50);
var borderColorDrk1:Number = borderColor;

}

}




[flexcoders] How to set parentComponent.visible = false childComponent.visible = true?

2008-11-27 Thread nathanleewei
parentParentContainer
+parentContainer
| +childComponent 

I mean how to maximize a childComponent to parentParentContainer 
scope?



[flexcoders] How to set style of buttons' border in ButtonBar?

2008-11-27 Thread nathanleewei
top/bottom border alphas 
top/bottom border borderThickness



[flexcoders] How to embed icons in MenuBar?

2008-11-27 Thread nathanleewei
[Embed(source=/assets/document.png)]
private static const document_icon:Class;


mx:MenuBar id=menuBar width=100% labelField=@label 
iconField=@icon styleName=menuBar itemClick=onMenuBar(event)
mx:XMLList
menuitem label=File
menuitem label=New icon=document_icon /

it has no effect?!








[flexcoders] Re: How to set style of buttons' border in ButtonBar?

2008-11-27 Thread nathanleewei
Of course I have browered Flex3StyleExplorer, and I didn't find the 
answer.

--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote:

 The first stop for all style questions is here:
 
 
http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExp
lo
 rer.html#
 
http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleEx
pl
 orer.html 
 
  
 
 Tracy
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
On
 Behalf Of nathanleewei
 Sent: Thursday, November 27, 2008 6:29 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] How to set style of buttons' border in 
ButtonBar?
 
  
 
 top/bottom border alphas 
 top/bottom border borderThickness






[flexcoders] Re: How to make a Docking Window Framework/component like Eclipse/InfoDock/JDock

2008-10-09 Thread nathanleewei
maybe I should get some idea from 
SuperTabNavigator(flexlib/dougmccune)



[flexcoders] Re: How to make a Docking Window Framework/component like Eclipse/InfoDock/JDock

2008-10-09 Thread nathanleewei

Thanks for your suggestion.

I have already browsed the source code of flexlib-MDI and 
idw(infonode.net). And I designed the structure according to idw:

DockingWindow(abstract class in JAVA): Base class for all types of 
docking windows.

View: content component and some buttons.

RootWindow: Top level container for docking windows.

SplitWindow: A window with a split pane that contains two child 
windows and a DividedBox.

TabWindow: A docking window containing Views, presents as a Panel 
within a tabbed panel and ViewStack.

WindowBar: Shortcuts of minimized View.

Now I wanna know what components I should use to implement the 
TabWindow? I have tried TabNavigator, but it seem to be not flexible 
for extention.

(I have been learning English several months ago, sorry 4 grammar 
mistake or spelling mistake)



--- In flexcoders@yahoogroups.com, Michael Schmalle 
[EMAIL PROTECTED] wrote:

 Hi,
 No need to cross post from flexcomponents to flexcoders most of us 
read
 both.
 
 This is a bit of engineering on your part. This is like asking where 
do I
 start to make a space ship. There are so many details, you will need 
to
 design this from your knowledge of flex components.
 
 You might look at the flexlib and it's MDI implementation. That 
might give
 you some ideas on where to start.
 
 Ironically, I am releasing a framework like this in 2 months. Truth 
be told,
 I have spent 1 1/2 years creating a base framework that made it 
happen.
 
 Mike
 



[flexcoders] How to make a Docking Window Framework/component like Eclipse/InfoDock/JDocking

2008-10-08 Thread nathanleewei
How to make a Docking Window Framework/Component like
Eclipse/InfoDock/JDocking?

+RootWindow
|
+--SplitWindow
|
+--SplitWindow
|  |
|  +--TabWindow
|  +--TabWindow
|
+--TabWindow
   |
   +--Tabbar
   +--ViewStack
   +--Max Buttton
   +--Min Button


Where should I start?
How to implement TabWindow? TabNavigator + buttons or Tabbar+
ViewStack?