actionscript-3

Listen to click event on overlapped sprites

前提是你 提交于 2019-12-25 08:15:52
问题 I have two sprites in my movieclip, one under the other, and i want both to listen to mouse clicks event. I found that only the top level sprite receives the event when i click on it. I need to dispatch the events on both, so I can't use mouseenabled=false. Is there a simple workaround for this? 回答1: You can use the ' getObjectsUnderPoint ' method native to the DisplayObjectContainer You can see how it works here: http://snipplr.com/view/34945/as3-trace-movieclips-under-mouse/ and the AS3

Resizing BitmapData in ActionScript 3

吃可爱长大的小学妹 提交于 2019-12-25 08:09:33
问题 I am using ActionScript 3.0 to capture image from users webcam ,It is working fine , however the problem is that the size of image is too big for my liking . Can I make it small , I tried changing coordinates of Bitmap Data . Can anybody suggest me the solution. Thanks 回答1: When you capture the webcam you have to provide a matrix. This matrix can handle a rescaling. var output:BitmapData = new BitmapData(camera.width * scaleFactor, camera.height * scaleFactor, false); var matrix:Matrix = new

Distance between two points

倖福魔咒の 提交于 2019-12-25 08:06:58
问题 Is there any difference between: distance = point1.subtract(point2).length; and distance = Point.distance(point1, point2); 回答1: Since this question is tagged Optimization, the longhand for the pythagorean theorem will be the most efficient way to find the distance between two points in AS3, provided that you don't: Instantiate an object while doing it Call any more Math functions than necessary (manually do an Abs, for example) Don't actually call any functions if you can help it Almost all

Getting the bit rate of a externally loaded mp3 in the flashplayer

◇◆丶佛笑我妖孽 提交于 2019-12-25 07:59:47
问题 does anyone know if this is possible? much appreciated, 回答1: Using the native flash sound class, you can read the id3 metadata property of the sound object, however this depends on the software that encoded the mp3 putting the encoding information in the metadata. there's nothing inherent to the mp3 itself that reports this to the sound class, and the metadata is often missing or unreliable. http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/Sound.html#id3 alternatively

Turn an XML string into an Object in Actionscript

我只是一个虾纸丫 提交于 2019-12-25 07:50:03
问题 I am pretty new to AS, and I am assuming there is a way to do this and I am just not figuring it out. Basically, I am trying to use a service that returns xml and return an Object regardless of the structure of the xml. In .Net I use the XmlSerializer.Deserialize class... is there equivalent in AS? I was able to find SimpleXMLDecoder but I can't seem to get it to work - it also looks like it might only work with nodes? Either way, the examples out there are sparse and hard to follow, I just

How to access variables inside a movie clip on the main timeline?

自作多情 提交于 2019-12-25 07:49:02
问题 Ok so i have some variables called "stat" that is inside a movie clip that i need to access from the main timeline. I have tried multiple ways but none of them have worked. 回答1: Edited. I put the stage instance Movieclip names "mc". and this is have a this script. var stat:String ="Test"; and next following script, Main timeline. If you access mc.stat you not get value. console show to null . when you called In Main timeline script access to instance MovieClip inner variable. because maybe

Adobe TLF with Flex/AS3: how to programmatically change \n in text string into paragraph tags and insert into TextFlow?

僤鯓⒐⒋嵵緔 提交于 2019-12-25 07:41:34
问题 My Flex/AS3 web application accesses a database and retrieves text containing \n for newline character. Otherwise the text looks like normal text. Is there a way to convert the \n into paragraph tags that I can insert into an spark TextFlow? For example, my only experience with TLF is in writing mxml code such as follows: <s:RichEditableText width="100%" height="100%" textAlign="left" paddingTop="0" paragraphSpaceAfter="0.3" editable="false"> <s:textFlow> <s:TextFlow> <s:p fontWeight="bold"

ActionScript 3, How to get character to jump for longer

两盒软妹~` 提交于 2019-12-25 07:06:20
问题 I am making a platformer game in Flash (AS3) and the code I have below works. I want my character to jump high enough to allow it time to reach a platform. The only problem with code below is the speed at which it jumps up and down and the height of the jump. Tthe space bar is what triggers the function to run. Please help as I would much appreciate it! :) Player.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey); stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);

Flash: Is it possible to record the user voice & act on it?

给你一囗甜甜゛ 提交于 2019-12-25 07:06:14
问题 Is it possible to record the end user by mic? And what kid of actions can I do with the recording? Can I get for example the volume of the sound (decibels) in real time? Can I save the record on a file? Thanks. 回答1: Yes, Flash allows (with user permission) the ability to record from the microphone. This is how countless sites like Stickam work to provide videoconferencing capability. You cannot take actual (accurate) sound pressure readings in dB--that is an absolute measurement of sound

Getting Checkboxes to retain their state on return to frame

泄露秘密 提交于 2019-12-25 07:05:02
问题 thanks for taking the time to read this. let me preface this by saying I'm extremely new to Flash/Actionscript and haven't done any coding in about 15years. Basically I've been asked by my employer to create a presentation for a client. This presentation uses checkboxes to display different segments of an image (actually buttons). These buttons in turn link to other frames with information about the section they clicked on. So far all is working, I've got all my checkboxes linked to buttons