actionscript

Multiple Actionscript 3 layers

霸气de小男生 提交于 2019-12-11 02:24:58
问题 I'm wondering if I split up certain bits of code that are meant for different sections into different layers will they have functionality between them or act as separate things. (will I be able to reference a variable on one layer from the other?) Basically I have a set of code that runs throughout every frame but also need code specific to certain frames but still be able to access the main code. Thanks 回答1: You could have code that spans multiple frames as well as individual frame script:

Sorting an array to avoid neighboring items having duplicate attributes

二次信任 提交于 2019-12-11 02:23:20
问题 I have an array of objects. Each object has a color attribute which could be "red", "blue", "yellow", "green", "orange" or "purple". There are 20-30 objects in the array so colors repeat. My goal is to sort the array so that no colors are next to each other. Distribution of colors is not exactly even but close. This is what I have so far. It checks the next and previous object for a color match and if it finds a match it moves it to the end of the array. private function sortColors():void {

Flash and HTTP Status Code 207

荒凉一梦 提交于 2019-12-11 02:09:37
问题 Having some trouble getting flash to recognize a valid HTTP response code (207). Oddly, this only seems to happen in FireFox so far.. works fine in Chrome. Here's the code that's generating the errors below. It appears to return an HTTP status of 0 in FlashBug.. must be handled differently in Chrome? Is there any way to still get the response body? Nothing I do seems to be able to get me the response body in this 207 condition. :( // Initiate a call to a Patron URL private function callPatron

Loading external pngs into an AS2 swf that is loaded into an AS3 swf wrapper

好久不见. 提交于 2019-12-11 02:04:56
问题 I have a Wrapper SWF that loads a series of AS2 movies. Each AS2 movie loads a series of .png files. AS3_wrapper.swf |-> AS2_1.swf |-> image_1.png |-> image_2.png |-> AS2_2.swf |-> image_1.png |-> image_2.png Inside of the AS2 I listen for the load of the pngs using onLoadInit and update my UI. This works fine for the first AS2 swf. But when I load the second AS2 swf the onLoadInit isn't triggered for the pngs. My guess is that the images are in a cache or something like that. I put a random

Right way to convert dates to UTC

大兔子大兔子 提交于 2019-12-11 01:20:14
问题 my apologies if this question doesn't make much sense, but I'm new(ish) to Actionscript, and was wondering if you could help me solving this problem. I'm building an application that given a time-zone, tells you what time in that location it is. It works great when I'm working with locations where the timezone is GMT (UTC), but fauils miserably if the timezone on the host machine is anything else, as it will still add the time to the host machine regardless. So I was thinking what I have to

Generating ActionScript value objects from an xsd schema

妖精的绣舞 提交于 2019-12-11 01:15:33
问题 Are there any tools available for transforming types defined in an xsd schema (may or may not include other xsd files) into ActionScript value objects? I've been googling this for a while but can't seem to find any tools and I'm pondering wether writing such a tool would save us more time right now than to simply code our value objects by hand. Another possibility I've been considering is using a tool such as XMLBeans to transform the types defined by the schema to Java classes and then

ANE, iOS and BitmapData

假如想象 提交于 2019-12-11 00:58:41
问题 Is there any example of passing bitmap data into iOS and returning a modfified copy. I am trying to convert a bitmap into jpeg - similar to this example in Windows http://blog.magicalhobo.com/2011/09/12/air-3-native-extension-imagepro cessor/ but it crashed every time. I am pretty sure I am doing something basic wrong but not been an iOS / Objective C programmer I am really just trying magic incantations and I can't find any good examples. Any help appreciated? Sean P.S. Below is my attempt:

Counting number of occurances in an Array

橙三吉。 提交于 2019-12-11 00:37:47
问题 I want to count number of occurances in an array in ActionScript 3.0. Say I have var item:Array = ["apples", "oranges", "grapes", "oranges", "apples", "grapes"]; How can I make it show the number of matching strings? For instance, result: apples = 2, oranges = 2 etc. I got this code from another similar question: private function getCount(fruitArray:Array, fruitName:String):int { var count:int=0; for (var i:int=0; i<fruitArray.length; i++) { if(fruitArray[i].toLowerCase()==fruitName

Sort collection and sort remains in place when adding to collection?

可紊 提交于 2019-12-10 22:39:48
问题 When I get a collection back from the service tier, I create an ArrayCollection and apply a sort. When I add an item to the collection later on, the sort is still in place? It seems to be the case. I thought I was only sorting it once, not applying a sort that will stick??? Here is the method for adding an item: private function onAddNewClick():void { var fileTemplate:FileTemplateDetailDTO = new FileTemplateDetailDTO(); fileTemplate.fileTemplateId = 0; fileTemplate.fileTmpltDtlId = 0;

Saving application state AIR

爷,独闯天下 提交于 2019-12-10 20:19:34
问题 Is there a way to save an application state for save files in AIR for the desktop (Flex /AS3)? Thanks 回答1: You need to make sure all your classes are serializable, then serialize them and save them to a file when exiting the application. On starting the application again, you deserialize the objects - in effect instantiating all objects and assigning all their previous properties again. This can be rather hard to retro-fit to an existing application since your code must adhere to a few rules.