plugins for AMFPHP

We’ve been tossing the idea of plugins for AMFPHP around, and so here’s what come of it. Please share your thoughts on this. Note: this is a copy of a mil I’ve sent to the amfphp-cvs mailing list

Why?
People who want to contribute to the AMFPHP community currently mst have their contribution vetted by me. Not only am I a poor judge, but I’m also lazy. So the idea is to provide a system where someone who has a cool idea can push it to the community and let the community decide.

Design Goals
Flexibilty, extensibilty, simplicity, convention over configuration

How (global design)?
I’ve looked around a bit, and what seems to work elsewhere and that I quite like is a system of hooks. The idea is that at certain points in the execution of the script the possibility is given to the plugins to interact with the data flow. Here’s a simple example: Your plugin wants to add a service to those available in the usual “services ” folder. When the gateway tries to direct a service call, instead of just routing it to the services folder, it can ask the plugins first if they have a matching service.

How (technical specifics)?
There will be a new “plugins” folder in amfphp. Each plugin will consist at the very least of a subfolder and an index.php. When called this index.php will register for all needed hooks. To continue with the example, the index.php will register a function “addMyService” for the hook “LIST_SERVICES”. When LIST_SERVICES is called by the gateway, the plugin’s “addMyService” function will be called, and it will return the path to the plugin’s service.

What about plugins for the service browser?
The plugin registers for the hook GET_SERVICE_BROWSER_PLUGINS, and naturally takes the opportunity to add a nearby SWF.

That’s all for now. I know it’s a bit sketchy, but once we get the basics down I’ll flesh this out.
Ariel

Pin It

How to make money with open source

Ryan who is just starting his project CubeHenge wanted some tips on how to make money with open source.  I tried to give him some answers, and it then degenerated into this blog post.
Your project is a business, it’s just that your business model is different, because you’re not selling licenses for your software. Look at Mozilla, they make a heapload of cash by selling that search spot in Firefox. Look at Wikipedia, they can pay a few people’s wages through donations. I like the model behind Tweenlite, even if it’s not strictly open source. WordPress is open source, and makes money on hosting, among other things. Freemium is also an option, with part of your project being open source and the other part commercial. For nearly any open source projects, particularly small ones like the ones I work on, you have the following general options:
– you sell service around your product. Some corporation likes your stuff and doesn’t have the mad skillz to set things up, or needs some advice on how best to use it.
– you sell development. Some corporation needs this extra feature on your project, and you sell it to them.Ideally this is something that reintegrated in to the project.
– you sell your name. You’re not just some random dude who sells development and advice and consulting services, you’re the guy who wrote “Really Cool Tool”. And because the project is awesome, you must be awesome too and you sell exactly the same services as some other freelance consultant does, but you’re much better and much more expensive, because you’re worth it and you can prove it.
– you sell your contacts. Through “Really Cool Tool” you have met a lot of people, and you know this amazing developer called Dmitri who lives in Romania who contributes to your project. He’s not very expensive and you know how to work with him, so you can subcontract to him. Or you met this guy who works at Adobe and you can totally just give him a call and ask whether or not this or that feature will make the cut in the next version of Illustrator.

If someone has some better ideas, or some questions, comment away!

Pin It

AMFPHP is back

AMFPHP is back! A new team has come together to get the project moving again.

What?
AMFPHP is the best way for Flash to communicate with your PHP code. It understands the AMF data sent and received by Flash, and translates it into something your PHP code can work with. AMF allows for binary serialization of Action Script (AS2, AS3) native types and objects to be sent to server side services.

Why?
It is a critical component in a number of projects, so we decided to revive it. Many CMS can integrate with AMFPHP. Check http://www.amfphp.org/frameworks.html

Where?
www: http://amfphp.sourceforge.net/

Learn more: http://amfphp.sourceforge.net/about.htm

Discuss: http://www.silexlabs.com/the-blog/fr/2010/02/amfphp-is-back/

Pin It

Death to Christmas Music

Now is about that time of year when the music you hear in public spaces is even more aggravating than usual.  The idea I guess is to get you all warm and christmassy to make you reach for your credit card more readily.  I’m ok with music thought out for certain listening conditions.  Dance music gets me moving, and I appreciate Music to make Love To, even if this is rather a personal choice. But Christmas music feels like music to wash the dishes with, or music to vomit to.

