flex3

Change A Character In A String Using Actionscript

扶醉桌前 提交于 2019-12-19 20:01:06
问题 What is the opposite of String.charAt() ?? If I Have a string: var Str:String="Hello World"; How do I change the 5th character, for example, from a ' ' to an '_'? I can GET the 5th character like this: var C:String=Str.charAt(5); But how do I SET the 5th character? Thanks in advance. 回答1: There are many ways to skin this cat. One, off the top of my head, would involve String.substr: var Str:String="Hello World" var newStr:String = Str.substr(0,5) + "_" + Str.substr(6); or, the same as above,

How do you programmatically move the caret of a Flex TextArea to the end?

荒凉一梦 提交于 2019-12-19 07:18:08
问题 I'm trying to move the caret in a Flex TextArea to the end after appending some text from my code. I've looked through the reference documentation for TextArea and its underlying TextField but it appears there is no method provided to handle this. One approach I've tried is to set focus to the text area and dispatch a KeyUp KeyboardEvent with the event's key code set to the "End" key, but this doesn't work. Any ideas on how to do this? Thanks. 回答1: Try this textArea.selectionBeginIndex =

Fastest way to delete one entry from the middle of Array()

谁说我不能喝 提交于 2019-12-18 03:04:17
问题 What is the fastest way to delete one specific entry from the middle of Array() Array is large one having Strings. I dont want just to set Array[5] = null, but instead array size should be reduced by one and array[5] should have content of array[6] etc. 回答1: Don't have any benchmarks to support this, but one would assume that the native Array.splice method would be the fastest... So, to remove the entry at index 5: array.splice(5, 1); 回答2: If you don't care about the order of the items in the

Howto embed images in Actionscript 3 / Flex 3 the right way?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 18:37:48
问题 I'm creating a game where a lot of images are being used in Actionscript / Flex 3 (Flash). Now that I've reached the designer stage, I have to work out a structural way of using embedded images (which have to be manipulated with rotation, color, etc.). Unfortunately, after investigating a bit, it looks like you have to manually embed images before you can use them. I currently have it setup like this: Resource.as class file: package { public final class Resource { [Embed (source="/assets

How can I get list of properties in an object in Actionscript?

喜欢而已 提交于 2019-12-17 18:14:10
问题 I have a dataprovider and a filterfunction for my array that's assigned to my dataprovider. How can I get a list of the properties that are in each row of the dataprovider (item.data) as it gets passed to the filterfunction? For instance, if my object contained: Object name email address Then I would want, in my filterfunction to be able to look at name, email and address. Unfortunately, I don't know what these properties will be before hand. Any ideas? 回答1: If it's a dynamic object I believe

What Flash player version is required by (simple) Flex 3 apps?

柔情痞子 提交于 2019-12-14 03:53:13
问题 What Flash player version is required by Flex 3 app ? Requirement seems to be HTML WRAPPER/ACTIONSCRIPT compiler setting inside FLEX development environment; what can I choose there to allow maximum compatibility with old flash players? Will v8 player work? 回答1: Flex is built upon ActionScript 3, and that was introduced in flash player 9 so V8 player would not work if you want to run flex 3 app on it. To run ActionScript 3 you need AVM 2 (Actionscript virtual machine), flash player v8 cotains

Flex 3: Key press combination to trigger an event/function

空扰寡人 提交于 2019-12-14 02:43:07
问题 Within a specific canvas, I would like a user to be able to press a combination of keys which will trigger an event.(a bit like a cheat in an old megadrive game). Not sure where to start though. Anyone know if it is possible and if so could you give me a clue with how to start? Thanks in advance! 回答1: You can add an eventListener to the top level application for the KeyboardEvent.KEY_DOWN event and check for key combinations there. From this article: <mx:Application xmlns:mx="http://www.adobe

Is it possible to call a function in a parent component from a child component in Flex?

南楼画角 提交于 2019-12-13 19:49:05
问题 I need to call a function located in the parent component and make the call from the child component in Flex 3. Is there a way to access functions in the parent component from the child component? I know I can dispatch an event in the child and add a listener in the parent to call the function, but just wanted to know if could also directly call a parent function from a child. Thanks 回答1: You can use parentApplication For example... if i have a main.mxml that calls a component we'll call

combobox which filters dataprovider based on user input

坚强是说给别人听的谎言 提交于 2019-12-13 09:23:15
问题 I need a combobox which filters dataprovider based on user input? For example if user input is "CA" combobox will filter the dataprovider and show only data which starts with "CA". ("CANADA" and "CALIFORNİA") note:combobox is editable. and ı need this combobox in flex 3. edit:okay ı got some help from javaluca and ı wrote this. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="createCompFonk()"> <mx:Script> <!

using RegExp to split string but store whitespace (space or crlf) to items

筅森魡賤 提交于 2019-12-13 04:17:19
问题 sample input (orgtext = a[crlf]b[space]c[crlf] ) I like to store each word a,b, c to the words array with the original suffix crlf or space. Currently calling SPLIT drops the suffix as its separator, but I like to store separator as well. Can I adjust regexp to return also suffix and still split? Words = new Array; var ar: Array = orgtext.split( /\s+/ ); for (var i:int = 0; i<ar.length;i++ ) { Words.push( ar[i] +"suffix here" ); } 回答1: Generally you would use keep calling exec with an