flex

Event.INIT and Event.COMPLETE don’t fire when loading an unpacked swc

Thursday, July 24th, 2008 | Uncategorized | No Comments

Cleaning out the wordpress there were a few posts I hadn’t finished. This one is mainly a for-future-reference for myself.

I’ve been doing some run-time class loading involving loading SWF files into the same ApplicationDomain as the container via Loader then using getDefinitionByName to access new instances of the loaded classes. I was perplexed that the INIT and COMPLETE events weren’t being dispatched and found some info here.

Tags: ,

Fix for Eclipse tab reordering “feature” (MRU tab positioning policy)

Tuesday, March 18th, 2008 | Uncategorized | No Comments

I love using Eclipse for my day to day but I hate how it automatically re-orders my tabs. It looks like other people view the Eclipse “MRU” tab positioning policy as a burden as well.

If you know what I’m talking about and want your tabs to remain where you put them, try installing this Eclipse plugin made to do exactly that: Extended VS Presentation plugin
Its got some other really nice features but check it out and see for yourself.

Tags: ,

Using the “include” directive to update multiple classes

Wednesday, February 6th, 2008 | actionscript, flex | No Comments

I recently subclassed Flex’s Canvas to utilize my own custom scrollbars (what a pain!) and soon found I needed to do the same with the Box container (VBox, HBox). Due to the clean OOP nature of these components my overrides and implementation turned out exactly the same for my CustomScrollBarCanvas and CustomScrollBarBox. After a few refactoring sessions copying and pasting my changes to both subclasses I ended up moving all my code to a separate include file and its worked out beautifully with Flex still checking the code during incremental compile:

public class CustomScrollBarCanvas extends Canvas {
public function CustomScrollBarCanvas(){
super();
}
include “CustomScrollBarImplementation.as”
}

public class CustomScrollBarCanvas extends Box {
public function CustomScrollBarCanvas(){
super();
}
include “CustomScrollBarImplementation.as”
}

The Actionscript “include” directive is useful when you have a variable or several lines of code that are mirrored in several classes and you want to maintain that code in a central file. Flex and other frameworks use it commonly to write out framework version numbers on all their classes explicitly during compile time. Flex also uses it to write out groups of meta style tags by type (TextStyles.as, BorderStyles.as, etc) into the components that use them. Its really quite ingenious for upkeep but really simple to implement. (FYI in AS3 you no longer prepend the include statement with a “#”)

Tags: ,

The entity name must immediately follow the ‘&’ in the entity reference

Wednesday, January 30th, 2008 | flex | No Comments

If you’ve ever written code in a binding tag and gotten a special character error try html-encoding the character like you’d do if you were encoding regular text:

Error: <mx:TextInput text=”{(_feed.url && !_feed.isTemporary)?_feed.url:’Save Feed to generate URL’}” />

Works: <mx:TextInput text=”{(_feed.url &amp;&amp;  !_feed.isTemporary)?_feed.url:’Save Feed to generate URL’}” />

It makes sense after the fact but before you actually do it, it just looks odd to html-encode your actionscript.

Tags:

flex debugging adding ?debug=true to your debug file path

Friday, January 18th, 2008 | flex | 1 Comment

I’ve exhausted my resources trying to figure out how to disable Flex from adding the querystring variable ?debug=true to whatever file path you use when launching your app in debug mode. I have my debug path pointing to an html file with a custom html embed so this flag isn’t being used by it. It is however blocking me from appending my own variables which get encoded and made unusable :/

The only thing I came up with in google is this semi-related reference from: http://livedocs.adobe.com/labs/flex3/html/help.html?content=apache_3.html

“Flex Builder appends ?debug=true to the URL when it launches the browser. This query string parameter triggers a compilation with the debug compiler options enabled.”

Does any of the 0 people that read my blog have an answer or suggestion? I’m assuming a solution could be found regarding the use of “query string parameter overrides” and the flex-config.xml file. The investigation continues…

Tags:

Using the class path resolution to your advantage

Sunday, January 13th, 2008 | actionscript, flex | No Comments

Heres a interesting, albeit questionable hack when extending flex classes that cockblock you with a private property or require you to extend several classes when you just want to tweak 1 line of insignificant code in the component.

You can grab the class you want to tweak and copy it to your project folder, mirroring its package with the appropriate folders. When classes get resolved your project folder gets checked before default system paths so your edited version will get compiled in.

I don’t recommend doing this, probably ever, but its been my best friend when I just wanted to tweak that dark 1 pixel line that the Panel component’s title bar receives via TitleBackground without making it a long and convoluted proccess. I don’t know how well this will work with Flex 3’s framework caching but its nice to know this quick and dirty method is there.

Tags: ,

Meta

Search