Thankfully, I am not alone. Some like minded fellows in the UK have successfully driven that very seasonal song from Rage Against the Machine to the top of the charts. As a Frenchman I have a natural distrust of the Brits, but once in a while I have to say it: Hats off! More info can be found here .


Rage Against The Machine – Killing In The Name Of
par Duketrasher
Pin It

Flex Internal Build Error with SWC

I just found yet another way to provoke the dreaded
An internal build error has occurred. Right-click for more information.
in Flex. I got an update of some Flash assets in a SWC, and using that SWC caused the error. I tried the usual tips found on the net to no avail. What I ended up doing was to link the SWC as an RSL.
For those who don’t know what I mean, go through the following menus:

Project Properties-> Flex Build Path -> Library Path -> the lib -> Link Type : switch from “Merged Into Code” to “Runtime Shared Library (RSL)”.

Pin It

OOF 1.2 is out

Hi,

There’s a new release of OOF, the very Open Flash components, fresh off the press. The tasty new bits:

– you can now read Excel files, with the new ExcelConnector.

– you can now scroll your lists with the new ListScrollBar.

– the XmlConnector now allows you to import any XML file and use the data in your site, in a text field, in a list, as the adress of a video… You can integrate data from flickr, youtube, picasa, google agenda, and most online services. The tutorial is on its way, but in the meantime you’re awaited in the forums :-)

http://wp-manager.silex-ria.org/?p=319

http://sourceforge.net/projects/oof/

Pin It

Flash bugs that upset my workflow

I guess this could be called Flexing with a Flasher, part 3. So here are links to parts 1 and 2.

I ended requesting the FLA file from the designer, and I ran into a couple (more) bugs in Flash CS3. I don’t use CS4 yet simply because it’s still not stable enough for me and I don’t need the gadgets, but as I understand the problems are the same.

– SWC library publishing sometimes messes up. Sometimes I export the SWC from Flash, and it’s incomplete. After digging a bit, I found that the catalog file contained in the SWC was corrupted. Instead of seeing elements defined something like this:

<script name=”electromantik/font/ScoreBoard” mod=”1257779217098″ >
<def id=”electromantik.font:ScoreBoard” />
<dep id=”flash.text:Font” type=”i” />
<dep id=”AS3″ type=”n” />
</script>

I would find something like this:

<script name=”electromantik/font/ScoreBoard” mod=”1259942368343″ >
</script>
So obviously Flex can’t import the element, and fails to compile.

The best fix I found for this, and it doesn’t work 100% of the time, is to get rid of the existing SWC file before publishing.

– More Fonts Fun! When I publish the library myself, the texts aren’t properly spaced. I spoke to the designer about this, and it turns out this is something well known: He has a mac, I have a PC, and because of this It turns out different on my computer. What this means is that only he can publish the production lib, because I don’t have a fix.

– I thought that maybe I could fix some of the spacing issues I was having: Often imported MovieClips take up more space than they should when doing box layouting. I haven’ found how to, even if the elements of the MovieClip are well positioned in Flash, sometimes there is some extra around it.

This is so much stuff I wish I’d never learned. Oh well…

Pin It

Flexing with a Flasher, part 2

I wrote this post on the joy of authoring designs for Flex in Flash. This is the follow up. Since I last posted, my attitude has gone from “cautious optimism”, to “why oh why didn’t we stick to plain Flash???”.

Fonts. They always suck and create problems and make me plead for using arial everywhere, but the pain is double here. I already knew that Flash has trouble with embedded fonts, but this new one is just better: If we use assets for a loader with any text whatsoever in the design, it messes the fonts up for the rest of the program. This includes text simply not showing.

Layout. One of the things I like about Flex is the whole layout thing with boxes etc. Forget using these if you use assets designed in Flash. Consider a text box with a background and a halo effect for style, all done in Flash. Being the developer that I am, I want to make a resizable text component that scales and stays out of my face. This just doesn’t work, the halo being out of whack, the textfield not measuring properly etc. So I end up doing manual layout for quite a bit of my work.

If despite all this, you still want to use this workflow, here a couple more lessosn I picked up:
– get the flasher to give fully qualified names to his exports. MyButton is pretty useless, and the auto-completion in Flex is helpless with it. However com.electromantik.resources.MyButton is heaps better, and com.electromantik.resources.HaloButton is actually pretty good.
– Flashers have no clue about layout constraints, so they don’t set the dimensions of their clips properly. It’s easier if all the clips are positionned with the top-left point at (0,0), and they set the dimensions to fit. With that, in some cases you might be able to use a VBox.

