actionscript-3

Shape, Sprite, MovieClip and other display objects: when to use?

此生再无相见时 提交于 2020-01-04 02:35:08
问题 there's a large ammount of display objects in flash.display package. It's not clear for me in what situation I should use Shape , Sprite or MovieClip . What is the pro and contras in using each of them? Thank you in advance!! 回答1: Shape is the simplest display object you can add on stage. It is the most limited one: you can't add childen to it (does not extend DisplayObjectContainer), does not have interactivity (does not extend InteractiveObject), does not have a timeline Sprite extends

XML, namespaces and E4X

怎甘沉沦 提交于 2020-01-04 02:11:25
问题 Can someone explain me what exactly namespaces (xmlns="...") in XML are for and how they have to be used in navigating an XML using E4X (..preferrably in ActionScript 3)? I fail to fully understand their purpose and usage. 回答1: In theory, XML namespaces are used to avoid conflict with tag names. So I can create a namespace that contains a tag named "mytag" and someone else creates a different namespace with the same tag "mytag" and there won't be any conflict. Each "mytag" tag will be clearly

XML, namespaces and E4X

心不动则不痛 提交于 2020-01-04 02:11:08
问题 Can someone explain me what exactly namespaces (xmlns="...") in XML are for and how they have to be used in navigating an XML using E4X (..preferrably in ActionScript 3)? I fail to fully understand their purpose and usage. 回答1: In theory, XML namespaces are used to avoid conflict with tag names. So I can create a namespace that contains a tag named "mytag" and someone else creates a different namespace with the same tag "mytag" and there won't be any conflict. Each "mytag" tag will be clearly

How to use out-of-datagrid scope variable inside an ItemRenderer?

末鹿安然 提交于 2020-01-04 01:39:27
问题 I'm binding an array of items to a data grid using ItemRenderer . I use the data variable to control the bindable data. I also have someComponentVariable that need be inserted into every row but its declared at the component scope, so the data grid doesn't seem to reconize it (compile error). How can I use this variable ( someComponentVariable ) inside the ItemRenderer ? Code Example <mx:DataGrid id="userBonusesGrid" width="100" height="248" showHeaders="false" wordWrap="true"> <mx:columns>

How do I tell mxmlc to treat warnings as errors?

南楼画角 提交于 2020-01-03 19:16:49
问题 I'm using the mxmlc command line tool to compile a pure AS3 project. Is there a command line option to make mxmlc treat warnings as errors? I've read through all the compiler flags and flex-config.xml but wasn't able to find this option. 回答1: You cannot. The default mxmlc value for 'strict' is true. Setting it to true has no effect. 回答2: What about... -compiler.strict alias -strict runs the AS3 compiler in strict error checking mode. strict must be 'false' when es3 is 'true' . I believe you

How do I tell mxmlc to treat warnings as errors?

旧城冷巷雨未停 提交于 2020-01-03 19:16:18
问题 I'm using the mxmlc command line tool to compile a pure AS3 project. Is there a command line option to make mxmlc treat warnings as errors? I've read through all the compiler flags and flex-config.xml but wasn't able to find this option. 回答1: You cannot. The default mxmlc value for 'strict' is true. Setting it to true has no effect. 回答2: What about... -compiler.strict alias -strict runs the AS3 compiler in strict error checking mode. strict must be 'false' when es3 is 'true' . I believe you

determine is MovieClip playing now

一笑奈何 提交于 2020-01-03 18:05:32
问题 I have movieClip (in as3) and I'd like to know is this movieClip playing now How can I do this? 回答1: As crazy as it is, there is no built in way to do this (although it should be). Two options have a flag that you swap when play/stop is called. var mc_playing:Boolean = false; mc_playing = true; mc.play(); mc_playing = false; mc.stop(); Or you could extend the MovieClip class to create your own playing property. class SuperMovieClip extends MovieClip { private var _playing:Boolean = false;

AIR Sqlite: SQLEvent.RESULT not firing, but statement IS executing properly

假装没事ソ 提交于 2020-01-03 17:15:06
问题 Ok it looks likes like I have stumbled upon a strange timing issue... I made a quick SQL wrapper class for executing sql statements. However after .execute() is called, the SQLEvent.RESULT event is never fired, but the new entry in the DB is created as it should be. The really really odd part is if I put a setTimeout() just after calling execute() the event fires as expected.. I hope I'm missing something really obvious here... Here is a link to an example air app: http://www.massivepoint.com

Set stage vanishing point in Flash via actionscript 3

此生再无相见时 提交于 2020-01-03 16:44:03
问题 I'm working with a few designers, each of whom have created 3D animations (using fp 10 capabilities) for use in the same flash application. Each 3D animation is a unique movieclip that will ultimately be part of the same .fla file. The problem I'm having is that each of the movieclips was created in a separate .fla, and each .fla had different settings for the vanishing point for the stage. This means that after importing the various moveiclips into my library, none of the visual assets are

Javascript function that works like actionscript's normalize(1)

自古美人都是妖i 提交于 2020-01-03 15:34:40
问题 I need a formula that returns normalize numbers for xy point - similar to actionscript's normalize() function. var normal = {x:pt1.x-pt2.x,y:pt1.y-pt2.y}; normal = Normalize(1) // this I do not know how to implement in Javascript 回答1: I think the as3 normalize function is just a way to scale a unit vector: function normalize(point, scale) { var norm = Math.sqrt(point.x * point.x + point.y * point.y); if (norm != 0) { // as3 return 0,0 for a point of zero length point.x = scale * point.x /