RE: [flexcoders] can't make Zoom+Rotate work in Parallel
Jason, This is a common problem in Flash as well. The solution is to nest the object you want to scale within a parent object which you then rotate. Try this: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute backgroundColor=white mx:Button label=parallel click=parallel.play()/ mx:Button x=100 label=sequence click=sequence.play()/ mx:Button x=200 label=reset click=c.x=200; c.y=200; c.rotation=0; p.x=0; p.y=0; p.scaleX=1; p.scaleY=1;/ mx:Canvas id=c x=200 y=200 mx:Panel id=p width=100 height=100 x=0 y=0/ /mx:Canvas mx:Parallel id=parallel duration=200 mx:Rotate target={c} angleFrom=0 angleTo=90/ mx:Zoom target={p} zoomHeightTo=0.5 zoomWidthTo=0.5/ /mx:Parallel mx:Sequence id=sequence duration=200 mx:Rotate target={c} angleFrom=0 angleTo=90/ mx:Zoom target={p} zoomHeightTo=0.5 zoomWidthTo=0.5/ /mx:Sequence /mx:Application Regards, -Keith http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net
RE: [flexcoders] reading problem from local shared object
Gökhan, I hope this helps: Read.as private var myLSO:SharedObject; private var p_name:String; myLSO=SharedObject.getLocal(parameterCookie); // Was myLSO created? if (myLSO==null) { // myLSO was not created Alert.show(cannot create shared object ); }else{ // myLSO was created if(myLSO.data.name == undefined){ trace(myLSO.data.name is undefined) else{ p_name= myLSO.data.name; // dont know what the var p_uy is text_name.text = p_name; // p_uy ; } } Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/
RE: [flexcoders] textArea.setFocus();
Your application has to get focus before this will work. Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Wednesday, October 29, 2008 9:30 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] textArea.setFocus(); When I launch my application, if I do this: textArea.selectionBeginIndex=10; textArea.selectionEndIndex=20; textArea.setFocus(); Should it not put the cursor into the textArea and have the 10th through 20th characters selected? So that by default, if I put that in creationComplete, and they just start typing when the app loads, it starts to replace the 10th through 20th characters with what they type? As of right now, I do not see a cursor when I run. Any ideas?!
RE: [flexcoders] Re: textArea.setFocus();
Should it not put the cursor into the textArea and have the 10th through 20th characters selected? Even if you select a range of text with the mouse you will not see the blinking insertion cursor in the textarea. What matters is that your app has focus so that it can receive keyboard actions. So the trick is to come-up with some trivial task for the user to perform that forces them to click. Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Blake Barrett Sent: Wednesday, October 29, 2008 1:47 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: textArea.setFocus(); There is some JS you can run in the wrapper HTML that will give focus to the SWF, but it doesn't work in FF2 or Chrome. Blake _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of valdhor Sent: Wednesday, October 29, 2008 11:35 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: textArea.setFocus(); Unfortunately, you can't. The browser has focus until the user clicks on your app. BTW. Does anyone know if this is rectified with FP10? Or is it just something we have to live with from the browser vendors? --- In [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com, tchredeemed [EMAIL PROTECTED] wrote: Thanks guys, now I guess my problem is how to give the application focus without clicking on it? parentApplication.systemManager.activate() ? Not sure exactly where to go :)
RE: [flexcoders] Flex htmlText component
Give mx:Text condenseWhite=true a try. Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of brucewhealton Sent: Friday, October 31, 2008 4:46 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex htmlText component Hello all, I thought I could use the Accordion panel to nicely layout a collection of poems. The problem is getting the poetry to layout on the page right. I sure could use some tips on this. I have an Accordion wrapped in a Panel container. That's not the issue. The issue is the actual text block that holds the text of the poems. I have in mind either: mx:Text mx:text Line 1, Line 2... ... /mx:text /mx:Text or mx:Text mx:htmlText ![CDATA[ Line 1, Line 2... ...]] /mx:htmlText /mx:Text Neither of these really works so well. When you use the CDATA block, well, it counts every space, whereas regular html would ignore the extra spaces. Theoretically, this is doable but it would be very sloppy. I'd have to run it all together like this: Line 1br/Line 2br /Text for line 3br/.. Even that doesn't work because as soon as you hit the return key, that throws off the formatting and layout. Using the first option makes it impossible to have any control over how the lines break. Using the regular text tag runs everything together as a paragraph. So, far, as I thought of this, it seems that the only option is to put the text of the poem into an image. So, then I'd have inside each accordion panel an image or two images that contain the text of the poems (two images if I wanted two columns for the display of the poem. Can anyone think of anything else or any other ideas for this? I'm open to other suggestions for laying out a poem in Flex. I saw this FlexBook that gave me this idea. The FlexBook would take some time to accomplish so I thought I'd try something easier first as I'm still new and want to add to my skills and accomplishments in Flex. In that FlexBook, it seems that every page is an image. So, maybe that is how you have to layout pages of text when you want it to look just so. I do welcome suggestions as to how I might approach this. Thanks, Bruce Bruce Whealton
RE: [flexcoders] Re: SWFLoader: access its contents right away
You didn't see that one come through either, did you? It's a gmail thing. You won't receive you own posts. Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of lagos_tout Sent: Friday, October 31, 2008 3:45 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: SWFLoader: access its contents right away Wow, I messed up on that. Instead of -- //broadcast events that parent.swf can respond to. systemManager.dispatch(new Event(myChild)); use -- //broadcast events that parent.swf can respond to. systemManager.dispatch(new Event(myEventName)); --- In [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com, lagos_tout [EMAIL PROTECTED] wrote: Hi, I recently did something like this. But it was more complicated because I was loading a swf from a different domain from it's parent. I needed to attach an event handler to the swf when SWFLoader was done loading. Then at some point, the loaded swf would broadcast an event, and the parent swf would be able to respond. Contrary to what the last poster said, I think you should consider listening for the Event.INIT, not Event.Complete broadcast by your SWFLoader. To determine which one you need, check descriptions of these two events in the Flex 3 Language Reference. Here's the meat of it: INIT is broadcast when the properties and methods of a loaded SWF file are accessible. COMPLETE is broadcast when content loading is complete. So, if you need to be able to access child movie clips, I'd say use INIT. Here's some code. Please note that both parent and child are Flex applications, yielding parent.swf and child.swf. In parent.swf: mySwfLoader:SWFLoader = new SWFLoader(); mySwfLoader.addEventListener(Event.INIT, onInit); function onInit(event:Event):void { mySwfLoader.content.addEventListener(myEventName, onMyEventHandler); } function onMyEventHandler(event:Event):void { //do something } In child.swf: //broadcast events that parent.swf can respond to. systemManager.dispatch(new Event(myChild)); I found that when loading a Flex generated child.swf, mySwfLoader.content is a reference to the child.swf's systemManager property. So in order to broadcast events from my loaded swf, you needed to dispatch the event using the child application's systemManager property. Hence the last line of code. Hope that helps. LT --- In [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com, Alex Harui aharui@ wrote: The complete event tells you when the load is complete. All SWFLoader loads from the network are asynchronous. You'll always have to wait to access the data From: [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com [mailto:[EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of Ignasi Lirio Sent: Thursday, October 30, 2008 2:36 PM To: [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com Subject: [flexcoders] SWFLoader: access its contents right away Hi all, I am new in this group, so hello to everyone :-) I want to discuss here about SWFLoader component in Flex 3, and how to access their contents... programatically. Just for short: I have an existing, empty SWFLoader object in my MXML code. After some time, I just want to populate it using SWFLoader.load() method with an external SWF movie, that has child MovieClips inside. Right after call the .load() method, I am insterested (in the same function) to access its children to move positions, etc. So, if I do something like: var myloader:SWFLoader= this.swfload; and then myloader.load(shelf2.swf); and then myloader.content[s2].alpha=0.3; It does not work at all. I tried myloader.addEventListener(...) with several events, does not work. The only way was to put that myloader.content[s2].alpha... inside a setTimeout function, to allow SWFLoader to take some time to load. But you agree with me that this is so dirty. any ideas? Thanks to everyone!
RE: [flexcoders] textArea's that are limited by the amount of lines
tchredeemed, The custom component extending TextArea is a great idea. Just get rid of the Boolean and the key events. Use the change event with the function I posted in the original thread and handle everything within the custom component. Regards, -Keith http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net
RE: [flexcoders] Re: TextFormat being reset?
What TextField? Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Tuesday, November 18, 2008 8:17 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: TextFormat being reset? Anyone?? :) --- In [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com, tchredeemed [EMAIL PROTECTED] wrote: I have created my own CanvasStack (to replace the viewstack) because viewstacks and models do not mix. ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml creationComplete=initApp() height=100% horizontalScrollPolicy=off verticalScrollPolicy=off mx:Metadata [Event(name=changeSelectedIndex,type=flash.events.Event)] /mx:Metadata mx:Script ![CDATA[ import com.gladhandle.AppGlobals; import com.gladhandle.handles.greeting_card.gcassets.Editor; [Bindable] private var _selectedIndex:int; public var dataProvider:Array; private function initApp():void { _selectedIndex = 0; addChild( dataProvider[_selectedIndex] ); } public function set selectedIndex( selectedIndex:int ):void { if( selectedIndex 0 || selectedIndex dataProvider.length ) { throw new Error( selectedIndex out of range ); return; } _selectedIndex = selectedIndex; dispatchEvent( new Event( changeSelectedIndex, false ) ); this.removeAllChildren(); this.addChild( dataProvider[_selectedIndex] ); } [Bindable] public function get selectedIndex():int { return _selectedIndex; } ]] /mx:Script /mx:Canvas --- This dataprovider is populated with custom components as well. When I change the selected index, it removes all the children (but they still exist in the dataprovider, so 'session' data should be saved), but when I navigate back to an index I have already visited, everything is still there, EXCEPT for the format of the text, it for some reason, is reset back to the original text, even though I have setTextFormat() and set the defaultTextFormat on the TextField. Any ideas?
RE: [flexcoders] Flex TextArea Limited by number of lines.
Yup, same poster. Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Wednesday, December 03, 2008 2:34 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Flex TextArea Limited by number of lines. There was a thread on this in the past month or two From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Wednesday, December 03, 2008 7:09 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex TextArea Limited by number of lines. Has anyone ever done this? Seen any tutorials on this? It seems that a good amount of people would want something like this. I keep running into issues with it, and it is very frustrating!
RE: [flexcoders] Flex TextArea Limited by number of lines.
My approach is to simply reject any change that would exceed the maxLines setting. The following is presented sans the requisite class structure. Create a component that extends TextArea, then: var tf:TextField = TextField(this.textField); var maxLines:uint = 5; // however many lines (getter/setter) var storedInput:String = ; private function onChange(event:Event):void { if (tf.numLines maxLines) { tf.text = storedInput; }else{ // Handle editable TextArea bugs storedInput = tf.text; } } Issues: There is a bug in the TextArea component (editable=true) where any given line will fail to wrap so long as the last character in the line is a space (also, the insertion cursor disappears beyond the right edge of the field.) But this can be managed. Using htmlText just makes a mess (the insertion cursor has a mind of its own.) Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gordon Smith Sent: Wednesday, December 03, 2008 7:27 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Flex TextArea Limited by number of lines. This hasn't been a common request. What is your use case for allowing a user to type up to, say, three lines but no more? Most UIs I've seen limit the number of characters you can type, not the number of lines. I think you have two choices: use the 'textInput' event to limit the amount of text that goes in, or use the 'change' event to remove excess text that has already gone in. Which are you trying, and what problems are you running into? Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Wednesday, December 03, 2008 7:09 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex TextArea Limited by number of lines. Has anyone ever done this? Seen any tutorials on this? It seems that a good amount of people would want something like this. I keep running into issues with it, and it is very frustrating! attachment: winmail.dat
RE: [flexcoders] Change Timezone
Pratik, I would like to know if there is any way to dynamically change the timezone in flex. Not literally, no. Say suppose we have local time and few check boxes to see time in other timezones. When you check and uncheck the check box the time changes according to the selected timezone. This would not depend on the location of the persons timezone. So persons local timezone may be PST but he wants to see the data in EST. To calculate the time elsewhere you have to factor-in the local machine's timezone offset value. I worked out the following for my World Clock last year: snip // Local Time var lDate:Date = new Date(); // Elsewhere Time var utcH:Number = -8;// New York: EST var utcM:Number = 0; var wDate:Date = new Date(lDate.getTime() + (lDate.getTimezoneOffset() * 1000 * 60) + (utcH * 1000 * 60 * 60) + (utcM * 1000 * 60)); trace(wDate = +wDate); /snip Note: The GMT value in the trace will still reflect the local machine's timezone. Just ignore it. The important data are the time and date. Going forward you will want to consider the issues presented by Daylight Saving Time: Does the locale of the local machine observe DST? Is the locale of the local machine currently in DST? Do they observe DST in the designated Elsewhere? Is the designated Elsewhere currently in DST? Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pratikshah83 Sent: Tuesday, December 09, 2008 7:15 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Change Timezone Hi Guys, I would like to know if there is any way to dynamically change the timezone in flex. Say suppose we have local time and few check boxes to see time in other timezones. When you check and uncheck the check box the time changes according to the selected timezone. This would not depend on the location of the persons timezone. So persons local timezone may be PST but he wants to see the data in EST. There is the timezoneoffset method but that just gives you the offset of local timezone with respect to UTC. I hope my issue is clear. Any help would be appreciated. Thanks Pratik attachment: winmail.dat
RE: [flexcoders] Change Timezone
Whoops, sorry. Should have been: var utcH:Number = -5;// New York: EST Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Keith Reinfeld Sent: Wednesday, December 10, 2008 1:07 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Change Timezone Pratik, I would like to know if there is any way to dynamically change the timezone in flex. Not literally, no. Say suppose we have local time and few check boxes to see time in other timezones. When you check and uncheck the check box the time changes according to the selected timezone. This would not depend on the location of the persons timezone. So persons local timezone may be PST but he wants to see the data in EST. To calculate the time elsewhere you have to factor-in the local machine's timezone offset value. I worked out the following for my World Clock last year: snip // Local Time var lDate:Date = new Date(); // Elsewhere Time var utcH:Number = -8;// New York: EST var utcM:Number = 0; var wDate:Date = new Date(lDate.getTime() + (lDate.getTimezoneOffset() * 1000 * 60) + (utcH * 1000 * 60 * 60) + (utcM * 1000 * 60)); trace(wDate = +wDate); /snip Note: The GMT value in the trace will still reflect the local machine's timezone. Just ignore it. The important data are the time and date. Going forward you will want to consider the issues presented by Daylight Saving Time: Does the locale of the local machine observe DST? Is the locale of the local machine currently in DST? Do they observe DST in the designated Elsewhere? Is the designated Elsewhere currently in DST? Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pratikshah83 Sent: Tuesday, December 09, 2008 7:15 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Change Timezone Hi Guys, I would like to know if there is any way to dynamically change the timezone in flex. Say suppose we have local time and few check boxes to see time in other timezones. When you check and uncheck the check box the time changes according to the selected timezone. This would not depend on the location of the persons timezone. So persons local timezone may be PST but he wants to see the data in EST. There is the timezoneoffset method but that just gives you the offset of local timezone with respect to UTC. I hope my issue is clear. Any help would be appreciated. Thanks Pratik attachment: winmail.dat
RE: [flexcoders] mailto from textarea in AIR application - line breaks fail in windows
Have you tried: escape(body) ? Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of cedar.rabbit Sent: Monday, December 22, 2008 11:56 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] mailto from textarea in AIR application - line breaks fail in windows I have an AIR app that needs to open and pre-populate an email in the user's default email application. This is not difficult, see the application code I've provided at the end of this post. When you build this AIR app and run it on a mac, it works fine - any carriage returns you typed in the text area are displayed properly in apple mail and other mac email clients. When you build this AIR app and run it on a pc, it fails. Only the text before the first carriage return is displayed. I have tried the following: 1. forcing word wrapping in the text area 2. replacing new lines in the text (\n) with a windows return and new line (\r\n) using this regular expression: /\r\n/gm; Any ideas or suggestions would be greatly appreciated! Thanks ?xml version=1.0 encoding=utf-8? mx:WindowedApplication xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml layout=absolute width=800 height=600 backgroundColor=white mx:Script ![CDATA[ import flash.net.navigateToURL; private function onSend():void { var address:String = address; var subject:String = subject; var body:String = ta.text; var sendURL:URLRequest = new URLRequest(mailto:+address+;? subject=+subject+body=+body); navigateToURL(sendURL); } ]] /mx:Script mx:VBox width=100% height=100% mx:TextArea id=ta width=100% height=100%/ mx:Button label=Send verticalCenter=0 horizontalCenter=0 click=onSend()/ /mx:VBox /mx:WindowedApplication
RE: [flexcoders] Re: Resizing Images.
Not sure what I am looking at... Is the 'good image' the original or a successful manipulation? If you are scaling up from a smaller image then you are almost sure to get 'jaggies', especially on diagonal lines. Smoothing can help to minimize jaggies but can't be relied upon to completely eliminate them. Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of tchredeemed Sent: Friday, January 02, 2009 1:11 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Resizing Images. To see what I am talking about... look at - http://www.andrewthorp.com/flexsmoothing/ attachment: winmail.dat
RE: [flexcoders] Hint text input?
Try searching on 'Input Prompt' Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Osman Ullah Sent: Wednesday, February 25, 2009 9:57 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Hint text input? Does anyone know if there is a freely available input component which offers hint text? By hint text, I mean some text that shows up in the input field only when it is empty and not in focus. I'm sure someone has done this but I must not be using the proper terminology because I can't find anything.
RE: [flexcoders] How to detect when word wrap has occurred?
Rohit, Have you looked at the AS3 TextField numLines property and the TextField getLineText(index) method? Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of rohit_sharma1982 Sent: Friday, May 15, 2009 6:50 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to detect when word wrap has occurred? Hi, I am facing the following problem and am not being able to solve it. In my chat application I have to show my message in the text area as following:- message:sender If the message consists of single line everything works fine. For a message which exceeds the width of the text area component, I want it to be shown like this :- part of message : sender remaining message.. I was thinking if I could get the width of the text after which word wrap will occur and then check my incoming messages against that width. I was trying to use the mx_internal namespace and then use textfield. Or if I can detect the word wrap event and find out when the breaking is happening? Please help. Thanks, Rohit
RE: [flexcoders] Display Server Time
displayTime = startTime_Server + (currentTime_Client - startTime_Client); Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of yogesh patel Sent: Thursday, June 18, 2009 7:59 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Display Server Time I want to display server time on front end.i am creating Date object through string returning from server side and i have used timer with 1 second interval and updating the clock ,but it shows some seconds delay after some time because timer goes slow down .How to avoid this delay of seconds? _ Cricket on your mind? Visit the ultimate cricket website. Enter http://in.rd.yahoo.com/tagline_cricket_1/*http:/cricket.yahoo.com now!
RE: [flexcoders] how do I set the default value for an array in a function definition?
myArray:Array = null Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of luvfotography Sent: Wednesday, June 24, 2009 3:41 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] how do I set the default value for an array in a function definition? How do I make the array parameter optional?? private function howdoI(mycount:int,mystring:String, myArray:Array = []):void { trace('hellow'); } I get 1047: Parameter initializer unknown or is not a compile-time constant. How do I make the Array parameter optional? : myArray:Array = [] thanks,
RE: [flexcoders] variables name are in array
Because arrName.length == 0, perhaps? Try: for(var i:int = 0; arrValue.length; i++) { arrName[i] = arrValue[i]; } Regards, -Keith http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of markflex2007 Sent: Tuesday, July 21, 2009 3:57 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] variables name are in array I use a array to save variable names and other to save values,but why the following code doesn't work.please give me a idea. for(var i:int = 0;arrName.length; i++) { arrName[i] = arrValue[i]; } Thanks a lot. Mark
RE: [flexcoders] Re: XMLFiltering by attributes and values
This works well: var _trackData:XML = track item uniqueTrackId=100 albumId=12 trackId=1 genreId=13 artistId=6584/ item uniqueTrackId=101 albumId=13 trackId=2 genreId=14 artistId=6580/ item uniqueTrackId=102 albumId=14 trackId=3 genreId=15 artistId=6584/ item uniqueTrackId=103 albumId=15 trackId=4 genreId=16 artistId=6583/ /track; function doXMLFilter(nodes:XML,att:String,val:String):XMLList{ // Returns all node elements with an attribute that equals value. return nodes.elements(*).(@[att.toString()] == val); } var _data:XMLList = doXMLFilter(_trackData,artistId,6584); trace(_data.toXMLString()); - Keith From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of valdhor Sent: Monday, August 17, 2009 11:15 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: XMLFiltering by attributes and values I haven't looked at your code too much but what jumped out at me is this line... filterData = filterData.(attribute(prop.name) == prop.value); This will try to evaluate attribute as a function with parameter prop.name and then compare that to prop.value returning a boolean. So, the upshot is that Flex will try to evaluate filterData.true or filterData.false. I'm pretty sure that won't work. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , fatmanchan2009 fatmanchan2...@... wrote: Hello Can anyone figure out this problem im currently having, and explain the reasons and cause of this proplem. I have an XML file of track data with a bunch of attributes track item uniqueTrackId=100 albumId=12 trackId=1 genreId=13 artistId=6584 ... /track i use this code to execute the filtering on the data, the name is artistId and the value is 6584, so the data should come back with all the artists with artistId 6584. var filterData : XMLList = _trackData.item; for each (var prop : Object in _propertiesList) { filterData = filterData.(attribute(prop.name) == prop.value); } but i keep getting this exception, when its applyin the filter, so within the for loop TypeError: Error #1006: value is not a function. So anyone that can figure what the problem is, would be a big help Thank You Stephen Chan image001.jpgimage002.jpg
RE: [flexcoders] Re: XMLFiltering by attributes and values
That comment should read: // Returns all node elements with the named attribute that equals value. - Keith From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Keith Reinfeld Sent: Monday, August 17, 2009 1:15 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: XMLFiltering by attributes and values This works well: var _trackData:XML = track item uniqueTrackId=100 albumId=12 trackId=1 genreId=13 artistId=6584/ item uniqueTrackId=101 albumId=13 trackId=2 genreId=14 artistId=6580/ item uniqueTrackId=102 albumId=14 trackId=3 genreId=15 artistId=6584/ item uniqueTrackId=103 albumId=15 trackId=4 genreId=16 artistId=6583/ /track; function doXMLFilter(nodes:XML,att:String,val:String):XMLList{ // Returns all node elements with an attribute that equals value. return nodes.elements(*).(@[att.toString()] == val); } var _data:XMLList = doXMLFilter(_trackData,artistId,6584); trace(_data.toXMLString()); - Keith From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of valdhor Sent: Monday, August 17, 2009 11:15 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: XMLFiltering by attributes and values I haven't looked at your code too much but what jumped out at me is this line... filterData = filterData.(attribute(prop.name) == prop.value); This will try to evaluate attribute as a function with parameter prop.name and then compare that to prop.value returning a boolean. So, the upshot is that Flex will try to evaluate filterData.true or filterData.false. I'm pretty sure that won't work. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , fatmanchan2009 fatmanchan2...@... wrote: Hello Can anyone figure out this problem im currently having, and explain the reasons and cause of this proplem. I have an XML file of track data with a bunch of attributes track item uniqueTrackId=100 albumId=12 trackId=1 genreId=13 artistId=6584 ... /track i use this code to execute the filtering on the data, the name is artistId and the value is 6584, so the data should come back with all the artists with artistId 6584. var filterData : XMLList = _trackData.item; for each (var prop : Object in _propertiesList) { filterData = filterData.(attribute(prop.name) == prop.value); } but i keep getting this exception, when its applyin the filter, so within the for loop TypeError: Error #1006: value is not a function. So anyone that can figure what the problem is, would be a big help Thank You Stephen Chan image001.jpgimage002.jpg
RE: [flexcoders] Actionscript error : RangeError: Index '2' specified is out of bounds.
Because 1 will always be less than attendeelist.length so i just keeps going up. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of kpjj31 Sent: Monday, September 28, 2009 9:05 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Actionscript error : RangeError: Index '2' specified is out of bounds. Would anybody be able to tell me why I am getting this actionscript error when looping through an arraycollection. attendeelist = new ArrayCollection(event.result.ATTENDEELIST as Array); length is 3 setting selectedindex based on profileid match var index:int =-1; for (var i:int = 0; 1 attendeelist.length; i++) { if (attendeelist.getItemAt(i).PROFILEID == setprofileid) { index = i; break; } } image001.jpgimage002.jpg
RE: [flexcoders] Text lines
Have you looked at the TextField methods? Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of cuttenv Sent: Thursday, October 01, 2009 5:47 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Text lines Anyone know how to get each individual line of text in a textarea or text?? For example if you have some block of text like this is there a way to get each individual line?? There is the getTextLineMetirics which tells you the dimensions, but I guess that's it?? image001.jpgimage002.jpg
RE: [flexcoders] Comparing Dates: ObjectUtil.dateCompare not working
ObjectUtil.dateCompare() function does account for the time portion of the supplied dates. According to the scenario you describe ObjectUtil.dateCompare() function never sees the time portion of date_A nor date_B. The DateField.stringToDate() method only evaluates the -MM-DD portion of the supplied date string and ignores/strips off the time portion of the date. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of powers Sent: Monday, November 16, 2009 2:29 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Comparing Dates: ObjectUtil.dateCompare not working I'm writing a sort compare function to sort by date. The date format is -MM-DD HH:NN:SS. I'm converting the dates, in a string format, to a Date objects like so: DateField.stringToDate(date_A '-MM-DD HH:NN:SS'); DateField.stringToDate(date_B '-MM-DD HH:NN:SS'); Then comparing the dates like this: ObjectUtil.dateCompare(date_A, date_B) It always returns 0 when the date portion of the two date objects are equal, but the times are different. Does the ObjectUtil.dateCompare function not account for the time? -- View this message in context: http://old.nabble.com/Comparing-Dates%3A-ObjectUtil.dateCompare-not-working- tp26378917p26378917.html Sent from the FlexCoders mailing list archive at Nabble.com. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.425 / Virus Database: 270.14.67/2506 - Release Date: 11/16/09 07:43:00 image001.jpgimage002.jpg
RE: [flexcoders] Comparing Dates: ObjectUtil.dateCompare not working
You could use new Date(dateStr); However, if the date string contains hyphens it will be invalid and fail. If the hyphens in the date string are not under your control then you can swap them out for nice valid forward slashes: var dateStr:String = 2012-11-21 11:11:00; dateStr = dateStr.split(-).join(/); var doomsDay:Date = new Date(dateStr); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of powers Sent: Tuesday, November 17, 2009 1:58 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Comparing Dates: ObjectUtil.dateCompare not working @Keith What would you recommend to use instead of DateField.stringToDate to parse a string into a date object so that it doesn't strip off the time portion? Date.parse does not correctly parse a date when the string is formatted as -MM-DD HH:NN:SS. Keith Reinfeld wrote: ObjectUtil.dateCompare() function does account for the time portion of the supplied dates. According to the scenario you describe ObjectUtil.dateCompare() function never sees the time portion of date_A nor date_B. The DateField.stringToDate() method only evaluates the -MM-DD portion of the supplied date string and ignores/strips off the time portion of the date. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of powers Sent: Monday, November 16, 2009 2:29 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Comparing Dates: ObjectUtil.dateCompare not working I'm writing a sort compare function to sort by date. The date format is -MM-DD HH:NN:SS. I'm converting the dates, in a string format, to a Date objects like so: DateField.stringToDate(date_A '-MM-DD HH:NN:SS'); DateField.stringToDate(date_B '-MM-DD HH:NN:SS'); Then comparing the dates like this: ObjectUtil.dateCompare(date_A, date_B) It always returns 0 when the date portion of the two date objects are equal, but the times are different. Does the ObjectUtil.dateCompare function not account for the time? -- View this message in context: http://old.nabble.com/Comparing-Dates%3A-ObjectUtil.dateCompare-not-working- tp26378917p26378917.html Sent from the FlexCoders mailing list archive at Nabble.com. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.425 / Virus Database: 270.14.67/2506 - Release Date: 11/16/09 07:43:00 -- View this message in context: http://old.nabble.com/Comparing-Dates%3A-ObjectUtil.dateCompare-not-working- tp26378917p26396451.html Sent from the FlexCoders mailing list archive at Nabble.com. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.425 / Virus Database: 270.14.68/2507 - Release Date: 11/17/09 07:40:00 image001.jpgimage002.jpg
RE: [flexcoders] Re: Changing the speed of sound?
SampleDataEvent Here is an example: http://www.kelvinluck.com/tag/sourcecode/ HTH Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Nick Middleweek Sent: Thursday, February 25, 2010 2:31 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Changing the speed of sound? Thanks James, I'll have a read of that link. Where did you get the java code from? Cheers, nick On 25 February 2010 00:27, jamesfin james.alan.finni...@gmail.com wrote: Hi Nick, This will get ugly quickly as this isn't as easy as it sounds, pardon the pun. ;) You need to do some pitch-shifting to the audio stream before sending it along to play. Here's a good discussion on it http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/ Here's a working java sample which you might want to play with before porting it over to as3 unless you want to just convert prior to streaming http://www.mediafire.com/?ze3mymjguim Let us know what you end up doing as this could be a nice AS3 component. Thx, james No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2708 - Release Date: 02/24/10 13:34:00 image001.jpgimage002.jpg
RE: [flexcoders] Make a Timer's first timeout event immediate
If I understand you correctly: import flash.utils.Timer; import flash.events.TimerEvent; var _timer:Timer = new Timer(1000, 10); _timer.addEventListener(TimerEvent.TIMER, onTimer, false, 0, true); _timer.start(); onTimer(); function onTimer(e:TimerEvent = null):void { // do stuff if(e != null){ trace(\nonTimer() called by _timer event::,e.currentTarget.currentCount); if(e.currentTarget.currentCount == e.currentTarget.repeatCount){ e.currentTarget.removeEventListener(TimerEvent.TIMER, onTimer); } }else{ trace(\nonTimer() NOT called by _timer event); } } // Or var _timer2:Timer = new Timer(1000, 10); _timer2.addEventListener(TimerEvent.TIMER, onTimer2, false, 0, true); _timer2.start(); executeOnTimer(NOT from onTimer2()); function onTimer2(e:TimerEvent):void { trace(\nonTimer2() called); executeOnTimer(from onTimer2()); if(e.currentTarget.currentCount == e.currentTarget.repeatCount){ e.currentTarget.removeEventListener(TimerEvent.TIMER, onTimer2); } } function executeOnTimer(s:String):void{ trace(executeOnTimer() called::, s); // do stuff } HTH Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net
RE: [flexcoders] Trim from the left till it finds the last '/'
var Filename:String = urlStr.substr(urlStr.lastIndexOf(/), urlStr.length); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Wally Kolcz Sent: Monday, March 22, 2010 10:20 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Trim from the left till it finds the last '/' I am trying to trim down a url path to just the stuff after the last '/' character. It changes from time to time so I cannot just replace base URL path and just keep the difference at the end. How can I do this in AS3: Turn these: /com/mysite/views/app1/app.swf /com/mysite/view/otherapp/app2.swf Into just these: app.swf app2.swf Thanks if you can help! image001.jpgimage002.jpg
RE: [flexcoders] Trim from the left till it finds the last '/'
One minor correction: var filename:String = urlStr2.substr(urlStr2.lastIndexOf(/)+1, urlStr2.length); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Keith Reinfeld Sent: Monday, March 22, 2010 10:36 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Trim from the left till it finds the last '/' var Filename:String = urlStr.substr(urlStr.lastIndexOf(/), urlStr.length); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net http://keithreinfeld.home.comcast.net/ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Wally Kolcz Sent: Monday, March 22, 2010 10:20 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Trim from the left till it finds the last '/' I am trying to trim down a url path to just the stuff after the last '/' character. It changes from time to time so I cannot just replace base URL path and just keep the difference at the end. How can I do this in AS3: Turn these: /com/mysite/views/app1/app.swf /com/mysite/view/otherapp/app2.swf Into just these: app.swf app2.swf Thanks if you can help! image001.jpgimage002.jpg
RE: [flexcoders] TimeZone issue
Ivan, Is there any way we can get the Timezone selected by the user in the operating system from running Flex application? The short answer is no. 720 minutes after UTC can mean Auckland, Wellington or Fiji The above is only true when Auckland, Wellington is not on Daylight Saving Time (DST,) -- since Fiji does not observe DST, and that, I suspect, is the real issue. You can use getTimezoneOffset() to calculate many of the DST details of the client machine. For example: */ // Test for local DST public function hasLocalDST():Boolean{ var y:Number = new Date().getFullYear(); var s:Number = new Date(y, 0).getTimezoneOffset(); var e:Number = new Date(y, 5).getTimezoneOffset(); if(s != e){ // DST is observed return true; }else{ // DST is not observed return false; } } Similarly, for locales that observe DST, you can work out exactly when DST starts and ends, whether the locale is in the Northern or Southern hemisphere, and whether the locale is currently on DST. All assuming, of course, that the client machine's time settings are correct for the locale. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net
RE: [flexcoders] How to split a String on spaces but including Quoted Phrases?
Nick, I think this satisfies your conditions. There is a for-loop but it's not iterating over the entire string, which, I'm certain, is what you wanted to avoid. var myString:String = 'flex action script parse string function'; var resultArr:Array = regExpDQ(myString, false); trace(resultArr = ,resultArr); function regExpDQ(s:String, includeQuotes:Boolean):Array { var re:RegExp = /.*?/g; // get string segments contained in double-quotes var matchArr:Array = s.match(re); // strip out string segments contained in double-quotes s = s.split(re).join(''); // put the remaining string segments into an array var arr:Array = s.split(' '); // merge the two arrays var len:uint = arr.length; var a:Array = []; var j:uint = 0; for(var i:uint = 0; i len; i++) { if(arr[i] != ){ a[i] = arr[i]; }else{ if(includeQuotes){ a[i] = matchArr[j++]; }else{ a[i] = matchArr[j++].split('').join(); } } } return a; } Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Nick Middleweek Sent: Wednesday, July 28, 2010 12:20 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to split a String on spaces but including Quoted Phrases? Hi, I haven't been able to work out regex yet so apart from looping and parsing a string manually, is there anyway of parsing the following string... flex action script parse string function into the following Array... [0] = flex [1] = action script [2] = parse [3] = string [4] = function Thanks, Nick image001.jpgimage002.jpg
RE: [flexcoders] How to remove some a string till a particular character
var result:String = myString.substr(myString.lastIndexOf('/')+1); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Wally Kolcz Sent: Sunday, August 15, 2010 8:37 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to remove some a string till a particular character How can I start at the end of a string, move to the left till the first '/' and extract the value of what was after that first character? I am looking for these: com/wallykolcz/views/portal/AdminPortal.swf would equal AdminPortal.swf com/wallykolcz/views/myVoice/MyVoice.swf would equal MyVoice.swf com/wallykolcz/views/windowhome/WindowHome.swf would equal WindowHome.swf Thanks! image001.jpgimage002.jpg
RE: [flexcoders] Basic question about copying bitmap Data to a display object.
matrix=new Matrix() matrix.scale(img.width/_bitmap.width) img.graphics.clear() img.graphics.beginBitmapFill(_bitmap,matrix,false,false) img.graphics.drawRect(0,0,img.width,400) img.graphics.endFill Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of atlantageek Sent: Friday, August 20, 2010 9:54 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Basic question about copying bitmap Data to a display object. Currently I am copying bitmap data to an image using matrix=new Matrix() matrix.scale(img.width/_bitmap.width) img.graphics.beginBitmapFill(_bitmap,matrix,false,false) img.graphics.drawRect(0,0,img.width,400) img.graphics.endFill any suggestions. This is a update that happens several times a second. It gets slower over time. image001.jpgimage002.jpg
RE: [flexcoders] Loading Images into a loaded SWF
Once your SWF is loaded the path is relative to your Air app. Place a copy of your media folder and its contents accordingly. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net/ http://keithreinfeld.home.comcast.net
RE: [flexcoders] Function from string?
Perhaps the following syntax will help: var func:String = yourFunctionName; this[func](); Regards, Keith Reinfeld From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of A. P. Damien Sent: Tuesday, November 05, 2013 10:48 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Function from string? I'm writing a game. Well, actually I guess it's more of a game engine. I want the game logic to be in a script. The script will take the form of a series of rooms, each of which can contain: . doors to other rooms . characters the player can interact with . things the player can pick up and use Any of these can have conditions on them. The condition can be expressed as: . Player must have (thing) in his inventory . Player must have at least X points . Player must have at least $Y money . Call function f That last seems to be a problem. I would like to be able to take a function name I've read from the script and call the corresponding function. Or, alternatively, the script can contain the name of a class which must contain a method named (for example) conditionTest. But I haven't figured out a way to convert a string to either a Function or a Class. Is there a way of doing this? If I were working in Javascript, I'd just call eval, but that seems to be forbidden in AS3, right? Can I do this? Or do I have to put all the functions I might want to call this way in an array, and look them up that way? Or what?
RE: [flexcoders] Function from string?
I would like to be able to take a function name I've read from the script and call the corresponding function. Hi A. P. Damien, As I understand it, you have existing functions which you want to call by passing the name of a function as a string to a generic method. By 'script' I take you to mean an external text source. public function makeTheCall(s:String):void{ //use try/catch to handle errors try { this[s](); } catch(e:ReferenceError) { //trace(s,e); } } Do I have to declare the class 'dynamic' for this trick to work? I don't think so. Or is it always legal to do this from inside the class? 'Always' is a tricky word. The functions you want to call need to be in the same Class in order for the 'this' keyword to work. The function's name and the function name string must be an exact match for case and spelling. Regards, Keith Reinfeld