Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Using Flex Builder 2 To Write AS3 Code For Flash CS3 Projects

Stefan Richter
Expert Author
Published: 2007-04-19

WebProNews RSS Feed


Here's my first tip for working with Flex 2 and Flash CS3. I'm not sure if you have had the opportunity yet to test drive Flash CS3 but if you have and you've also used Flex Builder on a regular basis then F;ash's ActionScript Editor will suddenly appear like a second class citizen to you.

Don't get me wrong, Flash is still entirely suited to write ActionScript and CS3 has some cool improvements in this area but I personally feel spoilt by Flex Builder and want to use it as an AS Editor for my Flash projects too.

I started working on a Flash (AS3) project last week which makes use of the new AS3 based FLVPlayback component.

My FLA makes use of Document class feature (which let's you assign a class to the root of your movie) and uses a bunch of other classes too.

The following may seem obvious to some of you who know Flash and Flex inside out but to me these issues posed some small hurdles I needed to take in order to stop Flex Builder from flagging up errors and problems in my As files which otherwise woudl compile fine in Flash. The reason being is that Flash uses some classes which Flex Builder does not 'know' about and they therefore need adding to the classpath in your Flex Builder project.

Problem 1: Flex Builder does not know about the FLVPlayback Component

Flex Builder did not know how to handle a reference to the FLVPlayback Component I had on stage. I knew I had to somehow add the necessary classes to my project and from looking at the Flash docs I knew that the component lives in fl.video.FLVPlayback and I managed to find the classes in C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 3.0\FLVPlayback.

However after adding them to Flex Builder's project source path I got this error:

1180: Call to a possibly undefined method Icon.
FLVPlayback.as FLVPlayback/fl/video line 4366
It referred to this code:
preview_mc.icon_mc = new Icon();<br>
preview_mc.icon_mc.name = "icon_mc";<br>
preview_mc.addChild(preview_mc.icon_mc);


This is the live preview for the component within Flash and Flex Builder couldn't deal with that.

Fortunately the solution was easy - after some poking around inside the Flash install directory I found the SWC file for FLVPlayback at C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Components\Video\FLVPlaybackAS3.swc

I added this to Flex Builder's Library path and that did the trick (I removed the previously added classpath again too).

I had to do the same for the new FLVPlaybackCaptioning component, a SWC for which can be found in the same location as the FLVPlaybackAS3.swc.

Problem 2: Flex Builder also does not know about some Flash class packages, such as Transitions and Easing

This one was easier to sort out. After Flex Builder complained about missing classes inside the fl.* package (I think the whole package is not on FB's classpath) I simply added C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0\Classes to my project class path in Flex Builder.

It now appears I can use Flex Builder to write AS3 code for my Flash projects without having to put up with Problems popping up in FB. Turns out it's just a matter of classpath issues but it surely is a little confusing to realize that Flex and Flash do not share the same classes by default, even though both produce AS3 based SWF files. It woudl be great to see more tutorials explaining how both programs can be used hand in hand. I also can't figure out if this Adobe technote addresses the issues I have witnessed or if it's covering something entirely different. Can somebody advise? Nico also blogged about this with a solution that offers a SWC download of all the CS3 classes.

Comments

View All Articles by Stefan Richter



Receive Our Daily Email of Breaking eBusiness News


About the Author:
Stefan is a certified Flash Developer who has been involved with Flash Media Server since its very early days. From his home office in the UK he has handled a variety of projects, specializing in Flash Video and Rich Internet Applications for clients that include CNET, USA Network and Unilever. Stefan is the author of a series of Adobe Developer Center articles, has spoken at several industry events and contributes a regular column on Flash Video to Streaming Media Magazine. His site www.flashcomguru.com is one of the largest online resources on Flash Video.

WebProNews RSS Feed

More Expert Articles Articles

Contact WebProNews
Advertisement





TOP NEWS

WebProBlog
The official blog of WebProNews.

Go to WebProBlog

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
WebProWorld
Ten most recent posts.


SearchBrains.com
NetworkingFiles
Featured Software


About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.


iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us SearchBrains.com SearchBrains RSS Feed