Horizontal Object Placement & Alignment Formula

Posted by thornyeternity in ActionScript 3 Snippets on 31. Mar, 2009 | 0 Comments

Easy AS3 code to space and align items (such as sprites, movie clips, etc).

GSkinner and TweenMax – recommendation and over-view.

Posted by thornyeternity in ActionScript 3 Snippets on 31. Mar, 2009 | 0 Comments

Quick over-view of implementing the excellent Tween Classes written by the GSkinner.

FlashVars in FL_RunContent

Posted by thornyeternity in ActionScript 3 Snippets on 31. Mar, 2009 | 0 Comments

This DOESN’T WORK unless you add FlashVars to the Javascript part of the HTML as well.
Find the “AC_FL_RunContent” function and add the following line to the middle of the list of parameters:
‘FlashVars’, ‘myURL=http://weblogs.adobe.com/’,

Rotation Formula

Posted by thornyeternity in ActionScript 3 Snippets on 31. Mar, 2009 | 0 Comments

Good formula for random rotation of object without going to far to either side:
box_mc.rotation = (Math.random()*2-1) * 180/Math.PI;

Applying Filters with AS3 – methods

Posted by thornyeternity in ActionScript 3 Snippets on 31. Mar, 2009 | 0 Comments

Applying filters with AS3 – Adobe method and simpler routes.

EventListeners – removing listener; rollOver

Posted by thornyeternity in ActionScript 3 Snippets on 30. Mar, 2009 | 0 Comments

Check to see if sprite HAS an event listener to be removed:
for(var i:Number = 0; i < fields.length ; i++){
var currCheck:EventDispatcher = containerSprite.getChildAt(i);
if(currCheck.hasEventListener(MouseEvent.MOUSE_OVER)){
currCheck.removeEventListener(MouseEvent.MOUSE_OVER, doHighlight);
currCheck.removeEventListener(MouseEvent.MOUSE_OUT, clearHighlight);
currCheck.removeEventListener(MouseEvent.CLICK, selectAnswer);
Sprite(currCheck).buttonMode = false;
}//if
}//for
————————————-
Prevent ‘Child of Caller’ issues – use ROLL_OVER rather than MOUSE_OVER (?????why – but works)
“The short answer is that MOUSE_OUT triggers when mousing over a child of the [...]

Drawing shapes with AS3

Posted by thornyeternity in ActionScript 3 Snippets on 30. Mar, 2009 | 0 Comments

Draw shapes using code with ActionScript 3

Dragging and Constraining

Posted by thornyeternity in ActionScript 3 Snippets on 30. Mar, 2009 | 0 Comments

Drag sprite

Color Changes – add or remove tint, random color

Posted by thornyeternity in ActionScript 3 Snippets on 30. Mar, 2009 | 0 Comments

Add or remove a color tint, plus random color code.

Child Sprites – Handling depth, removing and more

Posted by thornyeternity in ActionScript 3 Snippets on 30. Mar, 2009 | 0 Comments

Selection of short code snippets for handling children sprites (or movie clip) such as controlling the ‘depth’ or accessing by name.