Posted by: Actionscription | October 8, 2009

Blu-ray beats HD DVD

As the last person to ever know anything outside of programming, and as a movie buff that owns but 3 DVDs (all standard def), I never found out who won the Sony Blu-ray versus Toshiba HD DVD battle.  So, after a few Google searches that ranked articles from 2005 first, I just wiki’ed Blu-ray and, yes, Blu-ray prevailed.

Check out my source: Wikipedia: Blu-ray DVD

Why write about this? Well, I think it’s a bit funny that I’m so out of it and that Google thinks that if you’re searching “Blu-ray v HD DVD”, you’re doing a historical search :O)  I guess, in some strange way, I also enjoy advertising my ignorance.

Posted by: Actionscription | April 2, 2009

Directory Structure 101

Com.actionscription.blahbityblah

So, setting up a proper directory for all your AS3 code is an important first step in your project. If you do it wrong, you’ll be faced with the daunting task of updating each class to reflect any changes you make in your directory structure.  So, through trial and error, I finally discovered the basics and universals in this type of organization. Here we go.

Proper directory structure allows easy code sharing and code reusability. Thus, you need to place your personally authored code in a directory that only you will ever use. This prevents naming conflicts later on if, for example, you import someone else’s code and they happen to have named a class the same as a class that is already in your project.  Unique directory names ensures that the package is unique for each author’s classes, and therefore classes w/ the same name are easily distinguishable by their location in unique directories.

But what do I name it?

Because they are unique with only one owner each, domain names are the standard by which most developers name their directories. Generally, a developer reverses the domain name. If I owned actionscription.com, i would start my directory structure with a com folder, in which I would have an actionscription folder in which I would further organize my code with maybe data, utils, events, controllers, etc folders (whatever folders you want).

ex: com > actionscription > list of more folders

Now I know and knowing is half the battle. Check out GoToAndLearn’s video tutorial on setting up a custom class folder as your location for reusable code.

Posted by: Actionscription | April 2, 2009

Rotate Pic in 3D

Rotating that beautiful picture in 3 delicious dimensions is easier than you thought.

Mr. Lee Brimey, you are so awesome!

