actionscript

embedding sources dynamically

喜欢而已 提交于 2019-12-25 03:38:13
问题 is it possible to embed sources dynamically. instead of doing this [Embed(source = '../../../../assets/levels/test.xml')] I could probably do something like this var src = '../../../../assets/levels/test.xml' [Embed(source = src )] 回答1: It's not possible for anything within metadata annotations to be dynamic :/. That is, you can't place variables into metadata annotations. If that was possible, there would be SO many cool possibilities. So your first option is the only way to directly embed

actionscript Storing a value after a button is clicked

ⅰ亾dé卋堺 提交于 2019-12-25 03:32:38
问题 I don't program a lot. Sometimes I program a bit of Actionscript 3. Now I wanted to create an flash enviroment where people can click on buttons and play a video. I think I almost figured it out with the following script: public class main extends MovieClip { private var drukknop1:knopje; private var drukknop2:knopje; private var drukknop3:knopje; private var drukknop4:knopje; private var drukknop5:knopje; private var drukknop6:knopje; private var drukknop7:knopje; private var drukknop8

How to extract sound object to a mono byte array in AS3

有些话、适合烂在心里 提交于 2019-12-25 03:25:14
问题 I'm trying to prepend the byte array of a sound object to a captured microphone sound byte array. It works, but the extracted sound object get pichted down and doubled in length. I guess this is because the byte array of the sound object is in stereo, while the mic byte array is in mono. I have this: sound.extract(myByteArray, extract); myByteArray now contains the stereo data. How can I turn this to mono (I'm new to ByteArrays). UPDATE: Here's a working solution: existingByte.position = 0;

Passing params to an external swf via loader

放肆的年华 提交于 2019-12-25 03:12:26
问题 I have a map of the US acquired from here (called U.S. Map). I am currently generating XML from inside an ActionScript file, and would then like to display this map using my generated XML as the argument. According to this, to do this in html would require the following declaration: world.swf?data_file=pathname/filename.xml How can I replicate this behavior using the Loader from ActionScript? Right now I have: var ldr:Loader = new Loader(); var url:String = "us/us.swf?data_file=senate.xml";

XMLSocket working in firefox but not IE

淺唱寂寞╮ 提交于 2019-12-25 03:12:17
问题 I'm helping a customer who has a problem with a flash app. The flash app uses an XMLSocket to connect to a service running on localhost. It works fine under firefox. It uses the following line to setup the security policy: System.security.loadPolicyFile("xmlsocket://localhost:10032"); Running the flash app under firefox, the service listening on port 10032 gets a connection with a <policy-file-request/>, responds to it, and it works well. Under IE, the service never gets the connection and

What [object global] is exactly, when “this” is accessed inside a nested or inline function?

为君一笑 提交于 2019-12-25 03:05:42
问题 Here is the code: package { import flash.events.*; import flash.display.*; public class SomeDocumentClass extends MovieClip { public var abc: MovieClip; public var test_var = 12345; public function SomeDocumentClass() { //abc is an instance name of a movieclip placed on stage abc.addEventListener(MouseEvent.CLICK, function () { trace(this); }); abc.addEventListener(MouseEvent.CLICK, abc_CLICK) } function abc_CLICK(e: Event): void { trace(this); } } } The output is : [object global] [object

Dynamically Casting In ActionScript

泪湿孤枕 提交于 2019-12-25 02:57:15
问题 Is there a way to cast dynamically in Actionscript? What I want to accomplish is illustrated by the following code: var Val:*; var S:String=SomeTextEdit.text; switch (DesiredTypeTextEdit.text) { case 'int':Val=int(S);break; case 'uint':Val=uint(S);break; case 'String':Val=String(S);break; case 'Number':Val=Number(S);break; ... } SomeDisplayObject[SomePropertyNameTextEdit.text]=Val; I am looking for something LIKE the following PSEUDOCODE: SomeDisplayObject[SomePropertyName]=eval(DesiredType)

AS3 for Android, Saving a file in the external storage (Only visible when phone restarts)

大憨熊 提交于 2019-12-25 02:56:00
问题 I´m having trouble finding my file in the device I am saving a file in the external storage, specifically using this code private function saveFiles():void { var file1:File = File.applicationStorageDirectory.resolvePath("v/appstorage.doc") var file2:File = File.cacheDirectory.resolvePath("v/cache.doc") var file3:File = File.desktopDirectory.resolvePath("v/desktop.doc") var file4:File = File.documentsDirectory.resolvePath("v/documents.doc") var file5:File = File.userDirectory.resolvePath("v

Debug JavaScript injection in ActionScript (Flash Builder)

心不动则不痛 提交于 2019-12-25 02:49:09
问题 I'm working on a InDesign CS6 Extension in Adobe Flash Builder 4.6. For some reason my code (which worked fine for a long time) now throws the error null is not an object . The error is located in a javascript injection (last line): public class Script { private static var _instance:Script; [ Embed (source="script.jsx", mimeType="application/octet-stream") ] private var ScriptClass:Class; private var jsxInterface:HostObject; public function Script() { if (Script._instance) { throw new Error(

Initializing a collection from MXML

旧城冷巷雨未停 提交于 2019-12-25 02:47:04
问题 Gentlepersons, How does one initialize a collection instance from MXML in Flex/Actionscript? Background Let's assume that: I've got three lists of number-name pairs. The contents of each list never changes, but I may want to add new lists in future. The user can choose which list to use. I know how to use MXML to define/initialize a Flex UI component, but that is the full extent of my XML experience. Problem How do I write a combination of XML declarations and Actionscript classes such that I