actionscript-3

I have RTRIM; how to make LTRIM with regexp

孤人 提交于 2019-12-25 01:47:06
问题 I have RTRIM; how to make LTRIM one? public static function rtrim(string:String):String { return string.replace(/\s+$/,""); } 回答1: Wow, seriously? You're using regular expressions to remove a constant sequence of characters from the ends of a string? Really? I don't know Actionscript/Flex, but this isn't the way to go. After a quick google I found a solution which may or may not be more efficient. 回答2: public static function ltrim(string:String):String { return string.replace(/^\s+/,""); }

youtube chromeless as3 player

北慕城南 提交于 2019-12-25 01:46:59
问题 I'm goofing around with the new youtube as3 API but got stuck. This is how far i got (from looking at their sample code). http://pastie.org/656088 public class Main extends Sprite { Security.allowDomain("*"); private var player:Object; private var loader:Loader; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); loader = new Loader(); loader

AS3: How to Deep Copy an Object

爷,独闯天下 提交于 2019-12-25 01:45:48
问题 i have an object that i need to copy to my SharedObject data. The problem is that the data property of shared object is read-only, so i can't clone my 'source' object and assign it to the shared object data, i have to make a copy of them in this way: var so: SharedObject = SharedObject.getLocal("appData"); copyObject(sourceObj, so.data); so.flush(); and the copy method: public static function copyObject(sourceObject:Object, destinationObject:Object):void{ // this would be the code that i need

DisplayObject snapshot in flex 3

此生再无相见时 提交于 2019-12-25 01:45:45
问题 i'm creating a visual editor in flex and need to let users export thier projects into Image format. But i have one problem: size of the canvas is fixed and when user add element which is out of these sizes some scroll bars added. And user continue working on the project. but when he want to take snapshot of the canvas he just get the visible part ot the canvas with scrollbars. how to get image of the fullsize canvas? The only solution i found is to check the positions and sizes of canvas

Flex: Why are TileList images disappearing on drag?

南楼画角 提交于 2019-12-25 01:44:52
问题 I'm developing a Flex Air (desktop) application that loads images from the local filesystem into a TileList. The user will then be able to drag (copy) these images out of the list onto another control. I've finally got the images showing up correctly (and not disappearing after scrolling the TileList) but they seem to disappear from the TileList at the start of a drag operation. I come from a .NET background and am just learning AS3/Flex, so if you see me using any anti-patterns here, feel

Get sound's total time and current time?

谁都会走 提交于 2019-12-25 01:44:16
问题 I have a player in flash ActionScript 3. I need to take a the total time of the sound file and current time of the sound file. My code: function onPlayProgress(evt:Event):void { var sndLength:int = Math.ceil(snd.length /(snd.bytesLoaded / snd.bytesTotal)); var seekbar = 100 * (channel.position / sndLength); playBar.seekbar.x = seekbar*5.8; var _totalTime:Number = (((snd.length /(snd.bytesLoaded / snd.bytesTotal))*0.001/60)); What is current time? 回答1: I'm not entirely clear on what the code

Making a Movieclip which is set as mask clickable and respond to MouseEvents

别等时光非礼了梦想. 提交于 2019-12-25 01:36:59
问题 I am trying to do panning of a movieclip I have two movieclips on stage. canvasPanel_mc and mask_mc. The former is the maskee for the mask (mask_mc). Inside mask_mc there is a movieclip dragCanvas_mc. The alpha of dragCanvas_mc is set to zero. This is code that I am using: mask_mc.dragCanvas_mc.addEventListener(MouseEvent.MOUSE_DOWN,onStartDrag); mask_mc.dragCanvas_mc.addEventListener(MouseEvent.MOUSE_OUT,onStopDrag); mask_mc.dragCanvas_mc.addEventListener(MouseEvent.MOUSE_UP,onStopDrag);

AS3 : MovieClip script stop when done playing

岁酱吖の 提交于 2019-12-25 01:35:25
问题 I am a beginner with AS3 and I'm having a problem with MovieClip class. I have a character that move through a simple script that handles collision, sound etc. Everything was working seemlessly so far but when I started adding animation, the character would stop at the end of the animation cycle. Does someone comfortable with AS3 knows what's wrong here ? Thanks in advance =) 回答1: Inside the Flash IDE, try clicking the instance of your character that's not looping the way you want it to (and

Datagrid selected row at a certain column as3

自古美人都是妖i 提交于 2019-12-25 01:29:42
问题 I need to get the value of a certain column in the selected row via AS3, how can I do this? It keeps returning null when I try grid.SelectedItem.text ... Thanks for the help! I need to be able to reference the column by name, in this case "ID". EDIT: Does this require an event or something? Shouldn't there be a method for this built in? You'd think so... 回答1: Can you be a bit more specific ? You can get get all the data you need from the DataGrid using the selectedItem.yourProperty. Can you

Trigger jquery with flash

邮差的信 提交于 2019-12-25 01:15:49
问题 I would like to know if it is possible to trigger a jquery function to hide something after a Mouse event in flash. I want this to run when something is clicked in flash: $("#googframe").click(function() { $("#googframe").hide(); }); i know how to monitor a click in AS3 but how do i get it to trigger this. By the way i am very basic so a good explanation is much appreciated. Thanks. 回答1: From this source: http://codingrecipes.com/calling-a-javascript-function-from-actionscript-3-flash try in