actionscript-3

Upload file to server in as3

情到浓时终转凉″ 提交于 2020-01-03 06:03:07
问题 How to upload a File to server in as3? I don't want to browse file by using FileReference.browse(). I tried using URLLoader to get the file and convert to byteArray but as I send it to server using URLVariables it gives IOError=2032. I want update database on the server. The structure would be like email (string) sqlite_db (Blob) I have to send both of these variables inside one request. Any idea! 回答1: The upload process is made much easier by using the UploadPostHelper which is a great class

FileReference.save() duplicates ByteArray

依然范特西╮ 提交于 2020-01-03 05:51:24
问题 I've encountered a memory problem using FileReference.save(). My Flash application generates of a lot of data in real-time and needs to save this data to a local file. As I understand, Flash 10 (as opposed to AIR) does not support streaming to a file. But, what's even worse is that FileReference.save() duplicates all the data before saving it. I was looking for a workaround to this doubled memory usage and thought about the following approach: What if I pass a custom subclass of ByteArray as

Actionscript Tweening with Motion Blur

青春壹個敷衍的年華 提交于 2020-01-03 05:41:07
问题 So i have several items on a page, each of which tweens out or in depending on a mouse event. So far i can do Easing on them when they are going out/in but how do i also set up a tween so that it blurs as the come in and out (motion blur) like the ones in the motion presets. I want to accomplish the same motion preset settings but with Actionscript. Any help is appreciated, thank you. 回答1: You can check out the following article, I wrote in my blog few years ago: Adding Directional Motion

Actionscript 3.0 - tracing the path of a moving body ;

回眸只為那壹抹淺笑 提交于 2020-01-03 05:33:19
问题 I'm learning AS3.0 currently. I am trying to design a simple two body planet simulation. I need to show the paths of the planets on the screen. So my question is, once I have the updated x and y coordinates for the planets at each Timer interval, how do I change the color of the pixel (x,y) of the stage so that it shows the path of the planets? Is there some command of the form stage.x = color? Thanks! 回答1: I recommend using BitmapData's draw() method to render your planets as pixels each

How do I set the state of a SimpleButton with Actionscript 3

别来无恙 提交于 2020-01-03 05:33:11
问题 I have a .fla file created by our designer and he has created a set of SimpleButtons that I have wired to a video player. Now I need to set the status of a button to "over" if the video that it is associated with is playing. The button is somewhat sophisticated graphically so its not something that I want to recreate with AS. Is there some way to just set the myButton.upstate = myButton.overstate while the video is playing? I saw the question here which seems to lead me to believe that

AIR: securityError on OSX (but not on Windows) with URLStream()

社会主义新天地 提交于 2020-01-03 05:22:09
问题 I'm using URLStream to load a file from the harddisk (and I'd like to continue to use URLStream to do so). The file is located in "app-storage:/myfolder/myFile.zip" so I use var f:File = new File("app-storage:/myfolder/myFile.zip"); myStream.load(new URLRequest(f.nativePath)); on Windows this seems to work without problems - but on OS X the URLStream dispatches a SecurityErrorEvent.SECURITY_ERROR with the message: Error #2032: Stream Error. URL: app:/Users/myUserName/Library/Preferences

Flash AS3 loading swf file into banner

心已入冬 提交于 2020-01-03 04:58:08
问题 I'm trying to make a flash banner that is less than 30K, so I want to create a dummy file, that will be the upper layer and the link to the website, and the lower layer will be calling the SWF file from my source. I remember doing it once, but I've searched the web (maybe I just couldn't get my Google query right) and didn't find a solution. Any suggestions? Thanks in advance! 回答1: So you want a .swf to load another .swf into itself? Use the Loader class for that. 来源: https://stackoverflow

Iterating each pixel of a Bitmap image in ActionScript

纵饮孤独 提交于 2020-01-03 04:51:30
问题 Is it possible to iterate each pixel of a bitmap image? Eventually what I'm trying to achieve is that I need to get the coordinate values of each pixel of a bitmap image and change the color of those pixels according to their coordinate values. As I see it, I need to use the getPixels() method but I still did not understand exactly what I should do. 回答1: ( too slow :) ) so this is the sae as above with a linear loop instead of 2 nested loops. //creates a new BitmapData, with transparency,

Retrieving percentage of colors of a MovieClip

时光总嘲笑我的痴心妄想 提交于 2020-01-03 04:48:07
问题 today my question is as follows: I have a game, and one of the phases is that you have to pass a "protective cream" on the doll's body. I already have this effect (image below), I'm using an alpha filter combined with a mask that is drawn. I wonder how can I do to be checking after 20 seconds of the game, if the user has filled 100% of the masks ... My code is this (forgive me, I am beginner and Brazilian ... any questions ask me): stop(); import flash.display.Shape; import flash.events.Event

How to get visible size of DisplayObject with perspective projection

自闭症网瘾萝莉.ら 提交于 2020-01-03 04:47:08
问题 The following is entirely a math question. As we know, PerspectiveProjection delivers perspective transformations in 3D represented by the interdependent values of fieldOfView and focalLength according to the following formula: focalLength = stageWidth/2 * (cos(fieldOfView/2) / sin(fieldOfView/2) (source: bgstaal.net) Q: How to get the visible on-screen size of the DisplayObject (Cube on the above-linked image) to which PerspectiveProjection has been applied? A more thorough description and