flex

Lazy programmers do it inline

If there's one thing I've learned from writing a lot of jQuery, it's that you can write a whole lot of code without pressing the enter key. Between all the method chaining and inline functions, you can do quite a bit with a small amount of code.

callLater vs. validateNow

For years, many Flex developers have known the secret to fixing many a UI problem was using either callLater() or validateNow() methods. Much to my surprise, some of these developers do not understand WHY these fix problems, what the difference is, and which method to use.

The Problem

FlexMonkey - MonkeyAgent doesn't work with references to Application

If you've got an app and are hoping to test it using FlexMonkey, be careful that you don't have any references to Application.application. This would normally return you a nice reference to your main app MXML file, but since MonkeyAgent is doing the loading, it will return you a reference to MonkeyAgent instead. Rather than change your code, I'd recommend using MonkeyLink. You need to include a bunch of stuff, but at least it works.

Hoooray for Syntax Highlight!

Well, as you may have noticed, I finally went through all the posts and used a standard way to do code highlighting. It's called Syntax Highlight and you can get it here: http://alexgorbatchev.com/wiki/SyntaxHighlighter

Fortunately, there's a Drupal Plugin so I didn't actually have to do anything except edit all my old posts to use this format:

<pre class="brush:as3">
     This is my code
</pre>

The one thing I wish it could do is combine brushes, so I can have MXML and AS3 in one block.

The perfect roll over slide out menu in Flex

Getting a roll over to work properly in Flex is no fun.

The Scenario

Mouse rolls over a tab, then the tab "slides out" revealing a tool bar or something.

The Tutorial

There are a few things you need to do to get this working right, let's walk through the steps.

  1. There's a few ways to do this, but I'm shooting for easiest. Let's say you have a top-oriented menu (top-right) that needs to slide down from 25 pixels to 80 pixels tall. Start by making our canvas.

PureMVC is not complicated

I've heard of quite a few people lately being turned off of PureMVC because it's "Needlessly complicated." I truly respect Cliff Hall and I love his creation, PureMVC, but the documentation for PureMVC is what's needlessly complicated, not PureMVC. As a community we need to step up and help Cliff advertise this wonderful framework better. So let's get one thing straight, PureMVC is not complicated. It's actually incredibly simple..

Using callLater in a PureMVC Mediator

This may seem obvious to most people but I needed to use calllater today in a mediator because its view component was not done initializing and I realized "callLater is a method of the flex framework, specifically the UIComponent, and the mediator, being an AS3 only class, doesn't have a callLater function! OH NO!"

Okay, so the solution is so simple. A mediator has a view it is responsible for, viewComponent... right? So just callLater on that.

mx:Image limitation

I have a website I'm working on where the background is 8000 pixels wide and 800 pixels tall. I tried for hours, but I could not get the image to load. So how did I solve the problem? With a rather ugly workaround. I created a HBOX with a horizontalGap of 0 and then put two images in it each one being 4000x800. That worked perfectly. I don't have time to really dig in and figure out what's going on or what specifically the limitation is, but I do know that it has something to do with dimensions, and not file size.

PureMVC: SendNotification vs. NotifyObservers

PureMVC has two ways to dispatch a Notification. A "note" for short, is like a Flex Event but that's another story. So what's the difference? The main difference is that sendNotifiaction builds the note and sends it at the same time. It's arguments are the same as Notification.

PureMVC Argument

So me and the other people in my team got in a small argument over the proper use of PureMVC's mediators. We've read in various blogs that it is not a good practice to call a Proxy directly from a mediator. If you're going to call a proxy, it needs to be done from a command. In this particular case, we're asking for the proxy to refresh some data. That's it... one call. someProxy.refresh(). The refresh will send it's notification and our mediator will update.
Syndicate content