actionscript-3

Using RemoteObject (AMF) from a Flash or Pure AS3 Project

こ雲淡風輕ζ 提交于 2020-01-14 13:40:48
问题 I recently ported some code from a Flex project over to a new pure AS3 project. When i attempted to make an AMF call, I am getting an error message like this: TypeError: Error #1034: Type Coercion failed: cannot convert Object@5425371 to mx.messaging.messages.ErrorMessage. There was no stack trace associated with the error, so debugging was difficult. I tried all manner of things (checking that all required libraries from the flex framework were included, etc) but nothing worked. 回答1: After

Best way to replace all spaces, symbols, numbers, uppercase letters from a string in actionscript?

半世苍凉 提交于 2020-01-14 11:51:50
问题 What would be the best way to simply take a string like var myString:String = "Thi$ i$ a T#%%Ible Exam73@"; and make myString = "thiiatibleeam"; or another example var myString:String = "Totally Awesome String"; and make myString = "totallyawesomestring"; In actionscript 3 Thanks! 回答1: Extending @Sam OverMars' answer, you can use a combination of String's replace method with a Regex and String's toLowerCase method to get what you're looking for. var str:String = "Thi$ i$ a T#%%Ible Exam73@";

Flex: Get self SWF file name?

风格不统一 提交于 2020-01-14 08:46:50
问题 Is there a way I can programmatically determine the filename of the .swf my class is running in? Thanks! 回答1: Stage has a loaderInfo property, which contains a url property that has the information you're looking for. You can get the stage property from any DisplayObject in Flex. trace(stage.loaderInfo.url); 回答2: Just a helpful note: If you load one SWF into another, the loaded (inner) SWF will return an erroneous result if you use loaderInfo.url to try to get the filename. For instance,

Converting Actionscript syntax to Objective C

萝らか妹 提交于 2020-01-14 07:52:06
问题 I have a game I wrote in Actionscript 3 I'm looking to port to iOS. The game has about 9k LOC spread across 150 classes, most of the classes are for data models, state handling and level generation all of which should be easy to port. However, the thought of rejiggering the syntax by hand across all these files is none too appealing. Are there tools that can help me speed up this process? I'm not looking for a magical tool here, nor am I looking for a cross compiler, I just want some help

AS3 TypeError: Error #1007: Instantiation attempted on a non-constructor

♀尐吖头ヾ 提交于 2020-01-14 07:51:12
问题 For some reason I can't get this to work (heavily simplified code that fails): package com.domain { public class SomeClass { private static var helper:Helper = new Helper(); } } class Helper { } It compiles, but throws upon first access of SomeClass : TypeError: Error #1007: Instantiation attempted on a non-constructor. at com.domain::SomeClass$cinit() ... 回答1: +1 to Darren. Another option is to move the Helper class to the top of the file class Helper { } package com.domain { public class

Actionscript: Sorting ArrayCollection by date: YYYY-MM-DD

不羁岁月 提交于 2020-01-14 05:44:09
问题 I have an ArrayCollection of Objects. Each Object has the following keys/values: {date: 2009-12-01, visits=13555, bouceRate=45} {date: 2009-12-05, visits=46955, bouceRate=45} {date: 2009-12-06, visits=13685, bouceRate=45} {date: 2009-12-02, visits=13685, bouceRate=45} {date: 2009-12-04, visits=68755, bouceRate=45} {date: 2009-12-03, visits=35875, bouceRate=45} I need to sort this ArrayCollection by date, so it would be from past to present - like so: {date: 2009-12-01, visits=13555, bouceRate

Facebook AS3 api log in box did work, a day later it does not

家住魔仙堡 提交于 2020-01-14 05:32:06
问题 Yesterday I successfully got my flash project to log in with the facebook as3 api. Today I tried using the application again, and now its not working. I didn't change any code... Does anyone know how I should approach debugging this or has this happened to anyone else? Thanks 回答1: A friend created a solution for this issue. I fixed my flash sites and their facebook connect with AS3 SDK. We're from Mexico so it's in spanish: Facebook AS3 Fix Traduction: 1.- If you're using GraphAPI_Web_1_8_1

Why TLF text works in debug on device mode but not in a release ad-hoc?

帅比萌擦擦* 提交于 2020-01-14 05:26:06
问题 I have created a swf that include text TLF. After that I have loaded it in an flex mobile application. At the beginning I had lot of problems to load it. 1- First because I used Loader and the project was created with Flash Profesional. The best way is load it with ProLoader of flash library included in Flash Professional. 2- One time I finally loaded and tried it in the simulator on desktop I tried it in my iPad in Debug and fast compilation mode. I had the next error: Error #2100: The

Change Banner ClickTag Code to AS3?

自闭症网瘾萝莉.ら 提交于 2020-01-14 05:24:06
问题 I have been handed a number of Flash (AS3) banners to add ClickTag codes to them and as the documents have been setup as AS3 it does not allow code added to items! I need help changing the following code to AS3 asap if anyone can help? on (release) { getURL (_level0.clickTag, "_blank"); } I cannot change the document back to AS2 as they have been created through InDesign and the filters don't work if I change them back! Thanks, Thomas. 回答1: In AS3, the on(event) workflow has been replaced

AS3 Passing data between objects/classes

妖精的绣舞 提交于 2020-01-14 05:18:12
问题 So i a building a categorized menu of different foods. I have a class for "categories" (buttons) which essentially will return a string "salads", "drinks", etc. I now have another class "menuItems" for items within categories and this handles sizes such as "small", "med", "large", etc. My problem now is that when i return "salads", i want to invoke an array which contains all the elements of salads, send it to menuItems which will populate the menu. So far i have both the category objects and