How to draw different shapes using pencil on group container and resize and rotate it in flex4? - actionscript-3

All operations like moving,rotating,resizing drawn shape can be performed.I'm using as3 and flex4.6.

It seems like you have to use object handles library for moving,rotating, re sizing shapes ..
you can download this library from the below links.
https://github.com/marc-hughes/ObjectHandles
http://www.objecthandles.com/

Related

Create Diagonal image from bitmap image in windows phone

I want to make a diagonal/ triangle shape image from bitmap source without using any polygon control, how to do this in windows phone.
Hm what do you mean without using any polygon controls?
You can create a WriteableBitmap, and draw on it with any tools you prefer. If you want to avoid all additional tools you can call set/get pixel methods and for loops.
When you are happy with your WriteableBitmap you can create a BitmapImageSource and then call .AsBitmap() on your WriteableBitmap. With that complete you can then use the whole imaging SDK chain.
Edit: You can find the .AsBitmap method in Nokia.InteropServices.WindowsRuntime namespace.

How to use 'OpenCV' in ActionScript3?

I would like to use OpenCV in my actionScript 3 code.
Is there a way to do so ?
I have a list of coordinates to draw a polygon on a mask,
and I need a way to grow the polygon and shrink it and also to add feather to it,
using OpenCV functions (I do not want to use AS3's 'scale').
Can this be done ?
you can not use OpenCV in actionscript-3, because actionscript-3 is a advanced language, but openCV is made by C-language, it's a base language

ActionScript3: How to make an animation out of a series of images?

I'm new to AS3 and I'm trying to create a simple game with it.
So far, I have been able to draw images like this:
[Embed(source = 'C:/mypath/myimage.png')]
public static var myImageClass:Class;
private var myImage:Bitmap = new myImageClass();
and then render myImage.
but that draws only a picture with no animation.
What I want is to import this picture:
and then cut the image to series of subimages and draw an animation out of them, rather than a single image. How may I do this?
Thanks!
This is called "Blitting". You could accomplish it with fairly decent results, depending on your deployment target and how many animations you require, using BitmapData.copyPixels(), but it's more ideal to use the Starling Framework, which employs Stage3D hardware acceleration.
More here:
Introducing the Starling Framework (Video tutorial)
Starling documentation
What you are looking for is SpriteSheet support. You can easily write this yourself or use existing libraries (like Starling for instance).
The idea is to draw an area of the image at each frame to actually create the animation. Depending on the format of your sprite sheet, you may have to add another file to describe the positions of each rectangle to draw.
This page explains how to implement it.

How to extract the shape of MovieClip?

We have a flash application that we are planning on converting to javascript. It's a pretty simple map application with an image as the background and a bunch of simple polygon movie clips that represent destinations on the map.
I would like to iterate through each movie clip and extract the shape into an array of x,y points to redraw the polygon using an external javascript function.
Is this possible with actionscript?
If you want to export the shape coordinates at author time, you can do try the JSFL script recommented by #strille or this one or export transparent images (if that's not too limiting for your application).
If you need to export the shapes at runtime, you can use the awesome as3swf library to decompile the swf and export the shapes. Have a look at the ShapeExport wiki as there are couple of handy exporters for js like JSCanvasShapeExporter and the more generic JSONShapeExporter
There are ways you can read the coordinates from an SWF. For instance, I've written a parser in PHP (link). Getting the data doesn't help though, as it turns out. The Flash painting model is different enough from the HTML5 one enough to make transfer exceeding difficult. The main obstacle I discovered is that in Flash, a path can be filled with two fill styles: one for area enclosed by the path, the other for enclosed area considered to be "outside" by the even-odd rule (e.g. the pentagon in the middle of a star). Since the HTML5 canvas let you specify only one fill style, you can't redraw shapes from Flash accurately. I was trying to create a tool that extract shapes as SVG and was getting a lot of gap and holes in the result.
Flash Player 11.6 introduced readGraphicsData() which does exactly what you ask for.
If you need to target an earlier version, then there's no simple way to read shape coordinates from a display object with ActionScript at runtime unfortunately.
If you just want to extract the shape coordinates once someone has written a jsfl script for Flash CS3 which looks like it might be able to help you out.

actionscript library for interactive path drawing (or any other library for the equations

I am making a flash app where I want to have a user defined viewport like the stage in the flash IDE which the user can use to define objects that have a starting postition somerwhere off or on the stage and an ending position either or on or off the stage with the object then tweening between the two points.
My question is this: I want the user to be able to define a curved path for the object to tween along. Is there a library of code that I can use to define curved paths for the app?
Ideally I would like something similar to the functionality available in Flash, so a bezier curve sort of path that is subdivided into handles that can be dragged to define the path of the tween.
If there isn't an existing library, then do you know of the functions that I would need to define (mathematical equations related to drawing curves etc)?
Many thanks
You could use TweenMax with the BezierPlugin
Or define the path elsewhere and use LinePath2D