Posted by admin on April 14th, 2009
Recently I saw a screencast from Deepa Subramaniam at Max2008 on how to create new components in Flex 3 (link). I would urge everybody to watch this video if you’re not familiar with this topic.
Something I noticed in this video was the use of Bindable metadata tag with event name specified. If you make a setter Bindable, then it’s kinda of a performance loss to trigger the binding if the new value that’s being set is the same as the old value. Here’s a way to improve this:
1
2
3
4
5
6
7
8
| [Bindable(event="xChanged")]
public function get x():Number{ return _x; }
public function set x(value:Number):void{
if(_x != value){
...
dispatchEvent(new Event("xChanged"));
}
} |
Posted by admin on April 14th, 2009
Last week I searched a little on a problem with bindings in Flex. Seemed like I couldn’t add a binding to an Array. After a question on Stack someone gave me the answer. Apparently it is well documented in the Flex 3 help (link)
Quote:
When defining a data binding expression that uses an array as the source of a data binding expression, the array should be of type ArrayCollection because the ArrayCollection class dispatches an event when the array or the array elements change to trigger data binding. For example, a call to ArrayCollection.addItem(), ArrayCollection.addItemAt(), ArrayCollection.removeItem(), and ArrayCollection.removeItemAt() all trigger data binding.
Posted by admin on April 10th, 2009
Yesterday someone asked me how to implement Undo functionality. I knew there was a pattern commonly used for this, but couldn’t remember it. In my common sense I would keep track of previous states of properties (or actions). After some search I found that Command pattern is a good choice to implement the Undo functionality.
With some online examples I implemented an undo functionality pattern in Flex. Doing such an exercise makes me understand the theory behind it better.
Here’s the first example. Right click on the swf to view the source.
Next is implementing redo functionality in it. In a third step I’ll try to make some things more generic so I can use it easily in our product.
What would also be interesting is to make the example work in a way that only whole words are undone instead of single characters. I’ll also look into that later on.
thx, Lieven Cardoen
Related: Memento Pattern
Posted by admin on December 25th, 2008
Try hitting Ctrl-Shift-L and you’ll see all the shortcuts available!
Posted by admin on December 3rd, 2008
If you would rename your eclipse.exe to eclipseyyy.exe, make sure then to also change your eclipse.ini to eclipseyyy.ini ! Searched an hour on this one… I was changing my eclipse.ini and nothing ever changed when restarting eclipse… unitl I found the solution…
Posted by admin on November 6th, 2008
A friend of mine, a great flash programmer, creates art with Flash! I didn’t want you to miss this:
http://www.flickr.com/photos/v-i-p/3004875027/sizes/o/
Next one I really like:
http://www.flickr.com/photos/v-i-p/3002746743/sizes/o/in/photostream/
Cheers! Lieven Cardoen aka Johlero
Posted by admin on October 25th, 2008
This post is a call to Flex Developers to start using the Prana Framework. If you want more information on Prana Framework then look at the site. Because a lot of developers probably get scared when hearing terms like Inversion of Control, Dependency Injection, Spring, … you can just go on without reading about this and check this simple example. The purpose is to configure some variables externally in a xml file using the Prana Framework. Other ways of doing this could be:
- Creating your own XML-file.
- Creating a txt file with key value pairs.
- Having some configuration info in your database.
In all three cases you would need to read the xml, txt or database data and parse it yourself in the application.
Prana does this all for you automatically. Get on to the example.
Download zip Flex Project
Example + source view : Right click swf –> View Source to see source.
The only lib you’ll need is prana-main.swc, which is in the libs folder.
The three files that I created are PranaExample1.mxml, Singleton.as and application-context-johlero.xml.
PranaExample1.mxml is the main application mxml. Singelton.as is a singleton with a few variables that will be set by Prana and application-context-johlero.xml is the XML file that will be read and parsed by Prana.
I have put comments in the three files that should be enough to understand the example.
In next examples I’ll show some more complex examples of what you can do with the Prana Framework. Anyway, their’s also documentation on the site of Prana Framework, so go and check it out.
Interview about Prana Framework on InfoQ
The Flex Show Episode 57: The Prana Framework with Christophe Herreman
Ciao!
(Thx to Herre aka Herrodius! Respect!)
Posted by admin on October 17th, 2008
Just searched two hours for a problem loading the application-context in Prana. I have these two files:
application-context-backoffice.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| <?xml version="1.0"?>
<objects xmlns="http://www.pranaframework.org/objects"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.pranaframework.org/objects http://www.pranaframework.org/schema/objects/prana-objects-0.6.xsd">
<!-- ================================================ -->
<!-- Properties -->
<!-- ================================================ -->
<property file="application-context-backoffice.properties.txt" />
<!-- ================================================ -->
<!-- ModelLocator -->
<!-- ================================================ -->
<object id="edumaticModelLocator" class="edumatic.model.EdumaticModelLocator" factory-method="getInstance">
<property name="useWindowsAuthentication" value="${useWindowsAuthentication}" />
...
</object>
... |
application-context-backoffice.properties.txt
[code]
useMessaging=false
useWindowsAuthentication=false
activeChannel=selorChannel
localCookieName=Edumatic3BackofficeCookie
examOverview_ShowTestPreview=true
[/code]
Problem this morning was that useWindowsAuthentication was set to true in the application, while it clearly is set to false…
Well, seemed like the problem was the encoding of the txt file. It had changed to ANSI instead of utf-8. Have no idea what changed the encoding (eclipse?). I know the default encoding can be set in Eclipse but that doesn’t seem to work all that good. So, changed encoding and everything works fine…
Without encoding Prana read the file like this:
[code]
useMessaging=falseuseWindowsAuthentication=false
activeChannel=selorChannel
localCookieName=Edumatic3BackofficeCookie
examOverview_ShowTestPreview=true
[/code]
Posted by admin on October 9th, 2008
Man, the last couple of days were trying to survive from the flew and trying to get Eclipse, FlexBuilder and BlazeDS working on Ubuntu. Not an easy task if you never worked in Ubuntu. At the university we did see some Linux scripting, but that’s a long time ago.
Anyway, I got it starting, but probably not the way it should. For instance I need to start Eclipse as root because apperently I installed it as root (sudo?).
The latest FlexBuilder Linux build doesn’t work with the latest Eclipse 3.3. On Vista we had the same problem but a new FlexBuilder release solved the problem. Guess Linux has to wait a while. With Eclipse 3.3 you get an assertion error. With Eclipse 3.2 everything works like a charm.
The instructions to install BlazeDS were not that simple but with the little things I remembered from HighSchool I managed. Now I’m off to play a little bit with BlazeDS. I want to know if it’s capable of replacing WebORB for .NET. The thing I’m curious about is the easy way objects can be saved, offline modus, messaging, sub/prod, …
If I’m right, BlazeDS is free and opensource. FMS is not. FMS seems to have Video streaming and a lot of other things not included with BlazeDS. FMS is also a lot of money… But if a lot of time can be saved with it, why not do the investment.
Johlero aka Lieven Cardoen
Posted by admin on December 20th, 2007
I had a Zinc project which worked fine on PC but showed absolutely nothing on Mac. I just got a nice Window with nothing in it. Even a swf with a simple button wouldn’t load on Mac.
After an hour of searching I saw that in a Mac Zinc Project, you can choose the Embedded Flash Control in the Flash Settings tab. If you want your executable to work on Mac, you better set this on Flash 9…

Yeah, life can be hard.
Follow Me!