Archive for the flash Category

Cake 1.2 SWX problem solved

Recently I was asked to use SWX to tie into a CakePHP project. Integrating SWX was a piece of cake (cheap pun :) ), but in the middle of development, walker upgraded our Cake core to version 1.2 and all of our SWX started dying. If you have run into this problem, the fix is pretty simple:

edit all of your gateway files in your webroot (cake_amf_gatway.php, cake_json_gateway.php, and cake_swx_gateway.php) by replacing:



App::import('Controller', 'App')

that ought to take care of your BadCall errors.

Continue reading Cake 1.2 SWX problem solved

Double Click event in AS2

Some of us are still use AS2 here and there, and some of us want to be able to capture something like the AS3 MouseEvent.DOUBLE_CLICK. I wrote a simple decorator class called DoubleClickable to give a MovieClip the ability to broadcast doubleClick events.

The example below is hopefully pretty self explanatory :)

Just import the class and wrap your Movieclip@s with the the @DoubleClickable class.

import com.visicswire.wrappers.DoubleClickable;

var dbc:DoubleClickable = new DoubleClickable(star);
dbc.addEventListener('doubleClick', Delegate.create(this, _handleDbleClick));

Grab the source files for a hands on example.

Understanding root and the Document Class in AS3

Hopefully, we all know the _root object is gone in AS3. While use of _root was generally frowned upon in the Actionscript dev community, it had its uses. It was a quick and easy way to reference your project’s main timeline. Moving into AS3, we let go of _root and embrace the concept of a Document Class.

The purpose of the Document Class in AS3 is to extend your project’s main timeline (just a MovieClip instance) with a custom MovieClip subclass. While a similar effect was achievable in AS2, it required using a work-around. It’s nice to be able to assign your project a ‘main’ class right from the properties panel in Flash CS3.

You may be thinking that comparing the ‘AS2 _root’ to the ‘AS3 Document Class’ is like comparing apples to oranges, and you would be right. The _root object in AS2 was a reference to the project’s main timeline, whereas the Document Class is not a reference at all; it is a subclass of the MovieClip object that serves as the Actionscript’s entry point into your project.

Sooooo, why does it make sense to talk about them together…? In order to understand the concept of root (not _root!!!) in AS3 you need to understand the concept of the Document Class.

Continue reading Understanding root and the Document Class in AS3

Yahoo! Maps: AS3/Flex vs. AS2/Flash

Given the visibilty of mapping APIs today, it is not a supprise that many of our clients are requesting mapping elements on their site. Since I am a flash developer, I hold a particular affinity for creating solutions with Yahoo! maps over Google maps.

Since the Yahoo! maps component is an AS2 movie at its core, the AS3 API essentially wraps the AS2 map and communicates with it via the Yahoo! AS3 Maps Communication Kit. While the AS3 API lets you use all the AS2 functionality, the big kicker: it requires you use the Flex framework (adding 200kb+) to your project.

Now, if you are building a Flex app and want to add a mapping component, then you are all set, but if you are just building a mapping widget to compliment a website, then the using AS3 for your map starts to look wwaaaayyy less appealing.

I am not sure why Yahoo! decided to depend on the Flex framework, but that dependancy on that translates into embedding the entire Flex runtime into your SWF. That means no pure AS3 projects using Yahoo! maps.

It would rock to see a native AS3 mapping component solution in the future. I can’t imagine that is too far away.

Dynamically Register MovieClips in AS2

I found this great little class yesterday while trolling around for a current solution to registering loaded images to their center. Darron Schall wrote this little gem a llllooooong time ago, but nonetheless his DynamicRegistration solution is very handy and clean to mix-in with your projects.