blog

ActionScript ArchiveJozef Chúťka's blog — blog.yoz.sk/category/actionscript/page/9/

March 19, 2010

No comments

fork game of life Graphics pixel bender shorten Sprite with wonderfl

Game of life (update)

A black-and-white grid with clusters of live cells from Conway’s Game of Life.

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton. The “game” is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input from humans. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

Read the rest of this entry »

March 17, 2010

5 Comments

assignments functions instations operators optimization statements

Common Tricks in ActionScript Code Shortening

Feet on a bathroom scale whose display reads 'HELP!'.

Code shortening can make your code more readable as well as more unreadable :-) . While it is recommend to use coding conventions and standards, in some cases you can spare a lot of lines using some shortening. In fact there must not be a conflict between using convetion vs. using shortening, and soon after you get used to some “shortcuts”, your code may be reduced in reasonable amount of lines. Some reading about code optimization can be found here, this article extends optimizations.

Read the rest of this entry »

March 12, 2010

No comments

Button ButtonBar rating RatingButtonBar

RattingButtonBar class

A row of black, red and yellow stars.

RatingButtonBar class extends ButtonBar and is meant to be used for ratings. Just like common star ratings all over the internet. Based on ButtonBar it makes it easy skinable for developers. Use bindable selectedIndex to get index of selected rating (zero based).

Read the rest of this entry »

March 4, 2010

6 Comments

BasicRenderEngine Cube DisplayObject3D Papervision 3D QuadrantRenderEngine sortMode ViewportLayer ViewportLayerSortMode z-sort

Fixing Z-sorting in Papervision 3D (update)

A cube made of smaller cubes, with four white squares visible from above and a black side.

It may be very tricky thing to get papervision 3d scene rendered correctly event for the simpliest objects. In my case, I have created simple 3d scene with few primitive objects (8 cubes). Cubes are positioned close to each other to create shape of bigger cube + some small space between. Cubes are added into wrapping DisplayObject3D, later wrapper is added to scene in order to make it easy to rotate cubes as a group. Camera targets the center of the scene. In the demo, there are 3 sliders to rotate wrapping object in each x, y, z axis + two buttons that rotates wrapper in the problematic possition (based on z-sorting fix approach). Finally I managet it to work, you can follow my approaches below. Notice the changes are not cummulative, each approach comes from original Application.mxml. All of the ideas collected online from blogs, forums etc.

Read the rest of this entry »

February 18, 2010

3 Comments

BitmapData fps pixel bender Shader ShaderJob

Pixel Bender Disco

An abstract blurred green image.

While playing with pixel bender, I created some simple sahders that when combined, reminds me of winamp visualizations effects. Feel free to use any in your own projects.

Read the rest of this entry »

February 16, 2010

No comments

base64 Bitmap ByteArray ExternalInterface PNGEncoder

Inline Images

A snapshot example showing an image data URL over colourful circles.

Have you ever heard about inline images? Inline images use the data URI scheme to embed images directly within web pages. As defined by RFC 2397, data URIs are designed to embed small data items as “immediate” data, as if they were referenced externally. This basicaly means, you can insert base64 encoded byte code of any image directly into html file. Using inline images saves HTTP requests over externally referenced objects. Data URIs can potentially store any type of data, not just images!

Read the rest of this entry »

February 12, 2010

No comments

ActionScript ExternalInterface JavaScript

Quick tip: ExternalInterface.call is synchronous!

A hand holding a red stopwatch.

It is a little wonder to me how flash player communicates with JavaScript. Calls are fully synchronous, it works as those (fp and js) were fully integrated into each other. To simulate this lets test some simple flow:

Read the rest of this entry »

February 10, 2010

4 Comments

allowscriptaccess eval ExternalInterface JavaScript

Full JavaScript Access From ActionScript (update)

Syntax-highlighted HTML showing the head element and metadata.

Have you ever tought about accessing DOM from ActionScript? In fact, you can do it and even far more. You can create and call JavaScript methods and objects, access cookies, change styles… All you need is correct AllowScriptAccess parameter within your flash object. No framework needed here, no hacks, ExternalInterface takes care.

Read the rest of this entry »

February 8, 2010

7 Comments

allowscriptaccess FlexIFrame input opaque text transparent wmode

TextInput wmode opaque/tranpsarent workaround

Diagram showing an HTML text input over an mx:TextInput component.

Many of you have come accross the horrendous bug that happens with text input in flash when the swf is embedded with wmode=transparent/opaque. It has been much discussed (Firefox Bugzilla entry for this bug, Adobe Forum discussion, etc.), but it seems that in all the years that this bug has existed nothing much has been done. A lot of workarounds have been published, many of them based on custom key mapping etc… My workaround uses html element <input type=”text”> that is placed right over flex <mx:TextInput>. Html element is styled transparent (no design) so user will not notice.

Read the rest of this entry »

February 4, 2010

No comments

shorten URLLoader URLLoaderDynamic URLRequest URLShorten URLShortenEvent URLVariables

URLShorten Class (update)

URL shortening is a technique where a provider makes a web page available under a very short URL in addition to the original address. There are hundreds of provider out there, but only a few of them provides public api and crossdomain.xml. I put toghether some of those that work and URLShorten class was created :-) feel free to use it and enjoy

Update: jdem.cz, tinyurl.com, bit.ly, tr.im, is.gd providers implemented.

Read the rest of this entry »

« Older Entries

Newer Entries »