ADOBE/ ActionScript

플래시 fl 컨트롤 컨포넌트

AlrepondTech 2011. 11. 29. 15:54
반응형

 

 

 

=================================

=================================

=================================

 

 

 

 

 

출처: http://epiccoding.wordpress.com/2011/07/16/to-import-fl-swz-to-flash-builder/

To import fl.swz to flash builder

reference : http://www.actionscript-flash-guru.com/blog/14-flcontrols-not-found-how-do-i-import-the-fl-package

fl.controls Not Found, How Do I Import The fl Package in ActionScript 3 (AS3)

Last Updated on Tuesday, 18 May 2010 11:47Written by Nicholas Dunbar

 

Flash components are fantastic as long as you don’t start customizing them. I never used them in AS2 because they would often access the root of my movie and add things that messed with my code. Now with ActionScript3 (AS3) Security settings, I can load components into a seperate SWF which keeps the loaded components influence out of my code. I find the documentation for these flash components to be rather poor. So far the best documentation that I have found resides here:

http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7fd4.html

Also people get confused between using these components in Flash Professional and in Flex Builder. If you are using Flash Pro then you should use the fl package, if you are using flex then you should be using the mx package. There are two ways to import packages from the fl package. For example to use compile time checking of the classes in the fl.controls package you would do the following:

go to the menu window

open the components panel

drag your component into the library

some examples of available components in the fl.controls package would be:

If you are coding inside of this FLAs timeline where you have dragged your components, you can just start coding and assume the classes like TIleList will be globally available from the library.

If you are downloading the generated SWF (component.swf) into a seperate SWF (uiControler.swf) which has classes that work with the components in the component.swf then you need to import the classes by adding their class path. Goto control shift F12 (command shift F12 on a mac) in your FLA (uiControler.FLA) or click menu file>publish settings and then under the flash tab click actionscript settings there you can add the class path for the fl package. It will be something like the following in CS3:

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

in CS4 you will need these paths:

C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\First Run\Classes
C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\ActionScript 3.0\projects\Flash\src\fl
C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\Component Source\ActionScript 3.0

There is also a dynamic way to aquire the classes from the component.swf if you dont want to include the class path in uiControler.swf. This is considered sloppy programming because you remove compile time checking however rules can be broken in some casses. For example what if you are programming a library that relies on these components, you don’t want to distribute a SWC and you don’t want to distribute the fl package. But you will distribute the UI assets in a SWF with the library. This way you avoid having the user drag things on stage or change the class path. They just import your libary and start using it.

Here is an example:

01.var loaderObject:LoaderInfo = _uiAssets.root.loaderInfo;
02.// Get the same domain with movie loaded
03.var domain:ApplicationDomain = loaderObject.applicationDomain;
04.//dynamic classes
05.var TileListClass:Class;
06.var ScrollBarDirectionClass:Class;
07.var ScrollPolicyClass:Class;
08.var DataProviderClass:Class;
09.
10.//get classes for - fl.controls.TileList
11.// Pull class from file .swf with the same domain
12.try {
13.TileListClass = domain.getDefinition ( "fl.controls.TileList" ) as Class;
14.ScrollBarDirectionClass = domain.getDefinition ( "fl.controls.ScrollBarDirection" ) as Class;
15.ScrollPolicyClass = domain.getDefinition ( "fl.controls.ScrollPolicy" ) as Class;
16.DataProviderClass = domain.getDefinition ( "fl.data.DataProvider" ) as Class;
17.var  titleList:Object = new TileListClass();
18.var dataProvider:Object = new DataProviderClass();
19.} catch (e:Error){
20.trace("Error: "+_UI_NAME+" class fl.controls not found  "+e.message);
21.}

 

=================================

=================================

=================================

 

 

 

반응형