Select Page

Site launch – portfolio site v3

I’ve just launched my new portfolio site. This is v3.0 of sitedaniel.com, and takes a more minimalist approach to the design than the previous versions. This site is powered by ActionScript3.0 and XML, and uses some fun BitmapData effects.

site_portfolio_v3

link

IE bug with HTTPS and XML

Here is a great post about how to make sure your XML loaded over HTTPS in Internet Explorer doesn’t fall victim to a nasty bug.

If you’re getting Sandbox Security errors but your crossdomain.xml file is set up correctly then you might need to alter the header values in your server response. This really is a weird bug and could have taken a long time to get to the bottom of.
Something else to note is that Fiddler2 interfered with the crossdomain.xml loading and caused this error to recur.

Dragging in Papervision 3D – example

UPDATE 29/09/09: This technique is possibly no longer valid with the latest version of Papervision3D.


Dragging in Papervision example

Here is a small example I put together quickly today to demonstrate how to drag in 3D using Papervision and the InteractiveUtils.getMapCoordAtPointDO3D function.
Since my last post on this in December last year, the Papervision getMapCoordAtPointDO3D method returned object’s x and y values seemed to have changed by a factor of 36.

UPDATE 29/09/09: This technique is possibly no longer valid with the latest version of Papervision3D.

private function _updateDrag(e:Event):void 
{
    // get the update position on the plane
    var obj:Object = InteractiveUtils.getMapCoordAtPointDO3D(_selectedPlane, 
                                        _selectedPlane.container.mouseX, 
                                        _selectedPlane.container.mouseY)
    // move the dragged plane to the new postion with the offset                
    _selectedPlane.x = _selectedPlane.x + obj.x * 36 - _drag_X_offset;
    _selectedPlane.y = _selectedPlane.y - obj.y * 36  + _drag_Y_offset;
}

Click here to see it in action.

The source files can be downloaded here.

Restricting a number to a certain range

Quite often I need to restrict a number to a range with a defined maximum and minimum value. Rather than using if else statements you can do this simply with Math.max and Math.min:

var restricted_value:Number = Math.max(MIN_VALUE, Math.min(MAX_VALUE, value));