[flexcoders] Re: Executing local java
You might try looking into the javax.xml.ws.Endpoint class described here: http://today.java.net/pub/a/today/2007/07/03/jax-ws-web- services-without-ee-containers.html Looks like a lighter-weight solution than deploying Jetty. -James --- In flexcoders@yahoogroups.com, Jhonny Everson [EMAIL PROTECTED] wrote: Thanks. I was looking for a simpler way but i guess it's the only one... On Jan 30, 2008 3:53 AM, andrii_olefirenko [EMAIL PROTECTED] wrote: you could write a local service to access your java code. that's how i did it: along with AIR app, the Jetty web server is installed with all needed java libs and interfaces to access it (web services or AMF3). then my AIR app will just connect to localhost and execute local java code as remote one. voilia :) Andrii Olefirenko
[flexcoders] Re: ProgressEvent.bytesTotal not populated?
Do you have a way to make sure the Content-Length response header is coming across correctly? I ran into a similar problem with a flex app (in browser) and found it was related to the fact that I was using a server-side proxy that wasn't passing the Content-Length response header from the source server back to the flash player... Not sure if this will apply to your situation with an AIR app... -James --- In flexcoders@yahoogroups.com, Battershall, Jeff [EMAIL PROTECTED] wrote: I've built at AIR app that supports application update, but I'd like to show the user the progress of the updater download. For some reason, the ProgressEvent.bytesTotal just isn't coming over the wire. bytesLoaded sure is, just not bytesTotal. It isn't as though this is some tiny file, either - we're talking about 4MB, so the player *should* have time to get this info. Any suggestions/info appreciated! Jeff Battershall Application Architect Dow Jones Indexes [EMAIL PROTECTED] (609) 520-5637 (p) (484) 477-9900 (c)
[flexcoders] Re: Updating Properties of a Component's Root State
Thanks for the idea! I'll test this myself but seems like this is a solution for modifying an explicitly defined state property rather than the default state... I've also been experimenting with manually setting some properties of the move transition that is responsible for sending the component back to it's original location. --- In flexcoders@yahoogroups.com, Peter Hall [EMAIL PROTECTED] wrote: Give an id to each state override that you need to modify. e.g.: mx:State name=newState mx:SetProperty id=setXOverride target={obj} name=x value=10 / /mx:State Then you can do: setXOverride.value = 100; Peter On Nov 20, 2007 11:40 PM, jandersen1978 [EMAIL PROTECTED] wrote: I've got a component that moves to the center of the screen with a state transition. Normally when it leaves this centered state it should go back to it's original x/y location... However, based on other application conditions I sometimes want it to move to a different location when it leaves the centered state. How can I update the root/default state while the component is centered so that it will move to a new location when it exits the centered state?
[flexcoders] Re: Determining textHeight and textWidth when htmlText contains images...
Hmmm... yeah, I actually did create such a button and while the images had clearly loaded and were displayed the textHeight still didn't take them into account... I also tried getting an actual reference to the sprite representing the img tag within the html using the getImageReference method of the textArea's textField member. The height and width of the sprite were way larger than the actual height and width of the image for some reason... not sure why. Unless anyone has any other ideas I think I'll resort to regular expressions to parse through img tags and just use mx:Image... (In my particular use case I'm either getting a single image link or some text so that will do for me...). Alex I appreciate the help so far. -James --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Never actually tried it with images. It might take several callLaters depending on when the image arrives. I usually test this out by adding a button that prints out the textWidth/Height after I can see the final appearance. If it works then, then I know it is a matter of figuring out how long to wait. Otherwise, some other solution is needed. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jandersen1978 Sent: Tuesday, November 20, 2007 6:08 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Determining textHeight and textWidth when htmlText contains images... Alex, I appreciate the guidance! I've tried using callLater and it does seem to help for text-only values of htmltext in a textarea. However, it still seems to ignore the size of any images regardless of when I validate and check the textHeight value... Do you know of an example I can refer to? Thanks! -James --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Alex Harui aharui@ wrote: No, I let it finish the layout at its current shape, then ask for the dimensions in a callLater. Invalidating probably won't help. Then if you need to adjust, change the size and go through the whole sequence again. From: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com ] On Behalf Of jandersen1978 Sent: Tuesday, November 20, 2007 1:12 PM To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com Subject: [flexcoders] Re: Determining textHeight and textWidth when htmlText contains images... So are you thinking of using callLater from within a creation complete handler that would then call invalidateSize which would kick off the measure method which would then have the appropriate textHeight available? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui aharui@ wrote: I use callLater to check after the control has rendered. From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of jandersen1978 Sent: Monday, November 19, 2007 8:53 PM To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Determining textHeight and textWidth when htmlText contains images... I'm trying to build a text component that will dynamically size its height based on the textHeight property after its htmlText property is set. However, it appears that the textHeight property doesn't include the height of images loaded into the component. e.g. comparing the textHeight of components displaying a string of HTML--one with an image and the other without--yields the same values... Anyone know how to reliable guage how large the content of a text component is when using htmlText with images? Thanks! --James
[flexcoders] Re: Determining textHeight and textWidth when htmlText contains images...
So are you thinking of using callLater from within a creation complete handler that would then call invalidateSize which would kick off the measure method which would then have the appropriate textHeight available? --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I use callLater to check after the control has rendered. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jandersen1978 Sent: Monday, November 19, 2007 8:53 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Determining textHeight and textWidth when htmlText contains images... I'm trying to build a text component that will dynamically size its height based on the textHeight property after its htmlText property is set. However, it appears that the textHeight property doesn't include the height of images loaded into the component. e.g. comparing the textHeight of components displaying a string of HTML--one with an image and the other without--yields the same values... Anyone know how to reliable guage how large the content of a text component is when using htmlText with images? Thanks! --James
[flexcoders] Re: Determining textHeight and textWidth when htmlText contains images...
Alex, I appreciate the guidance! I've tried using callLater and it does seem to help for text-only values of htmltext in a textarea. However, it still seems to ignore the size of any images regardless of when I validate and check the textHeight value... Do you know of an example I can refer to? Thanks! -James --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: No, I let it finish the layout at its current shape, then ask for the dimensions in a callLater. Invalidating probably won't help. Then if you need to adjust, change the size and go through the whole sequence again. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jandersen1978 Sent: Tuesday, November 20, 2007 1:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Determining textHeight and textWidth when htmlText contains images... So are you thinking of using callLater from within a creation complete handler that would then call invalidateSize which would kick off the measure method which would then have the appropriate textHeight available? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui aharui@ wrote: I use callLater to check after the control has rendered. From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of jandersen1978 Sent: Monday, November 19, 2007 8:53 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Determining textHeight and textWidth when htmlText contains images... I'm trying to build a text component that will dynamically size its height based on the textHeight property after its htmlText property is set. However, it appears that the textHeight property doesn't include the height of images loaded into the component. e.g. comparing the textHeight of components displaying a string of HTML--one with an image and the other without--yields the same values... Anyone know how to reliable guage how large the content of a text component is when using htmlText with images? Thanks! --James
[flexcoders] Updating Properties of a Component's Root State
I've got a component that moves to the center of the screen with a state transition. Normally when it leaves this centered state it should go back to it's original x/y location... However, based on other application conditions I sometimes want it to move to a different location when it leaves the centered state. How can I update the root/default state while the component is centered so that it will move to a new location when it exits the centered state?
[flexcoders] Re: variableRowHeight=true in List messing up height of last row
Alex, Thanks for the suggestion! I've still on the learning curve for custom actionscript components and haven't used the TextField class a whole lot but did manage to cobble this together which seems to have solved my initial problem. (Now I've got some others to deal with... the widths are behaving strangely... can't seem to get them to consistently take a certain percentage of the space...) If you have a moment, I'd love your input on whether this (particularly the measure method) is what you had in mind. Thanks! -James public class MessageRendererBase extends UIComponent implements IDataRenderer, IListItemRenderer { protected var _usr:TextField; protected var _msg:TextField; public function MessageRendererBase(){ } protected override function createChildren():void{ _usr = new TextField(); _usr.autoSize = TextFieldAutoSize.LEFT; _msg = new TextField(); _msg.autoSize = TextFieldAutoSize.LEFT; _msg.wordWrap = true; addChild(_usr); addChild(_msg); } protected override function commitProperties():void{ this.percentWidth = 100; } protected override function measure():void{ if(!isNaN(this.explicitWidth)){ _usr.width = Math.round(this.explicitWidth * .2); _msg.width = Math.round(this.explicitWidth * .8); } this.measuredWidth = _usr.width + _msg.width; this.measuredHeight = _msg.height; } protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ super.updateDisplayList(unscaledWidth, unscaledHeight); _msg.x = _usr.width; } --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I would override measure() and see what you're getting for the measuredHeight of the renderer. I'm guessing that it won't be right due to fact that flow-based text is hard to measure. A custom measure() routine would probably be better. Renderers have their explicitWidth set when they are measured and you'll need to use that to fix the widths of the text widgets to get an accurate height. If it were me, I'd use a UIComponent with two TextFields and a custom measure() method. -Alex blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jandersen1978 Sent: Saturday, September 08, 2007 9:44 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] variableRowHeight=true in List messing up height of last row I'm adding simple chat functionality to an application I'm working on and have the following List displaying messages: mx:List width=100% height=85% id=lstMessages itemRenderer=org.MessageRenderer variableRowHeight=true dataChange=handleDataChange(event) dataProvider={messages} /mx:List here's the event handler: private function handleDataChange(e:FlexEvent):void{ lstMessages.scrollToIndex(lstMessages.rowCount -1); } the MessageRenderer is as follows: mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml width=100% mx:Text text={data.fromName} width=20% id=lblUser color={data.color}/ mx:Text text={data.message} id=lblMessage width=80% color={data.color}/ /mx:HBox What I'm finding is that with variableRowHeight=true the last row in the List is always rendered with virtually no height such that none of the message text shows up. You can only see that it's there by mousing over it to see that it does display a few pixels of height (a border or padding perhaps?). When a new message is added, the previously squashed row displays normally and the new row is now vertically challenged. With variableRowHeight=false each row displays normally (except that text wrapping in the messsages doesn't work which is why I have it set to true in the first place...). I tried adding a call to lstMessages.invalidate() in handleDataChange but it had no effect. One other item of note--with only a single message in the list it seems to display OK. Any ideas?
[flexcoders] variableRowHeight=true in List messing up height of last row
I'm adding simple chat functionality to an application I'm working on and have the following List displaying messages: mx:List width=100% height=85% id=lstMessages itemRenderer=org.MessageRenderer variableRowHeight=true dataChange=handleDataChange(event) dataProvider={messages} /mx:List here's the event handler: private function handleDataChange(e:FlexEvent):void{ lstMessages.scrollToIndex(lstMessages.rowCount -1); } the MessageRenderer is as follows: mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100% mx:Text text={data.fromName} width=20% id=lblUser color={data.color}/ mx:Text text={data.message} id=lblMessage width=80% color={data.color}/ /mx:HBox What I'm finding is that with variableRowHeight=true the last row in the List is always rendered with virtually no height such that none of the message text shows up. You can only see that it's there by mousing over it to see that it does display a few pixels of height (a border or padding perhaps?). When a new message is added, the previously squashed row displays normally and the new row is now vertically challenged. With variableRowHeight=false each row displays normally (except that text wrapping in the messsages doesn't work which is why I have it set to true in the first place...). I tried adding a call to lstMessages.invalidate() in handleDataChange but it had no effect. One other item of note--with only a single message in the list it seems to display OK. Any ideas?
[flexcoders] Re: Flex 2 - Using removeChild/addChild to move children with removeEffect/addEf
I think I'm having a very similar problem... I'm visually moving the child of one component to be placed over another with a Move effect and then changing the parent from the source component to destination component in the EffectEvent.EFFECT_END handler. I'm getting very similar errors intermittently... Anyone have ideas? --- In flexcoders@yahoogroups.com, thunderstumpgesatwork [EMAIL PROTECTED] wrote: Hi guys, I'm trying to add an effect when changing the positioning (order) of some GridItems in a GridRow. In my move function, I remove the child, and add it back at a different index. This works fine with no effect, however if I have a removeEffect and addEffect, I get an error. If I comment out the line that adds the child back in, it works (to remove the child with the effect). When it trips the debugger on the error (see stack trace below), it thinks that there's one more child than there really is! (one more than the total number, not the number after one is removed) I even tried calling the addChild in a callLater(), but that didn't work either. Any ideas anyone? thanks, Thunder RangeError: Error #2006: The supplied index is out of bounds. at flash.display::DisplayObjectContainer/getChildAt() at mx.core::Container/getChildAt()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:2384] at mx.containers.utilityClasses::BoxLayout/measure()[C:\dev\GMC\sdk\frameworks\mx\containers\utilityClasses\BoxLayout.as:88] at mx.containers::Box/mx.containers:Box::measure()[C:\dev\GMC\sdk\frameworks\mx\containers\Box.as:250] at mx.core::UIComponent/mx.core:UIComponent::measureSizes()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:5360] at mx.core::UIComponent/validateSize()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:5306]
Re: [flexcoders]How do States and Transitions relate?
I'm no expert in states and transitions but as I understand it you define states if you want to add or remove children from a component, change properties etc. The transitions define any animations that take place going from one state to another. Just taking a quick look at your MXML below I'm not sure you want the AddChild, RemoveChild and SetProperty tags in your sequence tag. I believe only effect tags should go there... Might want to have another look at the documentation http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/ww help.htm?context=LiveDocs_Book_Partsfile=tutorial_states_022_6.html --- In flexcoders@yahoogroups.com, dorkie dork from dorktown [EMAIL PROTECTED] wrote: Hi All, I'm trying to understand how transitions relate to states and I don't really get it. I've been through the docs but it still is not clear to me. For example, what does the Action mean? Are transitions supposed to be some sort of ordering mechanism? I have taken some code from the documentation and modified it here: mx:states mx:State name=menuTop mx:SetProperty target={linkBarNav} name=visible value=false/ mx:SetProperty target={menu} name=y value=43/ mx:SetProperty target={linkBarNav} name=y value=- 1/ /mx:State /mx:states mx:transitions !-- Define the transition from the base state to the menuTop state.-- !-- I want to move menu and link bar up and then reveal linkbar. menu is visible all the time.-- mx:Transition id=menuTopTransition fromState=* toState=menuTop mx:Sequence targets={[menu, linkBarNav]} mx:RemoveChildAction/ mx:SetPropertyAction target={menu} name=visible/ mx:Move duration=300 targets={[menu, linkBarNav]}/ mx:WipeRight duration=200 target={linkBarNav}/ mx:AddChildAction/ /mx:Sequence /mx:Transition /mx:transitions
[flexcoders] Animation of Reparenting?
I'm working on a custom component that will have a cluster of circles around it (drawn with the graphics object). I'm going to have several instances of this component in my flex app and want to be able to animate the movement of a circle that is a child of one instance to another instance of a component. From a DOM perspective this circle will change parents from one instance of my component to another. I'm pretty new to flex and would really appreciate some guidance on how to animate (apply effects) to the reparenting of one of these circles from one instance of my custom component to another. Ideas? As I've thought about this, two possible solutions are coming to mind but since I'm a rookie, I'm not sure if either one will work. 1) Re-design the custom component so that these circles aren't actually children of the component but siblings on the same parent canvas. This way I don't have to reparent the circles just move them around... 2) Animate the movement of one child circle from one instance to a location near the destination instance then destroy the circle and create another in it's place but now as a child of the destination instance. Hope this makes sense!
[flexcoders] Short-circuiting logical operators in AS3?
I'm fairly new to AS3 coming from a javascript background. I noticed that I get an error when running the if statement below because dataProvider[i].data doesn't exist. if ( true || val == dataProvider[i].data) { selectedIndex = i; return; } In javascript the double OR operator (||) short-circuits such that it wouldn't evaluate the second part of the term in the if expression after finding the first term true. This doesn't seem to be the case with AS3. Does AS3 support short circuiting logical operator? Is there another way to get short-circuiting statements in AS3? (I know I could rewrite the If statement as a two nested ifs...) anything I'm missing as a newcomer? This is not a big deal of course, just curious...