I'm finally trying to port my Flash games to apps, starting with iOS. I'm stuck on the image saving functionality. In swf's, I used jpegencoder to save to the desktop server. It seemed with some research that that code should still work on mobile, so I tried it, but it doesn't seem to do anything when testing on an iPhone from Adobe AIR the button registers a click but there is no image that can be found, no notification of anything happening, no asking for permission to access images etc.
This is the old code:. So with more research, I found the CameraRoll code which looked simple and like it's made specifically for iOS. So I tried that but I'm having the same issue: no evidence that anything's happening.
No image saved, no errors, no permission requests. Like, I don't even know where I'm going wrong.. Are apps being in testing mode even able to save images?
Should I be expecting a notification of some sort to pop up? Is there a size limit on things being saved to a phone? And it is indeed a very nice and neat way to do it. I guess I was having issues with testing properly and just couldn't tell that it was working.
When working properly, it asks for permission once on the device, and after that it saves without notification, so I added some animations to hide the Saving button for a few second so the user doesn't over spam themselves, and to give a visual cue that the button was pressed.
Mobile apps behave much like Desktop apps but your code is not really adapted for that anyway. You are not even trying to use the classes specifically made for desktop and mobile like the File class for example. Second, pick a destination on mobile it's usually File. I've followed a few guides online, but I can't seem to get anything to work.
My understanding is that I need to break the Bitmap into it's BitmapData components, convert that to a 'byteArray' which is saved, or optionally encoded then that same byteArray data is retrieved and made into a movie clip onto the stage. However, no matter what I do, I can't get it to properly recreate the bitmap once i've grabbed the data For example, a blur filter normally affects an area larger than the size of the original image.
The generateFilterRect method lets you find out the size of this destination rectangle in advance so that you can size the destination image appropriately before you perform a filter operation.
Some filters clip their destination rectangle based on the source image size. For example, an inner DropShadow does not generate a larger result than its source image.
Parameters sourceRect : Rectangle — A rectangle defining the area of the source image to use as input. Determines a rectangular region that either fully encloses all pixels of a specified color within the bitmap image if the findColor parameter is set to true or fully encloses all pixels that do not include the specified color if the findColor parameter is set to false.
If the value is set to false , returns the bounds of where this color doesn't exist in an image. Returns an integer that represents an RGB pixel value from a BitmapData object at a specific point x , y.
The getPixel method returns an unmultiplied pixel value. No alpha information is returned. All pixels in a BitmapData object are stored as premultiplied color values. A premultiplied image pixel has the red, green, and blue color channel values already multiplied by the alpha data. For example, if the alpha value is 0, the values for the RGB channels are also 0, independent of their unmultiplied values. This loss of data can cause some problems when you perform operations.
All BitmapData methods take and return unmultiplied values. The internal pixel representation is converted from premultiplied to unmultiplied before it is returned as a value. During a set operation, the pixel value is premultiplied before the raw image pixel is set. Parameters x : int — The x position of the pixel. This method is similar to the getPixel method, which returns an RGB color without alpha channel data.
Generates a byte array from a rectangular region of pixel data. Writes an unsigned integer a bit unmultiplied pixel value for each pixel into the byte array. Parameters rect : Rectangle — A rectangular area in the current BitmapData object. Generates a vector array from a rectangular region of pixel data.
Returns a Vector object of unsigned integers a bit unmultiplied pixel value for the specified rectangle. Computes a value binary number histogram of a BitmapData object. This method returns a Vector object containing four Vector. The four Vector instances represent the red, green, blue and alpha components in order. Each Vector instance contains values that represent the population count of an individual component value, from 0 to Performs pixel-level hit detection between one bitmap image and a point, rectangle, or other bitmap image.
A hit is defined as an overlap of a point or rectangle over an opaque pixel, or two overlapping opaque pixels. No stretching, rotation, or other transformation of either object is considered when the hit test is performed.
If an image is an opaque image, it is considered a fully opaque rectangle for this method. Both images must be transparent images to perform pixel-level hit testing that considers transparency.
When you are testing two transparent images, the alpha threshold parameters control what alpha channel values, from 0 to , are considered opaque. Parameters firstPoint : Point — A position of the upper-left corner of the BitmapData image in an arbitrary coordinate space. The same coordinate space is used in defining the secondBitmapPoint parameter.
Use this parameter only when the value of secondObject is a BitmapData object. Use this parameter only when the value of secondObject is a BitmapData object and both BitmapData objects are transparent. Locks an image so that any objects that reference the BitmapData object, such as Bitmap objects, are not updated when this BitmapData object changes.
To improve performance, use this method along with the unlock method before and after numerous calls to the setPixel or setPixel32 method. Performs per-channel blending from a source image to a destination image. For each channel and each pixel, a new value is computed based on the channel values of the source and destination pixels. The redMultiplier , greenMultiplier , blueMultiplier , and alphaMultiplier values are the multipliers used for each color channel.
The source image can be a different BitmapData object, or it can refer to the current BitmapData object. Parameters randomSeed : int — The random seed number to use.
If you keep all other parameters the same, you can generate different pseudo-random results by varying the random seed value. The noise function is a mapping function, not a true random-number generation function, so it creates the same results each time from the same random seed. You can use the logical OR operator to combine channel values. If the value is true , a grayscale image is created by setting all of the color channels to the same value.
The alpha channel selection is not affected by setting this parameter to true. Remaps the color channel values in an image that has up to four arrays of color palette data, one for each channel.
Flash runtimes use the following steps to generate the resulting image:. Cross-channel effects can be supported with this method. Each input array can contain full bit values, and no shifting occurs when the values are added together.
This routine does not support per-channel clamping. If no array is specified for a channel, the color channel is copied from the source image to the destination image. You can use this method for a variety of effects such as general palette mapping taking one channel and converting it to a false color image. You can also use this method for a variety of advanced color manipulation algorithms, such as gamma, curves, levels, and quantizing.
The source image can be a different BitmapData object, or it can refer to the current BitmapData instance. Generates a Perlin noise image. The Perlin noise generation algorithm interpolates and combines individual random noise functions called octaves into a single function that generates more natural-seeming random noise.
Like musical octaves, each octave function is twice the frequency of the one before it. Perlin noise has been described as a "fractal sum of noise" because it combines multiple sets of noise data with different levels of detail.
You can use Perlin noise functions to simulate natural phenomena and landscapes, such as wood grain, clouds, and mountain ranges. In most cases, the output of a Perlin noise function is not displayed directly but is used to enhance other images and give them pseudo-random variations. Simple digital random noise functions often produce images with harsh, contrasting points. This kind of harsh contrast is not often found in nature. The Perlin noise algorithm blends multiple noise functions that operate at different levels of detail.
This algorithm results in smaller variations among neighboring pixel values. Parameters baseX : Number — Frequency to use in the x direction. For example, to generate a noise that is sized for a 64 x image, pass 64 for the baseX value. For example, to generate a noise that is sized for a 64 x image, pass for the baseY value.
Larger numbers of octaves create images with greater detail. Larger numbers of octaves also require more processing time. The Perlin noise function is a mapping function, not a true random-number generation function, so it creates the same results each time from the same random seed.
If the value is true , the method attempts to smooth the transition edges of the image to create seamless textures for tiling as a bitmap fill. If the value is true , the method generates fractal noise; otherwise, it generates turbulence. An image with turbulence has visible discontinuities in the gradient that can make it better approximate sharper visual effects like flames and ocean waves. If the value is true , a grayscale image is created by setting each of the red, green, and blue color channels to identical values.
The alpha channel value is not affected if this value is set to true. By manipulating the offset values you can smoothly scroll the layers of a perlinNoise image.
Each point in the offset array affects a specific octave noise function. Performs a pixel dissolve either from a source image to a destination image or by using the same image. Flash runtimes use a randomSeed value to generate a random pixel dissolve.
The return value of the function must be passed in on subsequent calls to continue the pixel dissolve until it is finished. If the source image does not equal the destination image, pixels are copied from the source to the destination by using all of the properties.
This process allows dissolving from a blank image into a fully populated image. If the source and destination images are equal, pixels are filled with the color parameter. This process allows dissolving away from a fully populated image. In this mode, the destination point parameter is ignored. Scrolls an image by a certain x , y pixel amount. Edge regions outside the scrolling area are left unchanged. Parameters x : int — The amount by which to scroll horizontally.
Sets a single pixel of a BitmapData object. The current alpha channel value of the image pixel is preserved during this operation. The value of the RGB color parameter is treated as an unmultiplied color value. It is like cutting off the head to prevent headache. Kelvin Luck. I asked a similar question to an Adobe employee at an event as was told that this would be possible.
I was a bit surprised because obviously a malicious app written in AIR would reflect badly on AIR itself but he was firmly of the opinion that AIR would be powerful enough to write apps useful or malicious and that users should only install AIR apps that they trusted.
This sounds different to what JD is saying above so not sure if Adobe have changed their mind on it in the last month or so…. September 5, at pm. I too would be concerned security wise if every air app could take screen caps, although I can see some usefull functionality in it as well.
September 7, at am. I think we can create screen capture app using mdm Zinc V2. It now supports AS 3 and Flex2. October 2, at pm. I have question… What kind of database work best for AS3?? October 20, at pm. February 14, at am. No joke, sharing a desktop is not a bad feature. I can allow access to my web cam. What is different about a desktop. Please Adobe, let me build a screen cast client that does not require an operating system specific driver or java.
Not that java is bad, I just like it for my server. March 20, at pm. Noel B. The security concerns are way off base. Adobe Air already has file system access, meaning that it can already open, copy, and send a large variety of local data surrepticiously to a foreign server as can pretty much any application you download and run locally.
April 16, at pm. August 12, at pm. Muhammad Hassan. May 10, at pm. Andrew Westberg. You are commenting using your WordPress.
0コメント