[flexcoders] This component won't populate with data
Here is just a sample combobox component I was testing, and it won't populate. Can anyone please tell me what I'm doing wrong? ?xml version=1.0 encoding=utf-8? mx:ComboBox xmlns:mx=http://www.adobe.com/2006/mxml; dataProvider={modelPeople.people} labelFunction=cboLabelFunction mx:Script ![CDATA[ import mx.core.Application; import mx.collections.ArrayCollection; public function cboLabelFunction(o:Object):String { trace(-- + o.firstName); return o.firstName + + o.lastName; } ]] /mx:Script mx:Model id=modelPeople people person firstName=Kate middleName=Bailey lastName=Beckinsale fileName=KateBeckinsale.jpg/ person firstName=Kristen middleName=Anne lastName=Bell fileName=KristenBell.jpg/ person firstName=Kristin middleName=Laura lastName=Kreuk fileName=KristinKreuk.jpg/ person firstName=Calista middleName=Kay lastName=Flockhart fileName=CalistaFlockhart.jpg/ person firstName=Nicole middleName=Evangeline lastName=Lilly fileName=EvangelineLilly.jpg/ /people /mx:Model /mx:ComboBox Thanks.
[flexcoders] Perennial problem with Flex -- single element vs multi-element
For those of you who have been using Flex since 1.5, do you remember how Flex always had a problem returning single-element arrays as a non-array object, and how we had to apply mx.utils.ArrayUtils to force it to become a one-element array? It seems like Flex 3.0 still has the same problem. If the XML I am getting from the server looks like this: root node / node / root that is, a root tag with more than one child node, event.result.root.node will be of type ArrayCollection. But if the XML is like this: root node / /root where there is only one child tag, event.result.root.node becomes of type mx.utils.ObjectProxy. This is causing my application to bomb because I'm automatically storing the results in an ArrayCollection. Has anyone had this problem before? Any suggestions on how to handle this would be greatly appreciated. Thanks.
[flexcoders] Datagrid question
Imagine a mx:DataGrid with 3 columns. The first and second columns are people's first and last names, respectively. The third column is a custom MXML component that displays a button with its 'label' property set to a random number generated within the component; this number is generated during its instantiation. My objective now is to get the value of that button's label. How can I get it? The only way I can think of is to somehow be able to get a reference to that component in the third column, then I can access the component's properties. Can someone show me how I can do this in Actionscript? Thanks.
[flexcoders] Datagrid cell event
I realize a datagrid can have a change event which triggers when the user selects a row. But if one or more of the columns are editable, is there a way to define a change event on a CELL basis without resorting to making that column into an MXML component itemrenderer? Thanks.
[flexcoders] XML issue driving me nuts
My short test code is down at the bottom after my description of the problem. My object is to populate two mx:Tree objects. In my short code sample below, only the second tree is getting populated. Can anyone tell me what I'm doing wrong with the first mx:Tree? In summary, both mx:Tree objects use XMLListCollection objects as their dataProviders. Both XMLListCollection objects' sources are XMLList objects. Both XMLList objects are populated with the same identical XML data. The only difference is that one XMLList object gets its XML data from an inline XMLList definition, while the other is from an inline XML definition which is passed to an XMLList. This subtle difference causes the first mx:Tree not to show anything, while the second does. What am I doing wrong? Thanks in advance. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=init() mx:Script ![CDATA[ import mx.events.ListEvent; private var xmllMenu1:XMLList; private function init():void { //Here's how I'm populating the first XMLList object xmllMenu1 = new XMLList(xmlMenu1 as XML); } private function treeMenuChangeHandler(event:ListEvent):void { trace(label= + event.target.selectedit...@label + (event.target.selectedit...@id == undefined ? : id= + event.target.selectedit...@id)); } ]] /mx:Script mx:XML xmlns= id=xmlMenu1 node node label=Test/ /node /mx:XML !-- Here's how I'm populating the second XMLList object -- mx:XMLList xmlns= id=xmllMenu2 node node label=Test/ /node /mx:XMLList mx:XMLListCollection id=xmllcMenu1 source={xmllMenu1}/ mx:XMLListCollection id=xmllcMenu2 source={xmllMenu2}/ mx:HBox mx:Tree id=treeMenu1 width=300 height=100% dataProvider={xmllcMenu1} labelField=@label showRoot=false change=treeMenuChangeHandler(event)/ mx:Tree id=treeMenu2 width=300 height=100% dataProvider={xmllcMenu2} labelField=@label showRoot=false change=treeMenuChangeHandler(event)/ /mx:HBox /mx:Application
[flexcoders] Re: How to make mx:Application transparent
I searched for wmode in Google, and it seems like it does address my problem, but I did see posts by other people regarding browser compatibily issues. I will look into it and try that, thanks for leading me to the right direction. --- In flexcoders@yahoogroups.com, Gustavo Duenas LRS gdue...@... wrote: have you tried to set the background transparent from the part of the embeded like: param name=wmode value=transparent/ or something like that, I used to do that in the flash using swfobject but I guess that might work as well, although I've never used on flex. Some solutions outside the mx application could be good to try. Gustavo On Mar 18, 2009, at 8:01 PM, elevight wrote: Here's the code of my small application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical width=540 height=45 horizontalScrollPolicy=off verticalScrollPolicy=off paddingTop=1 paddingBottom=0 paddingLeft=0 paddingRight=0 verticalAlign=middle mx:HBox horizontalAlign=left backgroundAlpha=0 mx:Label text=Login:/ mx:TextInput id=txtLogin width=165 height=20 maxChars=25/ mx:Label text=Password:/ mx:TextInput id=txtPassword width=165 height=20 maxChars=25 displayAsPassword=true/ mx:Button id=btnSubmit label=Submit width=70/ /mx:HBox mx:HBox horizontalAlign=center backgroundAlpha=0 mx:Text text=This is a test message of an error. color=0xff fontWeight=bold/ /mx:HBox /mx:Application When the above application is run, I get this default blue background that all Flex applications start with. I want to make it transparent so that whatever my Flex application is sitting on in my web page would show instead. I've tried setting the backgroundAlpha of the mx:Application to zero but have had no effect. Anybody have any suggestions on how to do this? Thanks.
[flexcoders] How to make mx:Application transparent
Here's the code of my small application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical width=540 height=45 horizontalScrollPolicy=off verticalScrollPolicy=off paddingTop=1 paddingBottom=0 paddingLeft=0 paddingRight=0 verticalAlign=middle mx:HBox horizontalAlign=left backgroundAlpha=0 mx:Label text=Login:/ mx:TextInput id=txtLogin width=165 height=20 maxChars=25/ mx:Label text=Password:/ mx:TextInput id=txtPassword width=165 height=20 maxChars=25 displayAsPassword=true/ mx:Button id=btnSubmit label=Submit width=70/ /mx:HBox mx:HBox horizontalAlign=center backgroundAlpha=0 mx:Text text=This is a test message of an error. color=0xff fontWeight=bold/ /mx:HBox /mx:Application When the above application is run, I get this default blue background that all Flex applications start with. I want to make it transparent so that whatever my Flex application is sitting on in my web page would show instead. I've tried setting the backgroundAlpha of the mx:Application to zero but have had no effect. Anybody have any suggestions on how to do this? Thanks.
[flexcoders] Actionscript question
I have created an empty actionscript class, and I'm trying to use metadata to change the background color: package { [SWF(backgroundColor=#ff)] import flash.display.Sprite; public class SampleClass extends Sprite { public function SampleClass() { } } } But the background color is not changing to red. Can anybody see what I'm doing wrong? Thanks.
[flexcoders] How to set VBox width to a %age in actionscript
This is actually my second time to post this question. No one replied before, so maybe it got lost in the shuffle. In MXML, I'd set the VBox width to 100% like this: mx:VBox width=100%/ But in actionscript: var vbox:VBox = new VBox(); vbox.width = 100%; The above won't work because the compiler will flag an error on 100%. Does anyone know how I can set a VBox's width as a percentage in actionscript? Thanks.
[flexcoders] Question on DateField as itemrenderer
Has anyone ever tried using a mx.controls.DateField as an itemrenderer for a mx:Datagrid column? Unlike mx.controls.TextInput which has a property called 'text' to return its data, I can't find a counterpart for the DateField, so I don't know what to put in the 'editorDataField' property of the mx:DataGridColumn: mx:DataGridColumn headerText=Birthdate dataField=birthdate itemEditor=mx.controls.DateField editorDataField=?? editable=true/ Thanks.
[flexcoders] VBox question
In MXML, you set a VBox's width to 100% by: mx:VBox width=100%/ But if you instantiated a VBox in actionscript as in: var vbox:VBox = new VBox(): How do you set its width to 100%? Thanks.
[flexcoders] I don't understand why I'm getting this compiler error
I'm getting a compiler message saying Event type 'events.CustomEvent' is unavailable, and I don't understand why. I'm hoping a second eye might catch the problem. My custom event class is called CustomEvent.as: (the dao.Person class is just a dummy class that stores a firstName, middleName, and lastName, and I was going to see if the data in this object will be available in my 'testEvent' handler). package actionscript { import dao.Person; import flash.events.Event; public class CustomEvent extends Event { public var person:Person; public function CustomEvent(person:Person, type:String) { super(type); this.person = person; } public override function clone():Event { return new CustomEvent(person, type); } } } I'm trying to dispatch the above custom event from a test component called TestComponent.mxml: ?xml version=1.0 encoding=utf-8? mx:TextInput xmlns:mx=http://www.adobe.com/2006/mxml; mx:Metadata [Event(name=testEvent, type=events.CustomEvent)] /mx:Metadata mx:Script ![CDATA[ import actionscript.CustomEvent; import dao.Person; public function fireAway():void { var p:Person = new Person (John, Missing, Doe); var e:CustomEvent = new CustomEvent (p, testEvent); this.dispatchEvent(e); } ]] /mx:Script /mx:TextInput And finally, here is my MXML application that's supposed to test all this and is called CustomEventsTest.mxml: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:c=components.* mx:Script ![CDATA[ import actionscript.CustomEvent; import components.TestComponent; private function clickHandler():void { testComponent.fireAway(); } private function testEventHandler (event:CustomEvent):void { trace(It got here to testEventHandler.); } ]] /mx:Script mx:VBox !-- * -- c:TestComponent id=testComponent backgroundColor=yellow testEvent=testEventHandler(event)/ !-- * -- mx:Button id=btnFireEvent label=Fire Event click=clickHandler()/ /mx:VBox /mx:Application The compiler error message is complaining about the c:TestComponent between the two lines of asterisks. Can anyone see why the compiler is telling me why CustomEvent is unavailable? Thanks in advance for your time.
[flexcoders] Re: How to stop Flex from compiling my Java source files
--- In flexcoders@yahoogroups.com, Ryan Graham ryan.gra...@... wrote: Java source files are in C:\Tomcat5\webapps\FlexApp\WEB-INF\src. When I build my Flex application, it tries to recompile the Java source files. Is there a way I can tell Flex Builder to leave my Java source files alone? It's causing me servlet errors. Switch to ANT for more granular builds? HTH, Ryan That's what I had to do, create my Java project in Eclipse separately from my Flex app, then just copied the java class files over after each time I compiled. I did not have this problem with Flex 1.5 and Flex 2.0. Amazing how I end up facing a basic problem like this with Flex 3.0 with no quick solution within Flex Builder.
[flexcoders] How to stop Flex from compiling my Java source files
I'm using Flex 3.0.2 along with Tomcat 5.0. I code my Java using Eclipse 3.1, and I was having problems which I later discovered was being caused because Flex Builder was compiling my Java source files. I have my Flex source files in C:\Tomcat5\webapps\FlexApp\src, and my Java source files are in C:\Tomcat5\webapps\FlexApp\WEB-INF\src. When I build my Flex application, it tries to recompile the Java source files. Is there a way I can tell Flex Builder to leave my Java source files alone? It's causing me servlet errors. Thanks.
[flexcoders] Re: How to control depth
Does anyone know how to control the z-axis of objects? Here's a very short code snippet to illustrate my question: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:VBox id=vboxRed backgroundColor=red width=100 height=100/ mx:VBox id=vboxBlue backgroundColor=blue width=200 height=50/ /mx:Application In the above, vboxBlue was instantiated after vboxRed, and hence, appears on top of vboxRed. How can I, during runtime, make vboxRed be on top of vboxBlue? Thanks.
[flexcoders] RE: How to place multiple Flex 2 applications in one HTML page
My objective is to put multiple Flex applications within one HTML page with each application residing in its own table td cell. Let's say my application's name is HelloWorld.mxml, which resides in HelloWorld.html. When I look inside HelloWorld.html, I see a javascript function call, but this won't work for me because it lacks the ability to interface with HTML for me to tell it which table cell to appear in. I noticed in the noscript section, there is an object tag, but when I try to view a HTML page with just that object tag code block, I see the gradient background, but none of my visual components would appear. I was hoping this would work, then I could just copy/pasted the whole object code block and paste it within my td tags. Could anyone help me on this please? Thanks. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/