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:
2preview_mc.icon_mc.name = "icon_mc";<br>
3preview_mc.addChild(preview_mc.icon_mc);
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.

#1 by Geordie Martinez on 4/23/07 - 6:57 PM
I've been looking for information on how to do this and your page is the ONLY decent one yet.
#2 by Stefan on 4/23/07 - 7:19 PM
#3 by JY on 4/25/07 - 12:50 AM
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" xmlns:video="fl.video.*" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.flash.UIMovieClip;
import flash.events.Event;
import mx.controls.Alert;
import fl.livepreview.*;
import fl.video.*;
public function init() : void
{
pl.width = 320;
pl.height = 240;
pl.x = 0;
pl.y = 0;
pl.visible = true;
pl.source = "rtmp://click.dyndns.tv/CTSstreaming/movies/400x300_On2_Italy_France_match.flv";
pl.skin = "SkinOverAll.swf";
pl.autoPlay = false;
pl.playWhenEnoughDownloaded();
}
]]>
</mx:Script>
<video:FLVPlayback id="pl" />
</mx:Application>
#4 by Stefan on 4/25/07 - 9:58 AM
that's a different approach to mine - I was only writing As code in FB, not compiling a Flex app... Are you using the the Flex/Flash integration kit?
#5 by JY on 4/25/07 - 4:06 PM
I don't want to use the videoDisplay component in FB2 because from what I can tell, it doesn't support captioning out of the box.
#6 by Stefan on 4/25/07 - 4:21 PM
I'll try some more next week and blog my findings.
#7 by JY on 4/25/07 - 8:48 PM
#8 by Stefan on 4/25/07 - 8:55 PM
Email me: stefan AT flashcomguru DOT com and we can swap files, then I'll blog it.
#9 by Daganev on 5/10/07 - 6:01 PM
#10 by KGF on 7/13/07 - 11:53 PM
Severity and Description Path Resource Location Creation Time Id
unable to load SWC FLVPlaybackAS3.swc
Any other settings that need to happen as wel?
#11 by Stefan on 7/14/07 - 11:08 AM
place in the library? Do you mean you've linked the SWC in your project properties?
#12 by KGF on 7/14/07 - 1:32 PM
#13 by Stefan on 7/14/07 - 7:46 PM
#14 by Stefan on 7/14/07 - 7:47 PM
#15 by Mike on 7/17/07 - 6:15 PM
I've this error too, and I have version 2.01 !
So I don't understand why FLVPlaybackAS3.swc isn't loadable ?
#16 by Stefan on 7/17/07 - 9:12 PM
#17 by Sam Ahn on 7/18/07 - 3:28 AM
See this technote: http://www.adobe.com/go/kb401493
The problem is that Flex Builder (with the update) reads Flash-CS3-created SWC files differently than Flex-created SWC files.
Fun stuff.
#18 by Sam Ahn on 7/18/07 - 3:35 AM
I meant, "The problem is that Flex Builder (withOUT the update)..."
And I should have read the actual article. So the technote Stefan referenced (and I again) does the trick. You may have to close and reopen the project one more time if it doesn't work right away.
#19 by Stefan on 7/18/07 - 9:55 AM
#20 by KGF on 7/18/07 - 9:01 PM
#21 by Shawn on 10/16/07 - 3:51 PM
Any suggestions?
#22 by burun on 1/30/08 - 9:16 AM
#23 by Johan Nyberg on 3/7/08 - 12:52 PM
#24 by Balaji on 7/15/08 - 9:18 AM
I had created one component in Flex and that component is working in Flex 3.0 IDE,
Now I need to access the same component in Flash CS3, in Flash CS3 there is a tool for converting the Flash component to Flex , but let me know how to access the Flex component to Flash component,
1. Where to call the class file?
2. Whether I need set any properties for accessing the component?
Please let me know how to call the component in Flash CS3
Waiting for the reply
Regards
Balaji
#25 by Stefan Richter on 7/15/08 - 9:40 AM
#26 by Estetik on 11/24/08 - 7:00 PM
#27 by Estetik on 11/26/08 - 1:41 PM
#28 by assos on 5/18/09 - 9:24 PM
#29 by lazer epilasyon on 9/2/09 - 1:59 PM
#30 by estetik on 12/9/09 - 9:29 AM
#31 by çene tedavisi on 2/11/10 - 10:44 AM
#32 by sepetli platform on 2/11/10 - 9:58 PM
thanks...
#33 by estetik on 9/11/10 - 9:39 PM
#34 by kad?n on 11/18/10 - 11:23 PM
#35 by mikroenjeksiyon on 1/13/11 - 3:57 PM
For me is always been a challenge to test the website on different browsers with different platforms, but this list of links made it all easy….
NIce post
tr
#36 by Lazer Epilasyon on 1/17/11 - 10:57 AM
#37 by tupbebek on 6/2/11 - 3:44 PM
#38 by estetik on 7/12/11 - 7:59 AM