actionscript-3

AS3 -TypeError #1009 - any easy way to find out *which* object reference is null?

▼魔方 西西 提交于 2019-12-17 16:32:33
问题 We all get "TypeError #1009 Cannot access a property or method of a null object reference" now and then - no big deal, but sometimes frustrating to debug. Flash gives you the call stack (which is a start), but leaves it up to you to figure out where the null object is - is it possible to find out exactly which reference is throwing the error? Given the following (error prone) function: function nullObjectReferenceError():void { var obj:Object; var prop:* = obj.nonExistentProperty; } Rather

Flash AS3 Global Variables?

耗尽温柔 提交于 2019-12-17 14:54:05
问题 HI i have a main class //main.as package { public class main { public var testGlobal:string = "testValue"; } } //pop.as package { public class pop { function pop():void { trace("testGloabl from main.as" + testGlobal); } } } How can i get the testGlobal value on pop.as width out using a main class Object. Is there any method of Global variables?? How to use global variables in AS3 . 回答1: If you absolutely positively have to have a global variable in as3, you could always create a file in the

Flex's FileReference.save() can only be called in a user event handler — how can I get around this?

非 Y 不嫁゛ 提交于 2019-12-17 10:59:22
问题 I need to call FileReference.save() after a web service call has completed, but this method has a restriction: "In Flash Player, you can only call this method successfully in response to a user event (for example, in an event handler for a mouse click or keypress event). Otherwise, calling this method results in Flash Player throwing an Error exception." (from the documentation here) This restriction is a bit vague. Does it mean that I can only call the FileReference.save() method from within

Save video captured from webcam using Flash

喜夏-厌秋 提交于 2019-12-17 10:37:27
问题 I'd like to use Flash to capure video from the user's webcam and then save it on the same server that hosts the Flash file. The web server will be running ASP.Net technology. Seems easy, right? Lot of searches yielded the same lines of code to start a webcam capture using Flash. I can't find anything that sends that captured video back to a server. I can find lots of blog and forum posts that imply 3rd party software or Flash Communication Server is required to collect it on the server, but I

Inverting rotation in 3D, to make an object always face the camera?

落爺英雄遲暮 提交于 2019-12-17 10:32:06
问题 i have lots of sprites arranged in 3D space, and their parent container has rotations applied. How do i reverse the sprites 3D rotation, that they always face the camera (Actionscript 3)? heres a code to test it: package{ import flash.display.Sprite; import flash.events.Event; public class test extends Sprite{ var canvas:Sprite = new Sprite(); var sprites:Array = [] public function test(){ addChild(canvas) for (var i:int=0;i<20;i++){ var sp:Sprite = new Sprite(); canvas.addChild(sp); sp

Using 'File' to save scene object locations to rebuild later in AS3

我是研究僧i 提交于 2019-12-17 10:09:40
问题 I am attempting to use the 'File' function in ActionScript 3 to save the following information: I have varying draggable display objects in the scene, the amount and type can vary. I want to save the amount and their position and then load them back in a future session. I am struggling to use File to save anything, I have searched the Adobe documentation and cannot get my head round how to use it. I have not yet developed any code using it. Any help would be appreciated. Thank you. 回答1: You

AS3 + HTTP GET doesn't work

吃可爱长大的小学妹 提交于 2019-12-17 10:07:42
问题 I have a project in Flash and I use a webserver with some data. I read that information (json) with: var url:String = "URL REQUEST"; var request:URLRequest = new URLRequest(url); var loader:URLLoader = new URLLoader(); loader.load(request); and I use that information in a TextField. This works fine and show my data properly. But, when I publish my work or open the file .swf doesn't show the data. Inside the Adobe Flash works fine. Outside doesn't work. I have a raspberry pi with a service in

iPhone different screen sizes in flash? (Getting Black Bars)

不想你离开。 提交于 2019-12-17 09:58:36
问题 I'm new to the whole world of coding, and actionscript 3 is my first real experience, so sorry if I don't understand your answer straight away. I've built an iPhone app using Adobe Flash CC in AIR for iOS. All the code is either in the timeline or separate .as files (so not using documents classes). The core concept of the game is randomly generated objects fall from the top of the screen and the user has to tap them to make them disappear before they touch the bottom. My problem is my

How to fix closure problem in ActionScript 3 (AS3)

给你一囗甜甜゛ 提交于 2019-12-17 09:21:32
问题 In the code below I'm trying to load some images and put them in the stage as soon as they get individually loaded. But it is bugged since only the last image is displayed. I suspect it's a closure problem. How can I fix it? Isn't the behaviour of closures in AS3 the same as in Java Script ? var imageList:Array = new Array(); imageList.push({'src':'image1.jpg'}); imageList.push({'src':'image2.jpg'}); var imagePanel:MovieClip = new MovieClip(); this.addChildAt(imagePanel, 0); for (var i in

How to fix closure problem in ActionScript 3 (AS3)

你说的曾经没有我的故事 提交于 2019-12-17 09:21:30
问题 In the code below I'm trying to load some images and put them in the stage as soon as they get individually loaded. But it is bugged since only the last image is displayed. I suspect it's a closure problem. How can I fix it? Isn't the behaviour of closures in AS3 the same as in Java Script ? var imageList:Array = new Array(); imageList.push({'src':'image1.jpg'}); imageList.push({'src':'image2.jpg'}); var imagePanel:MovieClip = new MovieClip(); this.addChildAt(imagePanel, 0); for (var i in