If you ever wanted to make a complex application with Flex you always asked yourself: Is the swf to big? How can I reduce it’s size?
Here are some small tips that do not relate to flex only, and one specific to flex:
One of the first questions any beginner in OOP and Flex will ask is: What do those public/protected stuff really mean?
Well here is a short table to describe them.
I was working to a flex project, I need a canvas where I have to put some elements on a big surface, so I really need to have scrollbars. That’s fine. If I move an object to the right-bottom corner it’s working great, if the object goes out of working space, will go under scrollbars, [...]
If you ever wondered how can you compare 2 objects (big structure objects that can not be compared by Flex itself using the === operator) in Flex to find out if they are identically the same one of the methods used were to check all their attributes.
I wanted to talk a while ago about the [Mixin] meta-data tag but I forgot :).
Most programmers have heard of the static code concept but if they try to implement it in AS3/Flex they have problems. Here is how to do it:
package
{
import mx.managers.ISystemManager;
[Mixin]
public class StaticCode
[...]
A very handy parameter is the rest one. Imagine you want a function that will calculate the sum of any number of parameters of type number. One way to do it is to send an array to the function. But one better way is to use the “rest” parameter.
Here is the function:
public function MakeSum(a:int, … [...]
This it’s a clean example about how to add a CSS style to a component in Flex.
We need to create the CSS file (style.css) and add a custom style:
.myStyle {
font-size: 20px;
color: #cc0000;
}
Make a new Flex project and in the defalul MXML aplication file add this code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" >
<!–// Here we call our [...]
Adobe has announced a RIA Developer Camp November 5, 2007 4:00 p.m. – 8:30 p.m.
Details:
Learn from other developer community leaders on how they use Adobe® Flex™ 2, Flash® CS3, and AIR™ (Adobe Integrated Runtime) to help them improve their business applications.
Join this seminar and hear speakers from Yahoo!®, PayPal™, ActionScript.com, and Adobe discuss how business [...]
Recently I had to put a mask to an UIComponent. Here is the way to do it:
var largeMask:UIComponent = new UIComponent();
largeMask.graphics.beginFill(0×00FFFF, 0.5);
largeMask.graphics.drawRect(0, 0, 120, 40);
largeMask.graphics.endFill();
largeMask.x = 0;
largeMask.y = 0;
this.addChild(largeMask);
this.mask = largeMask;
this should be UIComponent or Shape or similar object.
Obs: the mask must be added as child to the object you need to add the mask [...]
So you need a modal window and you are using Flex :). This a small example that will open a modal window when application it’s initialized. I put the title to the modal window, but you can add also an icon.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" initialize="openModalWindow()">
[...]
Luke Bayes and Ali Mills of PatternPark presented 9 Flex Frameworks for the Silicon Valley Flex Users Group (SilvaFUG) at Adobe’s offices in San Francisco.
Those frameworks are: Cairngorm, PureMVC, ARP, MVCS, Flest, Model-Glue: Flex, ServerBox Foundry, Guasax, and Slide.
The final conclusion was that PureMVC by Cliff Hall beats out the alternatives. We prefer PureMVC [...]
A feature of Flex (and any decent programming language) is the garbage collector. What it does? Once it detects that an object in memory is no longer needed it will clean up the memory. Simple no?
Well is not that simple: you may have finished your work with that object but there are references to [...]
I wanted to write a few words about the deep object copying in flex (aka as making an absolute identical replica of an object no matter it’s class).
There is a function in the flex API called ObjectUtil.copy This is a very nice function but the problem is it cannot work on all object classes. [...]
It seems that the constants behave strangely in Flex.
Here is why:
public const X:String = "X";
public const Y:int = 101;
public const NotSoConstant:XML = …some random xml…
Now here comes the fun part:
var x:string = X;
x = "aaa";
trace(X + ":" + x); // X:aaa
var y:int = Y;
y = 10;
trace(Y +":" + y); //101:10
var constantOrNot:XML = NotSoConstant;
constantOrNot = …another [...]
One of the most common problems in the RIA applications that require login/logout and also some saves is how to prevent the user from closing the window/tab when there is unsaved information?
The answer is simple: FABridge.
This functionality allows you to catch the unload event from javascript and execute your flex code.
Here is how:
First you need [...]