actionscript-3

AS3 - for (… in …) vs for each (… in …)

↘锁芯ラ 提交于 2019-12-20 16:50:44
问题 The following code does the exact same thing. Is there a difference between for each and for (... in ...) ? var bar:Array = new Array(1,2,3); for (var foo in bar){ trace(foo); } for each (var foo2 in bar){ trace(foo2); } 回答1: No, they do not do the exact same thing. The output of your for..in loop is 0 1 2 While the output of your for each..in loop is 1 2 3 A for..in loop iterates through the keys/indices of an array or property names of an object. A for each..in loop iterates through the

Test if an object is defined in ActionScript

瘦欲@ 提交于 2019-12-20 16:22:44
问题 In ActionScript, how can you test if an object is defined, that is, not null? 回答1: test if an object is defined This works in AS2 and AS3, and is the most reliable way to test if an object has a value. if (obj != null) { doSomethingWith(obj); } Its also the most reliable way to test an object's property and read it in the same expression: if (arr[0] != null && arr[0]>5) { doSomethingWith(arr[0]); } test if an object is null There's a difference between null and undefined, but if you don't

dispatch event to parent ViewController in swift

不羁的心 提交于 2019-12-20 10:52:32
问题 I'm coming from as AS3 background so it might be easier for me to show you what I'm trying to do with AS3. I have a UIViewController(root) and inside that I have a ContainerView. I am under the impression that the container view's UIViewController is a child of the UIViewController(root). I would like a button to be pressed on the child view controller (container view) and bubble that event up to the parent(root UIViewController). In AS3 I would have something like this Root Class creates the

What is the best IDE for actionscript3 development [closed]

浪尽此生 提交于 2019-12-20 10:37:16
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I am currently using FlashDevelop for my Actionscript3 development. I have also tried my hand with using Flex3 for my Actionscript3

touch events vs mouse click events using actionscript 3

让人想犯罪 __ 提交于 2019-12-20 09:42:16
问题 Just wanted to ask if there is any advantage for either using mouse click event or touch tap events, when writing apps for mobiles or tablets (for the iphone especially)? I know that both of them should work fine, but in term of performance, is anyone better? Are there any things I should be aware of when choosing either? By the way am using actionscript3 to implement the app. 回答1: This is probably the best documentation on Adobe AIR touch support: http://help.adobe.com/en_US/as3/dev

3D rotation with Axis & Angle

有些话、适合烂在心里 提交于 2019-12-20 09:38:13
问题 I know 3D rotation is well documented on SO and many other sites, but despite reading countless explanations I still haven't figured out where I'm going wrong. My background is in art and design, not math and programming, and I'm never really certain if my angle of attack (no pun intended) is the right one. Rather than paste a patchwork of my dismal code, I'm including an image describing my problem. What I'd really like is a step-by-step worded breakdown of how to solve it. Pseudo code is

How to prevent Event.Resize to trigger twice on displayState change to FULL_SCREEN?

女生的网名这么多〃 提交于 2019-12-20 07:37:05
问题 I have an application with an fullscreen button, when that button is clicked I change the displayState of stage to StageDisplayState.FULL_SCREEN_INTERACTIVE . That makes Event.RESIZE fire twice if stage.scaleMode = StageScaleMode.NO_SCALE . The event is only fireing once if i change back to stage.displayState = StageDisplayState.NORMAL . Anyone know a good way to prevent the Event.RESIZE from fireing twice except calling the onResize function directly or implementing a custom event? Sample

AS3 Custom DialogBox: How to send pushed Buttons label to Main.fla

不想你离开。 提交于 2019-12-20 07:36:54
问题 I made my own AS3-DialogBox-class. It has 2 Buttons ("Yes" and "No") Within the class there is a listener that starts a function when one of the Buttons was pushed. And within this listener-function I can get and trace the Buttons label ("Yes" or "No") by calling event.currentTarget.MyButtonTextfield.text. So my question is: How can I RETURN these pushed values ("Yes" or "No") from within the classes listener-function to the Main.fla ? Because within the MAIN.fla I want to put the call of the

Movement of Objects in a simulation

血红的双手。 提交于 2019-12-20 07:28:43
问题 i am currently making a flash "pond" with fishes in it, and i have the ability to add food pellets onto the pond, how should i make the movement of my fishes to the food x,y location ? so it will be smooth , rather than setting the x,y location of my fishes to the x,y location of the food pellets. Also is there a good place to learn how to make my fishes move by its own? similar to http://abowman.com/google-modules/fish/ Fish class package { import flash.display.MovieClip; import flash

NetStream http Video not playing on IOS device

社会主义新天地 提交于 2019-12-20 07:22:24
问题 I am trying to play a video on iPad, my code is below : public function init_RTMP():void { videoURL = "http://rest************_iphone_high.mp4"; vid = new Video(); nc = new NetConnection(); nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus); nc.connect(null); } private function onConnectionStatus(e:NetStatusEvent):void { if (e.info.code == "NetConnection.Connect.Success") { trace("Creating NetStream"); netStreamObj = new NetStream(nc); metaListener = new Object(); metaListener