Search code examples
actionscript-3adobeflashmxmlmxmlc

Actionscript include and use external AS package


I have this flex project.And the below mentioned is my directory structure (List1).Now if i want to use an external package which has the following directory structure as mentioned in List2 Where should i include it and how am i suppose to use it in the code

List1:Projectname : Dirtest

.settings
bin-debug
html-template
libs
src
.actionScriptProperties
.flexProperties
.project

List2: External project directory structure.

loyui/assests
loyui/bin
loyui/lib
loyui/src/fr/lab/test.as

Where to copy the above external project and how to use it in List1

    import mx.controls.Alert;
import flash.events.SampleDataEvent; 
import flash.media.Microphone;
import flash.net.FileReference;
import mx.controls.Alert;
import flash.net.FileReference; 
import flash.display.Sprite;
    //How to execute this statement successfully
    import fr.lab.test;

Solution

  • It depends on the qualified class name of test.as. As your question suggests, it is fr.lab.test. In this case, you need to add loyui/src to the Flex classpath. The classpath lists all the directiories that should be searched for classes, whenever the compiler finds an unknown class. How to set this classpath depends on the development environment you're in, just google the name of your IDE and classpath and you should get what you are looking for.

    Edit In case you want a more portable solution, you can pack loyui/src into an SWC library and easily reuse it in multiple projects.