actionscript-3

compare two images and check equality

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 16:03:31
问题 do you know any source or info about comparing images within as3/flash? I want to compare two images and check if the images are the same or not. Check this example: http://imageshack.us/photo/my-images/825/imagecompare.jpg/ Any clues? Thank you in advance! 回答1: In addition to the duplicate answers, I believe you can also use BitmapData.compare() An example taken from the link, consider the following two BitmapData objects: var bmd1:BitmapData = new BitmapData(50, 50, true, 0xFFFF8800); var

Actionscript3 to JavaScript communication: best practices

此生再无相见时 提交于 2019-12-21 15:19:32
问题 On a more abstract level then a previous question, in my experience there are 3 ways to call a javascript function on an html page from an embedded .swf using AS3: ExternalInterface, fscommand, and navigateToURL. Let's compare and contrast these methods (and maybe others I haven't listed) and talk about the pros and cons of each - right now, ExternalInterface seems like the way to go in terms of flexibility, but is it right for all situations? Are there concrete benefits in terms of execution

Set Dynamic Variable name In ActionScript 3.0

我只是一个虾纸丫 提交于 2019-12-21 13:42:15
问题 I need to set custom variable name for every iteration. Why this isn't possible? for (var i:uint = 0; i < 50; i++) { var ['name' +i] = new Sprite(); } *//1840: Syntax error: expecting identifier before left bracket* 回答1: You want to use a hash map to do this. var map:Object = {}; for (var i:uint = 0; i < 50; i++) { map['name' +i] = new Sprite(); } Otherwise you're confusing the compiler. Dynamic names for local variables aren't allowed. 回答2: There is sort of a way around this, depending on

Set Dynamic Variable name In ActionScript 3.0

Deadly 提交于 2019-12-21 13:41:12
问题 I need to set custom variable name for every iteration. Why this isn't possible? for (var i:uint = 0; i < 50; i++) { var ['name' +i] = new Sprite(); } *//1840: Syntax error: expecting identifier before left bracket* 回答1: You want to use a hash map to do this. var map:Object = {}; for (var i:uint = 0; i < 50; i++) { map['name' +i] = new Sprite(); } Otherwise you're confusing the compiler. Dynamic names for local variables aren't allowed. 回答2: There is sort of a way around this, depending on

alpha + RGB -> ARGB?

爷,独闯天下 提交于 2019-12-21 13:41:10
问题 In as3, is there a utility or function to convert an RGB color (e.g. 0xFF0000) and an alpha value (e.g. .5) into a A 32-bit ARGB value? And from ARGB to RGB + alpha? Some explanation: a bitmapdata can take an ARGB value in its constructor, but filling shapes in sprites usually takes RGB values. I would like the aforementioned utilities to ensure colors match up. 回答1: var argb : int = (alpha<<24)|rgb; var rgb : int = 0xFFFFFF & argb; var alpha : int = (argb>>24)&0xFF; 回答2: A,R,G,B is a common

How to dynamically load a progressive jpeg/jpg in ActionScript 3 using Flash and know it's width/height before it is fully loaded

陌路散爱 提交于 2019-12-21 12:48:08
问题 I am trying to dynamically load a progressive jpeg using ActionScript 3. To do so, I have created a class called Progressiveloader that creates a URLStream and uses it to streamload the progressive jpeg bytes into a byteArray. Every time the byteArray grows, I use a Loader to loadBytes the byteArray. This works, to some extent, because if I addChild the Loader, I am able to see the jpeg as it is streamed, but I am unable to access the Loader's content and most importantly, I can not change

Is there any fast library(s) for finding human eyes and mouth in Flash? (Actionscript)

谁说我不能喝 提交于 2019-12-21 12:01:08
问题 So I have real time video stream. With 1 (one) person on It . It Is Black and White, I need to be able to capture this persons eyes and mouth (direction (at least X,Y), state (at least opened or closed) ) So Is there any fast library(s) for finding human eyes and mouth in Flash in such case? (pure Actionscript or Haxe\Java\C++\C port in SWC form...) What do I know Is - some libs are described in this presentation http://www.bytearray.org/?p=1040&cpage=1#comment-330183 Grate example for eyes

Can all flash games be readily ported to adobe air for deployment on ios?

别说谁变了你拦得住时间么 提交于 2019-12-21 11:57:44
问题 Can all flash games be readily ported to adobe air for deployment on ios? For example, if I develop a 2D platform game in AS3, can I simply re-package that for deployment on iOS using Adobe AIR, without needing to modify the codebase? If possible, how do I do that? Just re-package using the AIR SDK's ADT tool? In my game, I use the mouse and keyboard to control the character... the hero follows the mouse cursor and left click fires... how will that translate to touch? I'm new to AIR and haven

TouchEvent.TOUCH_BEGIN, onTouchBegin Freezes after several Reloads

落花浮王杯 提交于 2019-12-21 11:56:21
问题 I am building an Adobe Air AS3 IOS and Android App, in which i have a movie clip in the center of the stage. When you start touching this movie clip, you can move it all around the stage. This is how i'm doing so : Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; MC_M1.alpha = 1; MC_M1.addEventListener(Event.ENTER_FRAME, ifHitAct); MC_M1.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin); MC_M1.x = 0.516 * gameIntro.stageWidthToUse; MC_M1.y = 0.75 * gameIntro.stageHeightToUse; MC

AS3 ExternalInterface call using jquery

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 11:45:16
问题 I'm calling into a flash app embedded in a html page using the ExternalInterface. The following code works fine (I'm using a button to test): $(document).ready(function(){ $("#button").click(function(){ var app = document.getElementById('ApplicationID') console.debug(app) app.pageUnloading() }) }) So this calls into the flash app fine and prints: <embed id="ApplicationID" width="600" height="400" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go