The project should be done in January. Never say never, but never again!

Pin It

Flexing with a Flasher : Integrating Flash Designs in Flex

Up till now I’ve worked with designers who have given me images and guidelines on how to use them in Flex. So I would get a load of PNGs, and we would sit down together and toy with the animation that would use them in the application. Now I’m confronted with something a bit more ambitious : Using Flash objects and communicating with them. This includes stuff like comboboxes designed in Flash. I’m working with this guy, take a look.

This should be easy but somehow isn’t. As I understand the upcoming Flash Builder will ease some of the pain. In the meantime, I’ve spent quite a bit of time figuring out how to get things going with a minimum of a code and a maximum of help from the IDE. The best method for this is for the designer to do his work in Flash, and export all his elements in a Flash library. You may have seen these around, their file extension is .SWC. These files are actually zips which contain 2 things : the actual resources, like a SWF, and a catalog file describing what is inside.

If you import this SWC file in Flex, the Flex compiler has access to the exported objects contained in it, and they show up in the auto-complete dialog. If for example the Flash designer exports a  « Banner » clip, then you can use Banner directly in Flex. The main  problem is that you can’t include these in your typical Flex visual object. If you try to add the banner to a Flex object using the addChild method as you would with another Flex object, you will get the following compiler error :

TypeError: Error #1034: Type Coercion failed: cannot convert InscriptionTitre@d1ba4c1 to mx.core.IUIComponent.

There is however a workaround for this. You have to use a Flex object as a wrapper. The one I’ve found that works the best is mx.controls.Image. In MXML you would do the following :

<mx:Image source=”{Banner}”/>

Image recognises Banner as a static resource, instanciates it and shows it. That’s already a nice start. But what if you to do something which needs some interaction ? Suppose you have an animated banner, and you don’t want the animation to start straight away, but only when you call the play() method on it. Let’s call this AnimatedBanner. This code won’t cut it :

<mx:Image source=”{AnimatedBanner}”/>

This fails you because you don’t have a pointer to the AnimatedBanner instance. So what you can do is the following :

private var _animatedBanner :AnimatedBanner ;

In your MXML :

<mx :Image id= « animatedBannerWrapper»/>

In your init function :

_animatedBanner = new AnimatedBanner() ;

animatedBannerWrapper.source  = _animatedBanner ;

Voila !

In this way, when you are good and ready, you can call _animatedBanner.play() ;

There are a couple more issues that could use addressing in a follow up post, but that should get you started.

Pin It

On Class Design and the Flex UIComponent

One of the best tips I’ve heard on class design is the following : Say the Class name and the member names out loud. If it doesn’t sound right, you’ve got to change something.

As a case study, let’s look at the Flex UIComponent. Ok it’s called UIComponent. Fair enough that’s a pretty good name. UI says user interface. It could be GUI which would be more precise, but as everything in Flash/Flex is geared towards graphics this can be forgiven. Component says that it isn’t just eye candy and that there is some functionality  behind it,  and is purposely vague, which is ok as it’s a base class.

Now let’s look at a few member functions and properties. The first thing that strikes you when you look at the doc is how many there are. That’s already a bad sign. I don’t think even the guy who wrote it knows everything that’s in it.

Next, there’s a whole lot of properties that have the word width in it. Width is a good fit for UIComponent, it feels like it belongs there. The obvious advantage of this is that when you look for the « width » property, it’s where you expect it to be. But how about the following :

ExplicitMaxWidth, explicitMinWidth, explicitWidth, maxWidth, measuredMinWidth, measuredWidth, minWidth, percentWidth. Does this not strike you as a bit too much ? Couldn’t there be some more elegant way to access all this width goodness ?

But my favorite is the following : determineTextFormatFromStyles. Why is that even in there ? Surely this could be in another class, maybe dedicated to styles or something ?

I’ll stop there. These are just a few examples of UIComponent overstepping its bounds. From a pretty clear cut idea and a good name for a class and concept the Flex team has somehow turned it into a monster with over 9000 lines of code. Maybe if they’d thought things through out loud things wouldn’t have got so far out of control.

Pin It