TDOT Blog Touchwood Creative

Register | Forgot password?


Touchwood is continuing to grow!

We are looking for talented Flex developers to join our Interactive Group. If you have any interest we would love to meet you. Please email your resume to us at:

jobs@touchwoodcreative.com


Flex

How to Apply a Stylesheet to a Text Component

Problem:

You want to be able to apply a stylesheet to a text component.

 

Solution:

To solve this problem, we are going to extend the Text component with our own custom text component called "StyleText:"

 

public class StyleText extends Text
{

private var _styleSheet:StyleSheet = new StyleSheet();

public function get styleSheet():StyleSheet{

return _styleSheet;

}
public function set styleSheet(s:StyleSheet):void{

_styleSheet = s;
this.textField.styleSheet = s;

}

public function StyleText()
{

super();

}

}

 

 

New Site Launched

Touchwood is proud to present its new website at http://www.touchwoodcreative.com. The site was developed almost exclusively with the Flex framework as an exercise and proof of concept that developers using Flex can not only build a stable application but can also provide a rich visual experience to the user.

Flex's transitions, parallels, and effects were used extensively to add the more polished elements to the presentation of the agency's capabilities and past work.

Also used was Flex's ability to take XML, parse it, and update the UI according to the XML file's contents. This allows Touchwood to update the site quickly and frequently with cool new client projects. So be sure to check it out frequently!

 

 

Uniform Link Widths in Flex's LinkBar Component

Problem:

You want the links in the LinkBar component to be the same width.

Solution:

Extend the LinkBar component to have a property called "linkWidth."

public class UniformLinkBar extends LinkBar

{

[Bindable]
public var linkWidth:Number = 50;

Override the createChildren method. In this method bind the new "linkWidth" property to each child's width.

override protected function createChildren():void{

super.createChildren();
for(var i:int = 0; i < this.numChildren; i++){

BindingUtils.bindProperty(getChildAt(i), "width", this, "linkWidth");

}

}

To Implement:

<components:UniformLinkBar linkWidth="100">

Attached is the library project.

Superscript and Subscript TextArea Component

Problem:

You need to display superscripts and subscripts in a TextArea.

 

Solution:

Embed super and sub script fonts and extend the TextArea component to automatically  update the stylesheet object to apply the font to "sup" and "sub" tags. For extra convenience make this a component that can be reused easily.

Flex: How to Detect When the Browser Window Closes

I came across this thread post by blu3 on the FlashKit forums and thought it was too handy to not share on here.

I managed to pull this off and and here comes the solution. First i
declared cleanUp() function in Flex which does the dirty work and
cleans user's leftovers. Then i use ExternalInterface for registering
my cleanUp() function so that i can access it using JavaScript from
.html wrapper:

Actionscript 3: How to Draw a Shape with Flex 3

Problem:

You want to draw a square programmatically using Actionscript's drawing API.

AIR: How to Detect All Link and Image Clicks in a HTMLControl

Problem:

How can an AIR application detect if a link or an image has been clicked inside an HTMLControl?

Solution:

Create an app to loop through all images and links in the web page's DOM and attach click listeners to them.

Adobe: Why AIR Applications Currently Cannot Execute Other Applications

Last night I was reading this Adobe forum thread about the pros and cons of AIR applications executing other applications. Product manager Rod Christensen left a post explaining Adobe's reasoning for this limitation. Here are the main points of interest:

"The primary reason that AIR 1.0 does not include support for launching
native applications originates from a founding design
decision/philosophy. Applications that do not depend on other
applications to be installed result in a better user experience. Our
goal with AIR has been to deliver a runtime that delivers applications
consistently across operating systems. Please note that this doesn't
mean we're right nor that we might not change our minds on this."

...............

"As with any design decision, there's plenty of opportunity to debate
the topic and this is something we continue to discuss even internally.
The major disadvantage is that it's much more difficult to take
advantage of existing code libraries or launch other native"
applications. "

"At the same time, one advantage to the current
design is that when you distribute an application, you do not need to
say, 'This is a really great application, but make sure you have
Microsoft Windows (or OSX) installed as well as Microsoft Word (or
Photoshop or some other native product) to really take advantage of
this application.''

Actionscript/Flex: How to Programmatically Add a Link to a LinkBar

Problem:

You have a LinkBar's dataprovider bound to a viewstack, but you want to add an extra button that opens an URL in a new browser window when clicked.

Solution:

Flex: Is it right for you?

I was cruising the FlashKit forums and came across the following post:

Hi All out there,

Im new to flex. I'm thrilled with the HYPE flex has caused, and the
heap of awards in so little span. I'm a flash designer and programmer.
I know a little bit of web designing, i usually use Dreamweaver. Im not
so good at PHP, and other web based scripts. I'm fimiliar with
Macromedia Flash 8 Professional. I wanna know some thing from my GURU's
here.......
1. Is flex for me?
2. Is flex a complete RIA or can desktop exe's be created?
3. Does Flex 2 have support on OS 10.4.9 and 10.5 Leopard? Can i use a
single downloaded copy for both or will i need a MAC copy for MAC?
4. Im presently into desktop based applications in flash, so question 2 repeats.
5. Can I get the names of some fine, easy learning books on flex?
6. What's the future of Flex over Flash?
7. Does Flex support writing files to HD, OS native popup's, CD
functionalities, Printing functionalities, Audio and Video
functionalities, text parsing functionalities?
8. I have some fla and swf files with me, I want to add flex database
functionalities. Can i import the swf? or fla? and code the buttons on
my swf in flex?

9. You look tired. i will be back with more queries.


Im very keen to know about flex. I have read many articles. I hope
someone could answer me my questions and get me started with flex.

Regards
Roshan Kolar

 

I think Roshan is a like of a lot of people wondering if they should continue using Flash or should commit to adopting Flex as their development platform of choice. To help, I thought I would share my opinion after working with Flex for the past year...

Syndicate content
© Touchwood Creative 2007 | We use Firefox