Flash / Flex
Creating Greensock Plugins
On 13, Mar 2012 | No Comments | In Animation | By Grant
Creating a plugin for Greensock’s Tweening System is very easy. The following slides show some tips and examples how this can be done.
Read more…
Shape Tween Tip 01: Bounding Box Cheat
On 06, Mar 2012 | No Comments | In Animation | By Josiah Carlson
Flash first introduced the shape tween in 1842 [citation needed], allowing one group of vector shapes to morph into another over a length of frames. It was an awesome tool then, and remains one today … when/if it works. For a shape on frame 01 to smoothly transition to a different shape on frame 10, everything has to be (obnoxiously) just right. There is no one catch-all method that will work for every situation, as a shape tweens behavior is largely unpredictable, especially when using complex shapes with more than one color. That said – the FX that are possible with the ‘ol green tween are very impressive and run extremely light on the file-size frontier — it’s worth the time to get familiar with the tool and hopefully this tip can save you a headache, or at least decrease its duration…
STEP ONE: Select the vector points you’d like to shape tween and duplicate them onto their own layer. Using a stroke with no fill, draw a rectangle outside the bounds of your shape. Now paint bucket fill (set to ‘Dont Close Gaps’) the empty space with a solid color fill and delete all strokes.
STEP TWO: Create your second keyframe, modify the graphics as desired, and create the tween. Scrub through your timeline, you’ll see the difference.
STEP THREE: When your tween is where ya want it, go ahead and make that color fill a #CCCCCC w/1% opacity on every frame. You can always make it this 1% neutral gray color from the onset as well.
Pseudo 3d Collision Detection in a 2d World (AS3)
On 30, Nov 2011 | No Comments | In Animation, Game Development | By Nate Chatellier
Seven2 recently completed the core engine & first level for the Kung Fu Panda game “Tales of Po” hosted by Nickelodeon:
This is an Adobe Flash/AS3 classic side-scrolling brawler game (think Double Dragon, Castle Crashers, etc). Executing this type of pseudo 3-dimensional game (x,y,z) in a space that in actuality is only 2-dimensional (x,y), creates two main problems:
depth sorting & collision detection. Read more…
Application Domain / Magic
On 26, Oct 2011 | No Comments | In Presentations | By Grant
I apologize for how the presentation went this morning. Here is maybe a better presentation?
Please keep in mind I never recompiled the first 5 Dot swfs.
The bone tool and you: An intro to inverse kinematics and flash
On 21, Sep 2011 | 2 Comments | In Animation | By Brandon Delauney
Flash is a great tool for animation, and since the introduction of the bone tool in cs4 it has gotten even better. But for someone new to the idea of working with armatures and IK chains the bone tool can seem confusing, especially to someone used to flash’s traditional way of animating.
The video below is an intro to inverse kinematics in flash, as well as the use of the bone tool.
IK and Flash: The Bone tool
Here are the support files from the video
demoFiles
Grabbing Items From an Array Based on Probability
On 23, Aug 2011 | One Comment | In Web Development | By Kipp Ashford
Ok so it’s not the snappiest title, but something that comes in extremely handy!
Part of making games more fun is introducing an element of randomness. If you’re making a dungeon crawler, you may want to specify different surprise items in a treasure chest. To make the chances equally random can be boring, because most of the time you want the chest to contain good items and only rarely do you want it to spew toxic gas.
Because this is such a common scenario I run into, I wanted to make a class to automate this process. After a lot of googling (and many false starts) I finally came up with something that looked close to what I wanted to do. The result is the WeightedRandomPool class. I’ve created ActionScript and Javascript versions of this code, so hopefully you find this useful.
How to Use:
If we were going to use the above treasure chest example, I might store different strings with the names of possible items in the chest.
var chestItems:WeightedRandomPool = new WeightedRandomPool();
chestItems.add("gold", 10);
chestItems.add("jewels", 10);
chestItems.add("poodles", 2);
chestItems.add("poison", 1);
// Gets an item from the pool.
var sRandomItem:String = chestItems.get();
So in the above example, we have “gold” and “jewels” both with a weight of 10, and “poodles” and “poison” with much lower weights. The weights are all relative to each other. All of them must be positive integers larger than 0.
In the example above, the “gold” and “jewels” are both 10 times more likely to be selected than “poison,” and 5 times more likely to be selected than “poodles.”
Let’s say that in your game you had a curse put on you, and you want to make it much more likely that “poison” will be in the chests. With one line, you can make that happen:
chestItems.changeWeight("poison", 100);
Now since the highest weight is 100, “poison” is 10 times more likely to be selected than “jewels” or “gold.” Sadly for the poodles, they would be 50 times less likely to be selected than poison.
The api for the javascript version is exactly the same. Below are both versions.
I hope this class helps you out in your Flash and JavaScript projects. Enjoy!
p.s. A special thanks goes out to ‘stephj’ of XDA-Developers forum for the code I blatantly ripped off adapted. The original post can be found here.








