actionscript

How do I access cookies within Flash?

旧街凉风 提交于 2019-11-28 19:46:17
I'm looking to grab cookie values for the same domain within a Flash movie. Is this possible? Let's see I let a user set a variable foo and I store it using any web programming language. I can access it easily via that language, but I would like to access it via the Flash movie without passing it in via printing it within the HTML page. If you just want to store and retrieve data, you probably want to use the SharedObject class. See Adobe's SharedObject reference for more details of that. If you want to access the HTTP cookies, you'll need to use ExternalInterface to talk to javascript. The

Flash / Actionscript CPU profiler

天涯浪子 提交于 2019-11-28 19:34:05
Have you found such a tool and used it successfully? I was also looking for a profiler for AS, but I wanted an freeware/open source solution that works with FlashDevelop and Flex SDK. I found none. So I wrote a simple python script and an even simpler AS class. The script essentially takes any AS file and adds profiling code (i.e. calls to measure the total runtime of that function with an accuracy of 1 ms - the resolution of the flash.utils.getTimer() call) to each function definition. The script sometimes makes mistakes, but these are usually easy to fix by hand. Then you need to add one

What is the best standard style for a toString implementation? [closed]

萝らか妹 提交于 2019-11-28 19:08:51
We have a lot of objects for which we like to implement a simple toString to output attributes of the object. Some of these attributes may be complex objects themselves. Is there any standard, or simply just a best practice for a style? I'm thinking something like: [SimpleClassName] { prop1:value, prop2:value } In which case a nested value would look like: [SimpleClassName] { prop1:value, prop2:[NestedObject] { prop3:value}} We are using Java but I find myself asking the same question in most languages! Wouter Coekaerts Personally, I find the mix of [] and {} not so easy to get an immediate

Hidden features/tricks of Flash development, Flash language (AS2/3), and Flash IDE [closed]

☆樱花仙子☆ 提交于 2019-11-28 15:55:32
Guys, I am thoroughly surprised that there is no Flash Hidden Features post yet in the Hidden Features series that I've been tracking for a while now. There is a recent AS3/Flex one but it's not very active and I don't exactly mean just AS3 when I say Flash here. The Hidden Features series is great for people who are new to a certain language. It shows the ropes and certain valuable tricks, all in one place. I think it's a brilliant idea. Even experts sometimes find tricks they'd never heard about. When I started with Flash, I was taken aback by the Flash IDE and odd concepts of Flash,

Custom Composite Control not rendering correctly for only 0.5-1 sec after being added back into a VGROUP

天涯浪子 提交于 2019-11-28 14:44:34
I am moving away from MXML and have built a custom component control within ActionScript . I have the control displaying correctly. The problem comes after I remove it from the display list and add it back in again with the .addElement(control) method. Here is the code that adds it back in again. private function displayParameters(parameters:ArrayCollection):void{ for(var index:int = 0; index<parameters.length; index++){ if(parameters[index] is ReportControl){ var control:ReportControl = parameters[index] as ReportControl; control.percentWidth = 100; vgParameters.addElement(control); } } }

Most useful ActionScript packages / libraries

不打扰是莪最后的温柔 提交于 2019-11-28 14:28:23
问题 What are some useful plug-ins, packages or source-code for ActionScript? Please include ActionScript version, name, link and description. 回答1: Common libraries: http://casalib.org/ http://code.google.com/p/as3corelib/ Physics Engines: http://box2dflash.sourceforge.net/ http://www.cove.org/ape/ Flash 3D engines: http://away3d.com/ http://papervision3d.org/ http://alternativaplatform.com/en/ http://www.flashsandy.org/ Tweening: http://greensock.com/gsap-as/ http://www.gskinner.com/libraries

Randomize or shuffle an array

ぃ、小莉子 提交于 2019-11-28 14:13:40
Say I have an array: myList:Array = new Array(); myList = [1,2,3,4,5,6,7,8,9]; myRandomList:Array = new Array(); for (var i:uint = 0; i < myList; i++) { var item:Number = Math.floor(Math.random() * myList.length-1) + 1; myRandomList.push(item); } The only thing is, I'd like myRandomList to not have any duplicate numbers...is there a way to select a random number from the first list and then SUBTRACT it so I don't select that number twice? UPDATE: I just saw this method of shuffling an array from shadetyler.blogspot.com/2008/12/array-shuffle-as3.html Array.prototype.shuffle = function(){ for

Flash client XMLSocket not connecting to server

拟墨画扇 提交于 2019-11-28 14:13:37
I have a Flash client that I want to connect to a server. Both are using localhost and port 50000 so there shouldn't be any cross-domain problems. I also set Access Network Only in the publishing settings. When I call the XMLSocket connect, the server seems to get a new connection. But, the XMLSocket.onConnect callback is not called with success=true. Any ideas on what may be wrong? Here's the ActionScript for creating the socket. function myOnConnect(success) { if (success) { trace ("Connection succeeded!") inputText.text = "open"; // socket.send("1\n"); gotoAndPlay(2); } else { trace (

How to pass ByteArray to C code in alchemy?

老子叫甜甜 提交于 2019-11-28 14:05:37
I want to pass a byte array object from flex code to C code.How to do that? Passing a ByteArray from Flex to C++ http://nexus.zteo.com/blog/2008/12/22/adobe-alchemy-passing-a-bytearray-from-flex-to-c/ Multiple approaches outlined here: http://blog.debit.nl/2009/03/using-bytearrays-in-actionscript-and-alchemy/ You can use AMF to pass an ActionScript ByteArray. So you're set on the Actionscript side. On the server side, there are slim pickings for AMF server implementations in C++. I use BlazeDS for Java, but the only one I can seem to find for C++ is AMFPP . 来源: https://stackoverflow.com

Flash as3 How do I remove duplicates in an array?

 ̄綄美尐妖づ 提交于 2019-11-28 12:24:59
Hi I just have an array of names (strings) in flash, and I want to make sure that any duplicates from the array are removed, or at least that a function is performed only once per reocurring value in the array. More cat skinning: var a:Array = ["Tom", "John", "Susan", "Marie", "Tom", "John", "Tom", "Eva"]; a.sort(); var i:int = 0; while(i < a.length) { while(i < a.length+1 && a[i] == a[i+1]) { a.splice(i, 1); } i++; } Many ways. You can sort the array and iterate over it ignoring entries that match the previous iteration. Or you can use indexOf() to search for duplicates. Or you can take one