In the Flash Pro CS5.5 release, the ability to use CSS stylesheets with TLF text was added. Previously you could only use them with Classic text blocks.
In order to use CSS with Flash, you need to use ActionScript 3.0. The basic requirements are as follows:
- You need a CSS file that contains your style definitions. (Just a text file with a .css filename extension)
- An URLLoader instance
- An URLRequest instance
- A function that gets called when the COMPLETE event fires from the URLLoader. This function is where you will apply the style sheet to the text.
Here are the basic steps:
- Create CSS text file with style definitions
- In ActionScript, create an URLLoader instance.
- Create an URLRequest instance.
- Add an event listener for the URLLoader instance’s Event.COMPLETE event.
- In the function that’s called when the COMPLETE event fires, create a new StyleSheet instance.
- Call the parseCSS method on the URLLoader data (which contains the stylesheet).
- Apply the style sheet to the text instance.
- Apply individual styles from the style sheet to the text in the text instance.
Paul Trani has just posted a new video tutorial on how to set this all up in ActionScript 3.0. The video page also includes a link to the sample files he’s using.
Note that there is a code error in the video at 3:20 that gets corrected later at 6:55. (The line css.parseCSS(fl_TextURLRequest_3.data) should be css.parseCSS(fl_TextLoader_3.data).
Longtime Flash Pro, Flex, and AIR developer, Dmitriy Yukhanov, has written a new article for the Dev Center listing over 60 tips for efficient use of Flash Pro. Categories include:
Most of the tips are illustrated and quite easy to understand. This is one of the most comprehensive articles on this topic that I have seen.
You can let Dmitriy know what you think in the comments on the article page.
A ton of Flash users visit Adobe’s we site every month wondering about how to load an external SWF file from within another SWF. There are a lot of resources with answers to this question, and I recently realized our own TechNote on the subject was kind of old and crusty. A bunch of users who visited it were having some pretty obvious follow-up questions that weren’t answered by the TechNote as it was, such as:
- How do I load more than one SWF?
- How do I load a SWF into a specific location in the display list?
- How do I resize the loaded SWF?
- How do I set its X and Y location?
So I’ve attempted to answer these questions with an updated code sample and a set of sample files you can download from the TechNote.
I also added a bunch of links to quality resources that elaborate on loading content and on the display list:
Note also that if your app is running on iOS, you can load external assets, but no ActionScript code.
I’d love to know if you find the updated TechNote helpful and if you have suggestions for further improvement. Let me know in a comment here or on the TechNote page.
Flash Pro is a big tool, more like a hardware store. You can do a lot of things in it without ActionScript, but with AS, you can do infinitely more things. Just like with Flash Pro itself, there is an embarrassment of riches when it comes to the quantity of learning material out there for ActionScript 3.0. Learning ActionScript is itself a big task, and it requires learning some basic concepts of object-oriented programming, which isn’t necessarily hard, but for many people, it’s a whole new way of thinking that they haven’t had to do before.
Here are a few hand-picked resources for getting started with AS3 that hopefully will give new users confidence to try ActionScript and to know that they are looking at some of the best resources for learning it. These are all video tutorials.
- Code Snippets and AS3 enhancements – Code snippets were introduced in Flash Pro CS5 and provide pre-written code that you can apply as a way to get a lot of basic functionality implemented without learning really any code. They are also a great way to begin learning ActionScript 3.0 because they are very small in most cases and reading them will quickly begin to shed some light on the conventions that are used.
- ActionScript 3.0 101 – Flash Downunder – In this one, Paul Burnett gives a nice long intro lesson covering a lot of the basics. He’s a really good instructor with a good pace.
- Building an application – This is a quick lesson by Todd Perkins that gives a basic intro to some must-have concepts, including event listeners and stop() actions.
- ActionScript 101 with Doug Winnie – This is Doug’s show on Adobe TV. There are many, many episodes that go from the basic to more specific topics. Most of the episodes are 5-7 minutes long. A great free resource from a very good teacher with a manageable pace. Note that the episodes are listed in reverse chronological order (newest first) on the Adobe TV page.
One thing we see very often in the community are users wanting to know where to get started with the process of learning Flash Pro. We recently added a new learning guide to the Dev Center, which I’ll link to below. I’d also like to point out a few other quality tutorials that are great for new users.
The Flash Pro 5-Step Learning Guide provides a nice step by step approach to getting up to speed with Flash that not only tells you where to start, but also where to go second, third, fourth, etc. Following these suggestions should provide you with a nice route through the forest of Flash learning content out there.
Here are 2 good videos and a tutorial that are great places to start also:
On thing that I have seen a lot in user-observation studies is that many people don’t understand how search engines work and thus don’t know how to enter search terms that are the most likely to get them the results that they want. This problem is compounded by the fact that when users get a long list of unhelpful search results, they start getting the impression that the info they need is so buried in the mire of the internet that they will never find it.
This post at LifeHacker should be helpful to many people who would like to understand how to get better results from their searches.The post contains a 3-minute video tutorial.
Some of the main points:
- use fewer words (don’t use natural language)
- try to be as specific as possible
- use quotes to indicate an exact phrase you are looking for.
I hope some of you find it helpful.
Thanks to Sean Christmann at Craftymind.com for his extensive performance testing of Flash and HTML5 running in mobile and tablet browsers.
The Flash VM performs really well on mobile chipsets and I don’t see any evidence here to support the idea that Flash is slow on smartphones and tablets. High end videos are below par at the moment, but the 3.1 release of Honeycomb illustrates that firmware updates are the key to solving this issue.
His testing is quite thorough. Adobe paid for his time through his employer, EffectiveUI, having noticed his earlier benchmarking work. I feel confident that you will find his testing thorough and unbiased. Check it out at the link above.
If you haven’t seen it yet, Brian Rinaldi of Adobe has been posting a weekly list of high-quality, interesting posts from Flash platform community members at www.remotesynthesis.com. It’s a great way to keep up with the latest posts and stay focused on the good stuff. Thanks Brian. Keep ‘em coming.
Daniel Koestler has a great little post about a new ActionScript 3 extension that allows you to create apps in Flash that communicate directly with Photoshop. Thus you can create AIR apps with Flash Pro that can control the Photoshop application.
There are already a few examples of this in action. I’m sure Flash developers will come up with all kinds of interesting uses for this.
Flash Pro CS5.5 is available now.
The new features are described in the Help and in this video.
Video tutorials on the following new features are available here on Adobe TV.