Archive for April, 2008

Useful Posts From Community: 20080425

Planning to start a thread of useful posts gathered from the community. Would probably try to do this as often as I can. Anyway, here’s some interesting stuff I found recently. :)

Sphere: Related Content

AddThis Social Bookmark Button

How To Create AS3 Components In Flash

Probably the last places I would have thought of stumbling onto great links to tutorials will be amazon.com, but who would have expected? :P

Jeff Kamerer, an engineer on the Flash Authoring team, had written an extensive article on Adobe’s Developer Center, which focuses on how to make your own AS3 components with the Flash CS3 framework.

Though it’s still work in progress, it already contains detailed information.
Contents at a glance:

  1. Set up the layers and frames in your component movie clip symbol
  2. Implement Live Preview for your component
  3. Dispatch events
  4. Support styles and easily editable skins
  5. Manage drawing with the invalidation model
  6. Manage focus
  7. Handle keyboard input
  8. Create a compiled clip shim for your ActionScript definitions
  9. Deploy your component to the Components panel

(Via amazon.com >> Robert Penners Programming Macromedia Flash)

(Or Ropert Penner’s blog >> Creating AS3 Components in Flash: The Lost Chronicles - A Kamerer Adventure)

Sphere: Related Content

AddThis Social Bookmark Button

Free MovieClip Transition Effects Component!

Something exciting is going on now at WebDesignerWall.com. Simply enter a comment in "Free MCTE Component Giveaways", and you’ll receive a free copy of MCTE V3 (value $50)! Atop of that, if you’re one of three lucky commenters, you will be receiving the MCTE Collection Plus (value $200)!

jumpeyecomponents.com had really did a great job on these components, which provides a diverse selection of awesomely cool effects available for you to choose, and best of it all? No coding is required. ;) See samples here.

Acceptance of comment entries will cease on May 4, 2008 (at 12am), so don’t wait! Hurry over and leave your comment now! :D

Sphere: Related Content

AddThis Social Bookmark Button

AS3 Tutorial: Moving Based On Mouse Location

AS3 Moving Based On Mouse Location Screenshot

Objective

  • Learn a simple way to detect location differences.
  • Make something move using that difference.

Files Required

Let’s Get Started!

In its entirety, this is a very basic tutorial. However, I’ve planned for great things through the use of this technique, so getting through the basics is necessary. :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
private function __onEnterFrame ( e:Event ):void
{
	// Reposition the mc's y to the middle of stage
	mc.y = stage.stageHeight / 2;
	//
	// Find the stage's centre point
	var midPt:uint = stage.stageWidth / 2;
	//
	// Find the difference between the mouseX and midPt
	var diff:int = mouseX - midPt;
	//
	// To convert it to percentage
	var perc:Number = diff / midPt;
	//
	// Finally moving it base on the percentage
	mc.x += perc * maxSpeed;
}

The inline comments are actually pretty self-explanatory, so there’s no point in me repeating them all over again. :D

What I wish to highlight is that in line 10, diff may be either a positive or negative integer, depending on where the mouseX is. This is the key which determines which direction the square mc should be moving towards.

Final Note

If you like, you can alter this class variable, maxSpeed, to change the maximum movement speed of the square:

private var maxSpeed:uint = 10;
Sphere: Related Content

AddThis Social Bookmark Button

PV3D Render Error With TextFields

PV3D Render Error TextFields Screenshot

While writing my previous tutorial, I noticed this rendering bug with PV3D when my movieclip, which is to be used as a MovieAssetMaterial, uses a static textfield in it.

I have no idea exactly what causes it, but to workaround, you have to break apart the textfield into shapes. :)

The above solution is however, only valid if the text is meant for graphical purposes only. If you really have to use a textfield, use a dynamic textfield and embed the fonts. I’ve tried and it works this way as well. ;)

Sphere: Related Content

AddThis Social Bookmark Button