Introduction to 3D in Flash

Found a decent tutorial from the Away3D blog that runs through all the basics of 3D in Flash.

 No doubt some topics will be really simple and familiar but it's great in that it gives a brief overview and some nifty examples.

http://www.flashmagazine.com/Tutorials/detail/flash_3d_basics/

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Playing embedded videos in reverse

Often when you're using video in flash (embedded in the timeline), you'd like to be able to do one of these things:

  1. Play it backwards, using prevFrame() for example or
  2. Jump to an arbitrary frame using gotoAndStop(frame)

Unfortunately this isn't normally possible. This is because when video is encoded, it's not really storing every frame, it's storing the difference between frames. So frame 1 is stored in total, but frame 2 is really storing just the pixels that are different between frame 2 and frame 1, frame 3 is storing the differences between 2 and 3 etc.

The problem with this is that it's an inherrently one directional process - if you want to play a video backwards, the information isn't available. The solution? When you import a video into flash (by dropping it into the timeline) you can change your import settings to make it possible to play backwards.



If you set the "Key frame interval" to 1 (2 is also sometimes good, experiment for yourself for best results) playing backwards is now possible.

The benefits are:

  • The video will look better quality when stopped on any frame
  • The video can be played in reverse
  • You can jump to any frame in the video

The drawbacks:

  • There's only one but it's significant - massive increase in filesize! Often this is prohibitive :(
Check out the example and happy flashing!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Using Variables in XML

Everytime I use xml internally in actionscript I always forget how to make use of variables and constants.

Take the follwoing code:

 <player name="Brenton" number="7" position="RW">
        <round number="1" goals="7" assists="4" foulsFor="1" foulsAgainst="2" saves="0" goalsConceded="0" bonus="3" />
</player>

Now as there begins to be multiple players the round number will be generic between players so we might as well make it a constant.
This is achieved by adding curly braces {} around the constant name. {ROUND_1}

 <player name="Brenton" number="7" position="RW">
        <round number={ROUND_1} goals="7" assists="4" foulsFor="1" foulsAgainst="2" saves="0" goalsConceded="0" bonus="3" />
</player>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Augmented Reality T-Shirts

The people at Squidder have created this t-shirt that uses augmented reality to display your last Twitter post. Neat.

 More info on the squidder website

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

JiglibFlash AS3 3D Physics Engine

Howdy peeps. Just came across this neat AS3 3D Physics Engine called JiglibFlash, which is ported from the c++ open source physics engine jiglib.
It has support for Papervison 3D, Away 3D and Sandy 3D.

JiglibFlash AS3 3D Physics Engine

Check out JiglibFlash here and a bizarre soccer game demo.

Peace out

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Alpha channel masking in flash

If you want to use a mask that isn't a regular "on/off" mask (for example you want to use a gradient as a mask) here's how you do it in flash:

You have to set both the mask and the thing you're masking to use bitmap caching. You also need to set the mask with code (not using a mask layer in the IDE).

So some example code would be:

sprite1.cacheAsBitmap = true;
sprite2.cacheAsBitmap = true;
sprite1.setMask(sprite2)

Note: this requires version 8. Also note, this picture actually has no relevance to this topic, I just thought it was cool.

Currently rated 2.0 by 4 people

  • Currently 2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Custom easing with TweenLite

Bounce.easeIn getting you down? Strong.easeOut not quite right? Well there are a couple of ways to use completely custom easing curves with TweenLite.

The first is the official way, which is great ... the problem is of course that it costs money. And we're in the middle of a financial crisis over here!

So this guy has also written his own way of doing it. You draw the curve using his flash app (terrible interface, but it works) and then use the resulting array of bezier points with the ZigoTween class.

Here's a code example, and the files you need are attached to this post. Happy easing!

var zt:ZigoTween = new ZigoTween([{Mx:0,Nx:0,Ny:-1000.00000,My:0,Px:500,Py:500},{Mx:500,My:-500}] );
TweenLite.to(mc,1,{x:200,ease:zt.ease});

ZigoTween.zip (976.00 bytes)

rokkan_bezierdefiner.swf (31.75 kb)

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Eyeblaster and Eclipse

If you are making eyeblaster banners with eclipse and are sick of all the warnings. Add the eyeblaster libraries to your linked libraries. 

If you have the eyeblaster mxp installed you can find them here -

WIN  C:\Documents and Settings\yourusername\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Include 

MAC  ~/User/Library/Application Support/Adobe/Flash CS4/en/Configuration/Include/

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Fractal trees in Box2D

Most of the experiments I make these days have something to do with either fractals or Box2D, so I had this brilliant thought on the weekend ... how about fractal trees in Box2D! Ok, maybe it's not that brilliant.

It's pretty straightforward demo right now, but there's something cool about seeing physics-ey trees swaying realistically (as there is with most stuff in physics engines).

If anyone's interested in the source I'll release it at some point. Hopefully it'll end up being used as part of a game that I have in mind, look out for more updates :)

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Applescript for CD/USB FScommand

There are just a couple of things to remember with the applescripts that you activate with FScommand from flash

Below is the applescript that we use to open a pdf from the cdrom. You'll notice that I have commented out the command activate. This is because the flash projector runs in full screen and I don't want a finder window as well as the pdf to open on top. Just change the open document command so that it points to your file.

Applescript:

tell application "Finder"

(*activate*)

open document file "document.pdf" of folder "pdfs" 

of folder "data" of folder "mac" of disk "CD"

end tell


When you save the applescript do it as an appliction bundle. There is the option to save just as an application but this will not produce a universal app that runs on both intel and PPC macs. Uncheck the start up screen option so that there is no promt when the script is run. Check run only if you want to protect your script.
 
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5