StageWebView Rotation - actionscript-3

I have trouble finding a solution (if at all there is one) to rotate the StageWebView. I need this as I handle the Orientation in my App without autoOrient, therefore I need to rotate the StageWebView.
I tried StageWebViewBridge as well, but I also need the drawViewPortToBitmapData, wha is basicly the reason no ANE out there comes close to the vanilla StageWebView Solution.
I develop on Air for Android/iOS.
Any ideas?

No. There is no way to any transformations with StageWebView.
Why you dont use the HTMLLoader-class? It is a normal DisplayObject and can be rotated, filtered and so on...

Related

StageWebView - hide just for JS

I want to use StageWebView just for communicating with a JS page, without actually showing it at all
Is this possible, and if so, what is the best recommended way of doing it?
Seems that not setting the viewport might accomplish this, as well as positioning the viewport offscreen
First you need the interaction, then you need to put the view off the stage. Take a look at RichWebView which is an alternative to StageWebView https://github.com/myflashlab/webView-ANE
As the documentation says, you can't do this with StageWebView.
The StageWebView class provides a simple means to display HTML content
on devices where the HTMLLoader class is not supported. The class
provides no interaction between ActionScript and the HTML content
except through the methods and properties of the StageWebView class
itself. There is, for example, no way to pass values or call
functions between ActionScript and JavaScript.
Using HTMLLoader you could do this.

Is AS 3 capable of supporting a game with 600 + rotating images?

I made a simple game where squares collect crystals and bring them to a base and replicate. They are just .png images that rotate and move and yet when their number becomes greater than 500, the game starts to lag out. In Java I'm able to do a similar thing with 30,000 units. Could I be doing something wrong or is Flash just not that capable?
I'm using Flash Builder.
I get the image like this:
[Embed(source="../lib/red.png")]
public var redImgClass:Class;
public var redImg = new redImgClass();
Then I pass redImg to a "unit" class which takes an instance of "Bitmap"
I change its "rotation" and x,y members every frame.
Am I doing something wrong here?
you're not using Stage3D. If you use Starling, ND2D or write your own Stage3D wrapper you'll be able to get better performance.
You can also take a look at Jackson Dunstan's blog, this post is especially helpful: http://jacksondunstan.com/articles/2279
Another possible answer is to use blitting, that is, use a single Bitmap object to draw everything on via copyPixels(). This requires that your rotating crystal PNG be replicated into a sequence of rotated images, which you then use instead of directly changing rotation property. This approach is more performance-friendly, and does not depend on video card performance like Stage3D does.
Adobe's manual on blitting
Some discussion on blitting done by game devs
Daniel's answer is correct in that you should use the Stage3D APIs for greater performance. He didn't however mention that you should seriously consider using Starling, which wraps the Stage3D API with much easier to use classes:
Learn more about Starling here.
Example of the level of performance you could expect from Stage3D.
Starling is what you`re looking for (http://gamua.com/starling/)

How to make efficient dynamic mask in starling

I'm trying to make an interactive book for tablets with animations and page flip.
I'm using starling framework.
My idea of page flip is to mask 2 instances of next page with 2 static quads which are moving and rotating (it works great on pc/mac, but slow on tablets).
Using PixelMask is slow/very slow(10-20fps). Using clippedsprite is fast(40-50fps) but cant rotate the mask.
Are there any other options?
EDIT:
During my search I've found the idea of shaders (AGAL in ActionScript3), but I'm not familiar with this. Is it possible to simulate masking by the use of GPU shader?
EDIT2:
This problem was experienced on iPad1, on iPad3 its 60fps :) Dont know how its going to work on iPad2 and iPad4
I'm pretty sure AGAL is the ultimate answer!
But easiest, and still very good, solution is the smart use of ClippedSprites
(Sprites with clipRect since Starling 1.3+)
I've managed to achieve almost static 60 fps on iPad1.
Just needed to remove filters and stop/flatten animations inside Objects!
Filters are massive performance killers!
You can find here a mask class based on FragmentFilter. i got better results with it. But if you want to implement a PageFlip, you can use this class. And here is an improved version of the pageflip with interactive corners. Hope it helps you :D

HTML 5 Canvas - Realize smooth scrolling per button

I've been google'ing for some time but I can't find a good solution for my problem.
I have a canvas which contains several images. Via a "left" and "right" button I want to scroll smoothly and horizontally thorugh these images. I guess there must be a way to kind of set the focus of the canvas. I tried translate which works fine but I don't want to "jump" to the next section, I want a smooth scrolling...
Any ideas?
For smooth animations in a canvas you need to use the requestAnimationFrame method (http://paulirish.com/2011/requestanimationframe-for-smart-animating/)
I think this is a job for Greensock JS tweening library. It can tween any property that you can expose of any object.
The documentation is very good and there are lots of resourced there to get you started. You can also ask questions about what you are trying to do on the forum.
I used TweenMax for years as a flash developer and I am now starting to use it in JS development.
As per #devnull69 answer, it also utilizes requestAnimationFrame.
Ok, finally I found a way... pretty basic though.
function animate() {
draw();
if(globalVar<300){
globalVar++;
setTimeout("animate();", 100);
} }

Actionscript 3.0 Tween Question

I am currently working on a website for a construction company and I am trying to build a very simple flash intro. I have two images in the falsh intro: a tractor and a picture of clouds in the background.
I am trying to have the clouds appear to float by in the background. It is a very wide image that I am trying to loop through very slowly. It looks pretty cool :) IMO.
For tweening, I have always used TweenLite. The problem I am having is that while the image is moving, it 'blips' and looks pretty choppy. I have adjusted fps and about every other thing I can think of. The only thing that fixes it is when I use Hardware Acceleration (Level 2 - GPU). But this creates all sorts of problems for the HTML page.
My Question Is:
I am just a terrible coder, or would I be better off using Tweener (or something of the sort) or using the native tween engine in flash cs4? Any advice would be great!
Try these:
If the image is in your Library, make sure "Allow smoothing" is checked in your Bitmap Properties (select the image in the Library and go to "Properties" in the Library menu).
Or, if you are loading the bitmap dynamically and using the BitmapData class, make sure you've set the "smoothing" property to "true" on your BitmapData.