How to Calculate 10^5 in Flex - actionscript-3

I am new to flex and I am struggling to know how to calculate 10^5 (10 to the power 5).
If It was a java code I would have written like this
But In this case, I didn't found any example on the web as well.
Any clue!

I'm not 100% sure whether this link is still relevant or not, but the Adobe Flash ActionScript documentation still has Math.pow:
Computes and returns base to the power of pow.

Related

glPointSize equivalent in DirectX 11

I'm rendering a starfield composed from points(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST). If a point get closer to the camera I make it double the size. That worked well with OpenGL 1.x using glPointSize(2.0f)
Is there a way to achieve this with DirectX 11 on Windows Phone 8?
What I need is a way to make a rendered point appear bigger on some custom value.
Any thought is greatly appreciated.
There's no native sprite type in D3D11. Your best bet is to use instancing with a single quad VB and a per-instance point VB. You'd scale by dividing the quad point deltas by the view depth, or applying a standard perspective projection matrix (though the latter would also cause the points themselves to converge at higher distances).

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/)

Actionscript 3.0 depthing changes effect my 2.0 depth management

I'm finally taking the time to go from Actionscript 2.0 to Actionscript 3.0, and I'm trying to figure out how to pull off a simple depthing system I had at my disposal in 2 that doesn't seem to be possible in 3.
The code goes something like this:
onClipEvent(enterFrame){
this.swapDepths(1000+Math.ceil(this._y));
}
This way, I could easily get mock 3D effects as something moves up and down on the screen.
Also understand, this is a really basic application of the idea. Usually I'd put in logic to allow multiple movieclips to exist at one Y value.
Whatever the case, with the changes to AS's depthing, this method is no longer possible in this state. Maybe I just have an incomplete knowledge of how the new system works, I am just a hobbyist AS programmer, but is there a better/simpler/more elegant way to pull this off in AS3.0, short of keeping track of every clip/sprite on the stage?
I'm using Adobe Flash CS4 professional, if that makes any difference. Additionally, this isn't of much importance, yet. I'm still getting my bearings, but I came across the depthing changes during a quick project a few weeks ago when learning about adding Child MovieClips, and it seemed like I could only easily add things to the front or back of the stage, not inbetween.
The main difference between AS 2.0 and AS 3.0 is the depth management. In AS 2.0 you could use any depth you wanted. However, with AS 3.0 you can not (leave any depth unused/empty).
There are still several methods that allow you to change depth, swap depths etc. so you are free to use those.

Depth map (2d+z) algorithm or software

I'm searching for Depth map algorithm for action scrip 3 (or some other language).
My goal is to generate depth map for static image on run time.
I have fount this example http://kode80.com/2009/06/29/papervision-zbuffer-and-dof/, i didn't have the time to investigate it's code but i have the filling its working only with 3d models.
Worst viable option is server side technology that does the work.
Extended description:
I have a task to develop flash application where 3d rotation of a head is simulated by a 2d image uploaded by the user.
There are some japan guys that have managed to do that (http://hairtry.jp/), but the technology that they are using is server side. It generates swf fail with precisely coped eyes and image for the depth map of the uploaded picture. I can't find out what is the sever side technology that they are using so I'm searching for any posible workarounds.
Thanks in advance.
Cheers,
Chavdar Slavov
your easiest solution would be to use a 3d engine, Paper vision seems to be getting out dated, theres a lot of documents on how to use, and tutorials but again not much has been happening with them lately. i suggest Away3d "www.away3d.com" they seem up to date.
for what your asking it is possible to do this 100% in flash but to create a 3d head at runtime and fill the face with hieght maps this is possible, you would need to look at bitmap manipulation.i dont think this is an easy task, what you should learn first is how to add an image to a spheric surface dynamically than look into height mapping by converting certain coulours from the image into different levels of depth i must say im sure this is advanced stuff, i manged to animate a globe that was this same method it looks dodgy but it gives you some source code in the FLA
http://www.ffiles.com/flash/animations/globe_animation_3496.html
The above link will allow you to download my source files, the animation it self is a scrolling image but i used Actionscript to give the globe depth and a sheric look

When to use ContainerMovieClip and when to use UIMovieClip?

I am using Flex with Flash Builder 4 and it provides two classes to work with Custom Flash Professional components, the ContainerMovieClip and UIMovieClip.
I am confused on when to use a ContainerMovieClip and when to use a UIMovieClip.
Since ContainerMovieClip can hold only one component, I don't see how is it better than just placing the component directly on the design area.
I would have thought of using it as a inner frame to arrange multiple components that can be moved together by modifying the X,Y coordinates of the container, but I understand this isn't how it works, right?
I'd appriciate if you could answer this or direct me to an article on
1) When to use UIMovieClip and when to use a ContainerMovieClip?
2) Why ContainerMovieClip can hold only a single component?
Thanks.
RaamEE
Adobe's help docs are very useful and 90% of the time they will answer your questions.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/flash/UIMovieClip.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/flash/ContainerMovieClip.html