So I stumbled onto Lee Brimelow’s Flash Blog entry on transforming a picture.  I’m going to combine his distortionclass w/ Keith’s 3D square class to flip pics.  Here’s Lee’s entry (http://theflashblog.com/?p=218).

And re-visit my 3D rotation entry for how I’m utilizing Keith’s 3D classes. (http://actionscription.wordpress.com/2009/03/12/3d-rotation/)

Posted by: Actionscription | March 14, 2009

Get the Set out of Here

Getter Setter methods? I never really understood the purpose. If you want a property read/writable, then why not just make it a public variable? Well, that logic has been sufficient until possibly now.

Context

In attempting a 3D tween of a sprite without using Player 10 and it’s Z axis, I came across a conflict in using my preferred tween engine (TweenLite) with an onFrameEnter 3D class (Kieth Peters).  The tween engine and my application run on a time-based tween structure. The 3D class runs on frame rate.  That is the first dilemma. The second is that the tween engine tweens properties only–not methods (that in turn set numerous properties).  This would be the more important dilemma in this posting.

Back to the Point

My little predicament might just be the perfect scenario for using a getter setter function. No? Yes?…  Well, according to my understanding, getter/setter functions enable a programmer to treat a method as a property. That is, you can refer to your hypothetical coolSquareObject.adjustedX if the coolSquareObject class has a public get and/or set method for adjustedX.  Confusing? Well, the basic thing to understand is: This enables the happy programmer to use a method as a propert, essentially allowing him/her to create a custom property.  So, the following is a method that helps me rotate an object around the Y axis:

public function rotateY(angleY:Number):void
{
	var cosY:Number = Math.cos(angleY);
	var sinY:Number = Math.sin(angleY);

	var x1:Number = x * cosY - z * sinY;
	var z1:Number = z * cosY + x * sinY;

	x = x1;
	z = z1;
}

Using a setter function, I can turn the method into a property:

public function set rotateY(angleY:Number):void
{
	var cosY:Number = Math.cos(angleY);
	var sinY:Number = Math.sin(angleY);

	var x1:Number = x * cosY - z * sinY;
	var z1:Number = z * cosY + x * sinY;

	x = x1;
	z = z1;
}

Voila! The method now can be tweened as a property in my tween engine….  Um, not Quite!  Things aren’t that easy. I also need to set up a getter function.  I’m guessing (but not certain) that the tween engine refers to the current state of the property while it calculates how much to change it over time. Thus, we change the set function a little. It needs to store the inputed angle. And we return that angle in the get function. See below:

public function set rotateY(angleY:Number):void
{
	_angleY = angleY;
	var cosY:Number = Math.cos(angleY);
	var sinY:Number = Math.sin(angleY);

	var x1:Number = x * cosY - z * sinY;
	var z1:Number = z * cosY + x * sinY;

	x = x1;
	z = z1;
}

public function get rotateY():Number
{
	return _angY
}

Well, I’m not getting enough work done and the veggie garden patch is calling, so I have to end this here and continue later.  See you soon.

Special note about Getter/Setter functions (Flash CS3): These keywords are supported only when used in external script files, not in scripts written in the Actions panel. Also, you must specify ActionScript 2.0 and Flash Player 6 or later in the Flash tab of your FLA file’s Publish Settings dialog box. – Flash Help Documentation

Posted by: Actionscription | March 12, 2009

3D Rotation

As I mentioned in my overt worship review of the class, TweenLite has a shortRotation plugin that allows one to tween three rotation properties: rotateX, rotateY, and rotateZ… mmm “Z”, as in 3D Z.  So, just how do you create a three dimensional object that will understand these three variables? I set out to determine the answer to just that and I found one. A horrible one. One that would cost me hundreds or thousands of $.   I am working on a second solution, which will cost nothing but time, exorbitant elbow grease, and thorough research (check it out halfway through this post).

3d Rotation the easy way: Buy Flash CS4

uggh! I’m still using CS3 and only for my Flash software. My illustrator, photoshop, premiere, and aftereffects are still at the lowly level of CS2 and for economic reasons, I’m stuck w/ my outdated software configuration for awhile.  But if you’re not in my boat or on the same sea as my boat, consider buying the latest, greatest CS4 Flash to make 3D manipulation inherent in flash display objects.  Yep, inherent, built in, easy.

In Flash CS3 and below, a display object (i.e. sprite or movieclip) only recognizes one rotation property (rotation: Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation, which is usually the upper left, corner or 0,0). This property only rotates objects in the 2D flat space of the Flash stage.  To make 3D work in this flash, one must “fake” it with math. Lots of math, Points, lines, fills, trig, arrays, and sometimes Matrices.  Yippee kayae!

In Flash CS4 and above (as of writing there is no above), a display object (i.e. sprite or movieclip) recognizes four (4) rotation properties. Holy fuck! Yeah, four rotation properties:

  1. rotation: Same as in CS3. 2D rotation.
  2. rotationX: spin that shit around the X axis of the stage, i.e. vertical flipping.
  3. rotationY: spin it around the Y axis of the stage, i.e. horizontal flipping.
  4. rotationZ: spin, baby spin o’er the Z axis of the stage. As far as I’m concerned, a spin around the Z axis is the same as rotation (unless, for some reason, the Z axis does not cross through the orientation point of the object).

So yay. Easy stuff in Flash CS4. If you need some info, this might do the trick: Senocular Eating up 3D in Flash 10

3d Rotation the hard way: Compensate w/ Math

Save some dollars, but lose your wits by simulating 3D w/ ingenius math equations. Actually, it’s not that hard if you get a little help from those awesome folks that paved the way for you already (and lived to document it).  Here are some resources that I find expecially helpful for 3D simulation in Flash CS3 or below:

  • Kirupa’s 3D Section: Exploring 3D
  • Consider getting into Quaternions. And if you do, make sure to tell everyone you know that you’re about to disappear into nerdville for a little bit, only to return in four dimensions.  Actually, despite their intimidating name, Quaternions can save time and processing load in creating/moving objects in 3D space.
  • Book (yeah, not a free resource unless your library is up to date): Foundation Actionscript 3.0 Animation by Keith Peters. This contains some basic and intermediate chapters on 3D simulation in flash (ch: 15, 16, & 17).
  • Flelix Turner has some suggestions, as well: 3D Flash Sites that Work

Have any other suggestions? Let me know and I will add them to this post.
Happy times to you, in the 3rd dimension!

- Actionscription

Posted by: Actionscription | March 12, 2009

TweenLite Recommendation

For a year now, I have utilized GreenSocks tweening class, TweenLite, to animate my content in flash. It lives up to its namesake as being a light addition to your overall swf size and it has proven to be stable, strong, and versatile. In January 2009, GreenSock introduced the latest version: TweenLite 10.  It has many benefits to the old version including the ability to pick and choose which tween functions to include (through it’s plugin system).

Since adopting TweenLite, I haven’t tried any other Tweening engines and would be curious if anyone has good experiences with others (not that I’ll switch over)?  In addition, I’m starting to work on tweening simulated 3D objects in flash. So far, I’m using my own, and Keith Peter’s, tweening formulas, but I saw TweenLites QuaternionsPlugin and have wondered how to implement them in my actionscript.  Any experience w/ this? Let me know!  Otherwise, check out TweenLite if you haven’t, I’m a happy customer! It’s free, by the way, for you cheap bastards…myself included.

TweenLite by Jack Doyle at Green Sock

Posted by: Actionscription | March 4, 2009

Deep Linking in Flash

Wait, what is deep linking? I’ve attached a few examples, but Deep Linking is when the url address bar in a web browser reflects the “page” represented in the flash app. This enables visitors to copy n paste a url of the exact spot in the flash app to a friend in an email or through IM without further instructions on how to get to the spot in the flash app. It also can mean that the forward and back buttons in the web browser actually function to navigate forward or backward in the flash app.  So, does that make sense?  Deep linking basically makes flash sites navigable like ordinary HTML sites.

Examples:

http://filippasmedhagensund.com/
http://www.007.com/
http://www.schematic.com/
http://www.ultrashock.com/

Simple enough?  I’ve found out that I can accomplish this deep linking in flash by using SWFAddress or SWFObject. But, I have yet to figure out the implementation.  From what I can tell so far, SWFAddress is a two part solution: One part is an API in flash (?) and the other is a javascript code in the html.  The class uses eventlisteners and broadcasters to distinguish pages and other class methods to declare the url, title, etc.  Then it must use some external interface to talk w/ the javascript side in the html.  Limited and partial understanding so far, sorry.

Wanna explore on your own? Check out these links:

SwfAddress  – http://www.asual.com/swfaddress/
SwfAddress in SwfObject – http://blog.deconcept.com/2006/10/25/swfaddress/
Thread discussion – http://www.actionscript.org/forums/showthread.php3?t=136497

Posted by: Actionscription | March 4, 2009

Using Word Press as a CMS

I’m trying to make all my new flash sites w/ a wordpress backend. I’ve heard it’s easy enough to reference the WP content feed or something similar. I’ve been basing my experiment on this guy’s, Dave/enoyad, awesome site (the front end version is now down, unfortunately):

http://wordpress.org/support/topic/125458
(Scroll down to enoyad’s post about kidconfucius site.)

More on the subject as it comes up.

Posted by: Actionscription | February 12, 2009

Document Class

A few quick pointers about the doc class:

  • Like all classes, capitalize the name. (i.e. Main.as)
  • When referring to it in Flash CS3 / CS4, do not include the file extension. (i.e. Main)
  • Position the doc class in the same directory as the main *.fla file.
  • Doc class must be public (it is the top level class, after all).
  • If you don’t want your doc class in the same directory as the main *.fla file, specify a classpath in the “Publish Settings” > “Flash” tab > Actionscript Version 3.0 “Settings” > “Classpath”.  (Click the “plus” button and then use the “target” button to locate the directory in which your doc class is or will be.)
  • If Flash CS3 / CS4 can not find your doc class because it isn’t designated in the property or publish settings or because it is misspelled or missplaced, Flash will automatically create a doc class for you and the swf will run without referring to your actual class. Because of this, I recommend using a “hello world” trace function in your doc class while testing if Flash is actually finding and compiling your doc class.

For more info, consult Senocular’s post on the subject in the ActionScript.org forums:

http://www.kirupa.com/forum/showthread.php?p=1950401

Posted by: Actionscription | February 11, 2009

Cascade Physicians Site Launch

Screenshot of cascadephysicians.com

Screenshot of cascadephysicians.com

I just launched this new beauty: www.cascadephysicians.com

The site is a full browser flash site, that scales to all browser/window sizes. It’s made entirely using Actionscript 3.0, loads content dynamically, adjusting the layout accordingly.

Some fun features:

  • Print all new patient forms at the click of a button
  • Zoom and interact w/ a vector map.

Older Posts »

Categories