actionscript

Actionscript 3: Slice a Bitmap into tiles

对着背影说爱祢 提交于 2019-12-06 13:53:16
问题 I have the Bitmap data from a Loader object and I would like to slice it up into 32x32 squares to use as tiles. What is the most efficient way to do so? 回答1: I have done the work for you. The basic idea is to use the BitmapData function copyPixels, see Adobe Reference for the same . It lets you copy pixels from one region(specified by a Rectangle) in the source BitmapData, to a specific Point in the destination BitmapData. I have created a new BitmapData for each 32x32 square and looped

as3 get zip file on phone from app - file path then unzip

坚强是说给别人听的谎言 提交于 2019-12-06 12:38:56
问题 The following code when run in air works great on the desktop. It allows you to select the file and unzip it and write it. However, when I run it on my phone only "Audio", "Video" , "Images" files become avail able and I can't access a zip file I want to unzip from my phone. Here is the full code: import com.coltware.airxzip.ZipEntry; import com.coltware.airxzip.ZipError; import com.coltware.airxzip.ZipFileReader; import com.coltware.airxzip.*; import flash.filesystem.File; import flash.utils

Flash actionscript - save a text file on server

回眸只為那壹抹淺笑 提交于 2019-12-06 12:27:03
问题 Good day to all. I have a little problem. Can anyone tell me or give a link or something on how to save a text file on the server with some data a user inserted? I need to do this: I have a text box and after pressing enter I need to create/append a file with a log of what a user entered. I have created the box, add listener but I don't know how to create the file. Thank you for help. 回答1: Use flash.net.URLRequest to send the data to a script on the server that saves the data to a file. The

Flash Actionscript 3 - sound seeking/playing

╄→гoц情女王★ 提交于 2019-12-06 09:58:57
问题 I have an audio file which is 4 hours long. I created a standart player to manage my needs - works fine, but you dont seek more than 12180000 miliseconds in position count player stops. If you position the sound to play 12100000 (few seconds earlyear) - plays fine and if it countinues to play without changing the position by code, it is good till the end. I dont get any errors, or any kind of information regarding this kind of issue. soundChannel = sound.play(12180000); // DOES NOT PLAY, NO

Is there any practical use of redefining Math.constructor in JavaScript/ActionScript?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 09:06:22
问题 The Math object does not have a prototype property, but does have a constructor property. Is there any case in which redefining the constructor would be useful? 回答1: MDN says: Unlike the other global objects, Math is not a constructor. All properties and methods of Math are static . In other languages, when a class is static, you can directly use its properties and methods without creating an instance of that class ( an object ). If Math constructor is used, there is no native type to support

Get dimension of locally loaded large image

爷,独闯天下 提交于 2019-12-06 08:36:01
I'm trying to read the width and height of a locally loaded image. This seems to work for images that do not exceed the dimensions limited by the Flash Player 10 ( http://kb2.adobe.com/cps/496/cpsid_49662.html ), but as soon as the images are bigger, the width and height remain 0. The strange thing is that now and then, I can read the dimension of these bigger images, but most of the times not. I understand that this might be because of the player limitation, but then I would at least expect the error to be consistent. I want to check this since there is no use in loading such a big image as

How to restrict the drag and drop area in a canvas

无人久伴 提交于 2019-12-06 08:34:43
I have a canvas,lets say of dimensions 500x600.I have some controls inside that canvas.User can rearrange the controls by drag and drop.But I want to restrict the drag and drop within that canvas. For example:There is a button in the canvas.User can drag and drop the button anywhere inside the canvas.But if the user tries to drag the button out of the canvas boundaries,it should stick in the canvas boundary. How to achieve this? The signature for startDrag() is public function startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void The second parameter allows you to pass a

Actionscript 3.0 Best Option for Subclassing Vector Class (Flash Player 10)

£可爱£侵袭症+ 提交于 2019-12-06 08:31:44
问题 I would like to take advantage of all the goodness of the newer Vector class for FP10, but it seems it is marked as final. I am doing some intensive mathematical processing in Actionscript, and repeatedly process arrays of Numbers. I have previously been using my own subclass of Array(I call it NumericArray ), with added functions such as sum(), mean(), add(), multiply(), etc. This works very well and allows for some clean OO code. However, I am finding through profiling that about 95% of my

Actionscript Beginner [closed]

大城市里の小女人 提交于 2019-12-06 08:03:53
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 7 years ago . I want to learn actionscript but I don't know wether to learn AS2 or AS3. Isn't AS3 an upgrade of AS2? I studied Lingo Scripts for Macromedia Director years back... 1998. (intermediate level) Are there any similarities with Action Script

Create image from data-in-uri (base64-encoded PNG) in ActionScript

回眸只為那壹抹淺笑 提交于 2019-12-06 07:51:05
I have a string of of base64-encoded PNG image that is suitable to use as a src (source) attribute in a <img> tag. However I need to transfer this image to Flash applet where I need to create (show) the image fast . Is there a way to simply use the data string and somehow create an image (inside a Flash movie) from it? Performance of the operation is a core requirement. At the very least you must decode the base-64 data into binary. You can then load the binary data as an image using Loader.loadBytes(). Here's a fast base64 decoder compiled with alchemy: http://www.blooddy.by/en/crypto/ var