Archive

Archive for March, 2007

Flex Page-flip component

March 14, 2007 4 comments

Ely Greenfield has developed a wicked Flex page-flip component. You can see it here, complete with tutorial! It also appears that an Apollo version is coming.

Categories: Flex

Papervision 3D Wiki

March 13, 2007 2 comments

The P3D Wiki is now online – check it out here.

For more information on PaperVision 3D – http://www.osflash.org/papervision3d

and the blog is here.

enjoy!

Categories: Flash

AS 3 Parametric Curve Library

March 12, 2007 Comments off

I’ve released a ‘rough cut’ of the AS 3 Parametric Curve Library. Although the Flex demos (MXML files in the demos folder) exercise most of the methods, the library has yet to be extensively unit tested. There is also no external documentation. Some elements of the library are to be used for skinning in the Rigging classes (currently under development). After the basic Rigging classes are complete, I expect the library to have been pretty extensively tested.

In the mean time, you can find out more about the parametric curve library here. Enjoy!

Categories: Flash

Referencing stage in a Flex App.

March 11, 2007 9 comments

I’m probably not the first to blog on this, but some repetition is often valuable 🙂 Most examples illustrating integration of AS 3 with Flex show a function executed on the creationComplete event of the Application. It is helpful to understand the startup order of events in a Flex application.

If your attempts to access the stage in a Flex app. result in a null reference, try executing your script on the applicationComplete event, as shown in the following code segment (make sure the display object has been added to the display list). This particular segment is taken from a test driver that allows bones to be drawn interactively with mouse clicks, similar to 3ds max. I’ve removed much of the MXML and script that is not relevant to the topic.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="test()" width="600" height="500">
.
.
.
<mx:Script>
<![CDATA[
import Singularity.Rigs.Bone;
import Singularity.Rigs.Chain;
import Singularity.Numeric.Consts;

import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;

import mx.controls.sliderClasses.Slider;
import mx.core.UIComponent;
import mx.events.SliderEvent;

// bone (bn) namespace
public namespace bn;

bn var __move:Boolean = false;
bn var __count:uint = 0;
bn var __bone:Bone = null;
bn var __chain:Chain = new Chain();
bn var __hand:Chain = new Chain();
bn var __isTerminated:Boolean = false;

bn var __myReference:UIComponent = new UIComponent();

// user-interface (ui) namespace
public namespace ui;
ui var __stage:Stage = null; // Stage reference

public function test():void
{
addChild(bn::__myReference);

bn::__myReference.addChild(bn::__chain);
bn::__myReference.addChild(bn::__hand);

// notification of low-level bone interactivity
bn::__chain.setNotify(onBone);

// stage listeners
ui::__stage = bn::__chain.stage;
ui::__stage.addEventListener(MouseEvent.CLICK, onSelected, true);
ui::__stage.addEventListener(KeyboardEvent.KEY_DOWN, terminate);

// add the hand bone to the hand chain
bn::__hand.addBoneAt(30, 70, 30, 50, “hand”, 0, Bone.SQUARE);
bn::__hand.setNotify(onBone);
bn::__hand.enabled = true;

__status__.text = “Click anywhere to start drawing a bone. New clicks create new bones. Click SPACE BAR to end the chain”;
}
.
.
.
If the test() function was executed on the creationComplete event, the reference

ui::__stage = bn::__chain.stage;

would have been null. When executed on applicationComplete, everything works as expected. I hope this small observation helps you in a future application.

Categories: Flex

Some old downloads

March 10, 2007 Comments off

Following are links to some of the more popular downloads from the old Singularity blog.

AS 3 Priority Queue

AS 2 Prime Factorization

AS 2 Pascal’s Triangle (forward and reverse recursion)

AS 2 Recursive Taylor Series Example [ TechNote reference here ]

AS 2 Timer Class (choreograph events in timed sequence)

AS 2 Pair and Triple classes – STL-style pair and triple used for coordinates. Includes great-circle distance.

AS 2 – The magic of the number 1089.

The XML Portfolio Viewer is at Ultrashock.com (Flash 8 tutorials section).

Categories: Flash

Hello world!

March 9, 2007 Comments off

First post in a new personal blog. I hope to discuss various topics in applied mathematics and programming in Actionscript 3/Flex.

Categories: General