Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-06-2007, 06:17 PM   #1
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Default [AS3] importing fl.controls package

I'm trying to use some of the CS3 Flash components in a pure ActionScript 3 project. However, I can't seem to figure out how to import those "fl.controls" packages.

I'm using Flex Builder 2, but again, not actually any Flex, just ActionScript. I tried adding the following folder as an SWC folder in the project's library path:

C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Components\User Interface

That seems like the correct thing to do, however Flex Builder 2 reports these errors:

Code:
An internal build error has occurred.  Please check the Error Log.
unable to load SWC Accordion.swc
Any ideas?
ryryguy is offline   Reply With Quote
Old 08-06-2007, 06:47 PM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

the fl components are FLA-based. You will need to publish them through a FLA. I am not of aware of anyway to do it otherwise.
__________________
(6)
senocular is offline   Reply With Quote
Old 08-06-2007, 06:56 PM   #3
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Default

Ah boo...

Hmmm, it does look like I can grab an instance of one of these controls out of an externally loaded SWF file, and then presumably I could call its methods and so forth. However that seems like it would be a pretty big pain, difficult to control things like data sources programatically.

What is the best solution if I want to have an artist making UIs in the Flash tool but using them from pure ActionScript? Are there alternate sets of components that I could import into my ActionScript, or would I have to write them myself?

I know there is a set of Flex components that can be loaded into the Flash tool and used there. How much Flex would I have to do on the code side to get it to work?
ryryguy is offline   Reply With Quote
Old 08-06-2007, 07:34 PM   #4
Sleeve
Corrupted Whitespace
 
Join Date: May 2006
Location: Seattle, WA
Posts: 489
Default

The fl.controls package is in a pre-compiled clip called "ComponentShim". Drag a component on stage and look in the Component Assets >> _private folder in your library. If you want to use fl.controls, just keep ComponentShim in your library with the appropriate linkage.

Since it's precompiled, you take on every other Class that is in ComponentShim which increases file size.

**EDIT**
Found this :http://www.flashbrighton.org/wordpress/?p=31
__________________
Some people smoke, some drink...I code Actionscript

Last edited by Sleeve; 08-06-2007 at 07:45 PM.
Sleeve is offline   Reply With Quote
Old 08-06-2007, 08:23 PM   #5
dr_zeus
Feathers
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999
Default

As senocular mentioned, the AS3 components in Flash CS3 are built with FLA files (not SWCs). However, if you want to use the component source code in your Flex Builder projects, it's available here (Windows, similar on a Mac):

C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 3.0\User Interface

You should remember that the skin assets are still needed from the FLA files, but if you want to build custom subclasses of fl.core.UIComponent and/or do all your skinning programmatically, these files work just fine in AS-only projects with the Flex SDK. With a little bit of work, it might be possible to port the programmatic skins from the Flex components to work with the CS3 components. Obviously, you probably can't just drop them in, but it might be an interesting project to explore.
__________________
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote
Old 08-06-2007, 08:40 PM   #6
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Default

Thank you Sleeve and dr_zeus.

To clarify what I am trying to do, I'd be happy to let the artist do all the skinning work in the Flash tool. I just want to be able to drive it programmatically. I think I understand how to grab particular instances of components from an externally loaded SWF file, and adding event handlers to them goes a pretty long way. Also, it appears I can call their methods just fine (though since I have to use untyped variables to reference them, the compiler can't catch errors, which is annoying ).

However, it seems that there are still other things in other "fl." packages I might want to muddle with. For example, I know I'll want to be able to control a DataProvider attached to a List programmatically. Through some experimentation I've found that I can do the same sort of method calling through an untyped reference on myList.dataProvider. However, since the DataProvider is defined in an "fl." package, it must be instanced and added to "myList" through action script added in the FLA. That's not an unacceptable solution, it just seems a bit clunky, and puts a burden on the artist (or somebody) to add a bit of code in the flash tool every time he creates a List.

Any recommendations on how to do this a little better? I guess I have a few ideas... I could create my own subclasses of List, etc. that automatically instance a DataProvider, or perhaps grab it from some interface I'm providing in my main program, and the artist could create his list from that. I guess I could make a dedicated "DataProvider" FLA/SWF that contained mostly just code, with a class or classes to do whatever DataProvider instancing and management I need, and load that into my main program.

I'm also not entirely clear about this ComponentShim SWC. When you say I should keep it in my library, are you talking about the library in the FLA file or in the library path of my ActionScript project? And does this only contain compiled code for the classes in the relevant components packages, or would there be some way to put other stuff in there, e.g. DataProviders so I could instance and manage them in my program independent of a particular FLA file?
ryryguy is offline   Reply With Quote
Old 08-06-2007, 09:13 PM   #7
Sleeve
Corrupted Whitespace
 
Join Date: May 2006
Location: Seattle, WA
Posts: 489
Default

If you were to keep ComponentShim in your library with the linkage set to 'Export for ActionScript' and 'Export in First Frame', you can successfully import the fl.controls package and a number of others. From there, you can instantiate any of the Classes using AS alone. Like mentioned earlier, if the skins do not exists in the library and you try to instatiate a DataGrid, you'll have nothing to display on stage.

For the purpose of instantiating a DataProvider, which has no skins, the above mentioned technique will work.
__________________
Some people smoke, some drink...I code Actionscript
Sleeve is offline   Reply With Quote
Old 08-06-2007, 09:34 PM   #8
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Default

Quote:
If you were to keep ComponentShim in your library with the linkage set to 'Export for ActionScript' and 'Export in First Frame', you can successfully import the fl.controls package and a number of others.
I'm still confused... are you talking about importing those packages in ActionScript that is written as part of a flash project including an FLA file? I'd like to be able to import it in an external AS file that is not linked to an FLA document. That's not possible, is it?

(Although... being able to do it in an AS file linked to a FLA may still be quite helpful for me.)
ryryguy is offline   Reply With Quote
Old 08-06-2007, 10:07 PM   #9
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Unhappy Ack!

edit: lots of strange behavior when trying to use the Component Source files, enough worth me starting a new post.

Last edited by ryryguy; 08-07-2007 at 12:40 AM. Reason: moved to a new post.
ryryguy is offline   Reply With Quote
Old 08-10-2007, 07:49 PM   #10
Roustalski
Registered User
 
Join Date: Aug 2007
Posts: 11
Default

I found the following post to be very informative and should help:

http://www.actionscript.org/forums/s....php3?t=112812
Roustalski is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
acces of undefined property error when i try to use my package vlad2005 Flex 2, 3 & 4 4 05-18-2007 06:27 PM
Interface in a package drpeck ActionScript 2.0 4 04-10-2007 03:21 PM
Problem loading classes within a package. jjbilly ActionScript 2.0 3 10-17-2006 04:14 PM
a tip in importing classes and Flash secrets redruby ActionScript 2.0 3 03-14-2005 06:09 PM
mx.transitions package documentation? Stimpson Components 3 01-05-2004 07:39 AM


All times are GMT. The time now is 07:37 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.