actionscript-3

AS3 JSON parsing

╄→гoц情女王★ 提交于 2019-12-21 04:25:14
问题 I have a bit of a dilemma. I have a JSON object that has a format I'm unfamiliar with (starts with an array [] instead of an object {} ) and was wondering how I might parse it in AS3. The object looks like: [ { "food": [ { "name": "pasta", "price": 14.50, "quantity": 20 }, { "name": "soup", "price": 6.50, "quantity": 4 } ] }, { "food": [ { "name": "salad", "price": 2.50, "quantity": 3 }, { "name": "pizza", "price": 4.50, "quantity": 2 } ] } ] I don't really know how I get to each food array,

How can I use BitmapData.draw with NetStream.appendBytes?

只谈情不闲聊 提交于 2019-12-21 04:17:16
问题 I am using NetStream.appendBytes() to play a local video (no server involved) in Adobe AIR. I would like to use BitmapData.draw() to take a picture of the video output, but I am getting this error: Error #2123: Security sandbox violation: BitmapData.draw: cannot access null. No policy files granted access. Here is some sample code: package { import flash.display.Sprite; import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; import flash.media.Video

AS3 - How to find the position of an object relative to the stage?

笑着哭i 提交于 2019-12-21 03:49:38
问题 If I have a rectangle on the stage, how do I find its top left tip (x,y) and the bottom right tip (x,y) in relation to the stage? It strange how I can't find this on google! 回答1: localToGlobal(point) of DisplayObject Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates. // assuming (0, 0) is top left var topLeftStage:Point = myDisplayObject.localToGlobal(new Point(0, 0)); // bottom right var bottomRightStage:Point = myDisplayObject

How to Draw line in 3D rectangle based on x,y and z?

徘徊边缘 提交于 2019-12-21 03:01:42
问题 I would like draw 3D points represented in image to 3D rectangle. Any idea how could I represent these in x,y and z axis Here projection type is orthographic. Thanks 回答1: Okay. Let's look at a simple example of what you are trying to accomplish it, and why this is such a complicated problem. First, lets look a some projection functions. You need a way to mathematically describe how to transform a 3D (or higher dimensional) point into a 2D space (your monitor), or a projection . The simpiest

How to pass variable From .swf File to .as file?

放肆的年华 提交于 2019-12-21 02:59:07
问题 I have a main in .as and I load .swf in my .as.It's Working fine,Now I want the take variable From .swf and Pass it Into .as. How can i do this? pls. help! My .swf file coding function formatMessage(chatData:Object) { var number:uint = chatData.user; trace(chatData.user); } private function addText() { _loader = new Loader(); _loader.x=10; _loader.y=200; _loader.load(new URLRequest("receive.swf"));//Here i Can Load the Swf.Here how Can i acces the Variable of number ? addChild(_loader); } 回答1

Compiling with Flex4 SDK

心不动则不痛 提交于 2019-12-21 02:57:11
问题 I'm trying to compile an existing Flex3 project with the Flex4 SDK. I'm getting this error: Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option. The resulting file is roughly the same as my old Flex3 compiled .swf file. Playing the resulting .swf file in

ExternalInterface not working in IE after page refresh

强颜欢笑 提交于 2019-12-21 02:41:32
问题 I have a bizarre situation in IE where JS can't call up into flash using ExternalInterface after I hit "refresh". I know the movie is getting loaded and the code that does the ExternalInterface.addCallback() appears to be completing without any error Here's a rundown of the steps to reproduce: Open IE and load up the movie for the first time, the ExternalInterface callback methods are available to JavaScript. If I hit refresh, the callback methods aren't available and I get the error Object

How do I get the user's screen resolution in ActionScript 3?

空扰寡人 提交于 2019-12-20 23:25:11
问题 Is there a way ActionScript 3 can detect the user's screen resolution? 回答1: have a look at stage.fullScreenHeight and stage.fullScreenWidth 回答2: These will return the numbers to your output window: trace(Capabilities.screenResolutionX); trace(Capabilities.screenResolutionY); 回答3: If you are on AIR, you could use the flash.display.Screen class, which contains this info, plus a lot more, such as color-depth, and multi-screen support. 回答4: flash.system.Capabilities.screenResolutionY and flash

Is it possible to define a generic type Vector in Actionsctipt 3?

喜欢而已 提交于 2019-12-20 20:15:11
问题 Hi i need to make a VectorIterator, so i need to accept a Vector with any type. I am currently trying to define the type as * like so: var collection:Vector.<*> = new Vector<*>() But the compiler is complaining that the type "is not a compile time constant". i know a bug exists with the Vector class where the error reporting, reports the wrong type as missing, for example: var collection:Vector.<Sprite> = new Vector.<Sprite>() if Sprite was not imported, the compiler would complain that it

BlazeDS and ArrayList of custom objects

倾然丶 夕夏残阳落幕 提交于 2019-12-20 17:15:10
问题 I'm using BlazeDS to connect Flex with Java. I'm having trouble passing ArrayLists of custom objects from Flex to java. I have two objects, one is called Category, the other Section. A Category has an ArrayList of Section objects. I can send an ArrayList of Category objects back and forth between Flex and Java, the problem is when I try to access the sections ArrayList of a Category object that has been returned to Java from Flex, I get the following error: flex.messaging.MessageException: