I've entered a video in the Canadian Doritos Viralocity contest. I'd appreciate if you checked it out (especially if this blog has helped you in any way). Thanks!

  1. Flash 9: Text fields and buttons don’t show up in browser

    Posted on: October 1, 2008

    Problem:

    You publish your SWF from the Flash CS3 IDE and everything looks fine. You, or someone else checks out the SWF in a browser and although everything kind of works, certain elements like text fields and component buttons aren’t rendering properly!

    Solution:

    Sometimes certain revisions of the Flash 9 player behave differently than expected, but there is a way you can look into it. Read on…
    (more…)

  2. Save images from Flash to your server using ASP.NET webservices

    Posted on: September 11, 2008

    Problem:

    You want to save an image from Flash to a server using Actionscript 3.0 and ASP.NET.

    Solution:

    Read this article!
    (more…)

  3. Actionscript 3.0: Scale Object from Center Point

    Posted on: July 31, 2008

    Note: This is almost exactly the same solution I posted earlier for rotating an object around its center point (Actionscript 3.0: Rotate Around Center Point). I thought I’d post this slightly altered solution for people who need it.

    Problem:

    You need to scale a movieclip/sprite from its center point, but its registration point is at (0,0) and you can’t and/or don’t feel like putting this object in the center of a container movieclip and rotating that

    Solution:

    TCBWMO (Take care of business with the matrix object).
    (more…)

  4. Flash/Actionscript: Innaccurate math results

    Posted on: July 21, 2008

    Problem:

    You’re working some math equations with Actionscript and tracing the results when you notice some results are off by a very small value.
    output:
    2
    2.1
    2.2
    2.3
    2.4
    2.5000000001
    2.6
    2.7000000001
    2.8
    2.9
    3
    

    Solution:

    This is called a floating point error and is apparently a normal computing error that affects all aspects of computing, not just flash. You can fix this by running the values through the correctFloatingPointError function I’ve posted below.
    (more…)

  5. Actionscript 3.0: Rotate Around Center Point

    Posted on:

    Problem:

    You need to rotate a movieclip/sprite around it’s center point, but its registration point is at (0,0) and you can’t and/or don’t feel like putting this object in the center of a container movieclip and rotating that.

    Solution:

    Use the transform matrix and show it who’s boss.

    If you want to get this done simply and quickly, you can use this rotateAroundCenter function:

     private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) {
          var m:Matrix=ob.transform.matrix;
          m.tx -= ptRotationPoint.x;
          m.ty -= ptRotationPoint.y;
          m.rotate (angleDegrees*(Math.PI/180));
          m.tx += ptRotationPoint.x;
          m.ty += ptRotationPoint.y;
          ob.transform.matrix=m;
     }
    (more…)

  6. Actionscript 3: Event.target returns children of movieclip

    Posted on: June 11, 2008

    Problem:

    You’ve added a listener to a movieclip, but the target returned is another movieclip or sprite within that movieclip.

    Solution:

    myMovieclip.mouseChildren = false;
    (more…)

  7. Resizing bitmap images with Actionscript 3.0

    Posted on: June 3, 2008

    Hey, I just did a quick experiment with bitmaps in AS3. Nothing fancy, I just loaded in an external JPEG, resized it into 3 different sizes and then drew them to stage. I’m sure someone can use this. For now, everything is hard-coded and the code is right in the .FLA. Maybe I’ll try and make a nice class out of this, although I’m sure there’s already one out there. Anyway, check out the code or download the FLA.

    var mediaLoader:Loader = new Loader();
    var bmFullsize:Bitmap;
    var bmHalfsize:Bitmap;
    var bmThumbsize:Bitmap;
     
    mediaLoader.load(new URLRequest("ostrich.jpg"));
    mediaLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, resizeImages);
     
    function resizeImages(e:Event):void
    {
    	bmFullsize = new Bitmap(e.target.content.bitmapData.clone());
    	bmHalfsize = new Bitmap(e.target.content.bitmapData.clone());
    	bmThumbsize = new Bitmap(e.target.content.bitmapData.clone());
    	bmFullsize.width = 300;
    	bmFullsize.height = 300;
    	bmFullsize.smoothing = true;
    	bmHalfsize.width = 150;
    	bmHalfsize.height = 150;
    	bmHalfsize.x = bmFullsize.width;
    	bmHalfsize.smoothing = true;
    	bmThumbsize.width = 75;
    	bmThumbsize.height = 75;
    	bmThumbsize.x = (bmFullsize.width + bmHalfsize.width);
    	bmThumbsize.smoothing = true;
    	showImages();
    }
     
    function showImages():void
    {
    	addChild(bmFullsize);
    	addChild(bmHalfsize);
    	addChild(bmThumbsize);
    }

  8. APE Class Model

    Posted on: May 29, 2008

    Click above for a giant layout of all the APE classes and the way they inherit each other. Definitely helpful.


  9. Excellent APE Beginner’s Resources!

    Posted on: May 28, 2008

    If you have any interest in Flash + Math/Physics, I recommend you try out APE (the Actionscript Physics Engine) library by Alec Cove. It’s a set of AS3 classes that will easily let you create a world of particles that are affected by physics. If you’ve ever thought about making an action-type game, this might be the place for you to start.

    Just today I stumbled upon some great examples by a guy named Andrew Garrahan that were posted to Google Group called APE General.

    Follow this link to see the examples: APE Cornerstones: Basic Examples

    (Thanks Andrew, these should really help me get started)

    There’s also some other great examples in this group and I imagine it will grow as well. I hope this helps someone out there!


  10. Flash CS3 UIScrollBar Trouble

    Posted on: May 27, 2008

    I had some trouble with the CS3 UIScrollbar properly latching onto a dynamic textbox earlier this week. I found a solution and I thought I’d share.

    (more…)