Using xmlns (XML Namespace) is mostly for the benefit of MXML. In your xmlns
you're pointing to "*", which is the default package.  So your Tracer.as
file is on the root of the SWC file.
Let's say you adding a longer package name within your SWC...
 "net.natebeck.utils.Tracer".  Which is essentially a directory structure.
 On the swc root, you have a net folder, with a natebeck folder below that,
followed by a utils folder, and then finally your Tracer.as file.

To accomplish the same thing within ActionScript, you simply just need to
point to the Class you want to import.

In your code example above:

<mx:Script>
<![CDATA[

import Tracer; // if Tracer.as is in your src root (your example)
import net.natebeck.utils.Tracer // if Tracer.as was user the
net/natebeck/utils directory structure that I described;

var myTracer:Tracer = new Tracer();

]]>
</mx:Script>

Cheers,
Nate

On Thu, Jan 8, 2009 at 10:14 AM, dnk <[email protected]> wrote:

>   Hi there i have written a very simple class in AS that has ben added
> to a personal library (SWC).
>
> Now in mxml I can reference the classes and components easily by
> putting a:
>
> xmlns:mycomps="*"
>
> Now what I would like to know is how would I reference a class that is
> in a SWC from action script?
>
> So i have class called "Tracer" in my swc.
>
> Now in my project (in some mxml file) I have:
>
> <mx:Script>
> <![CDATA[
>
> // how can I use Tracer class in here?
>
> ]]>
> </mx:Script>
>
> I tried something like:
>
> <mx:Script>
> <![CDATA[
>
> //no go - with the xmlns defined
> mycomps.Tracer;
>
> ]]>
> </mx:Script>
>
> I can't seem to see any sort of option for an import.....
>
> I am sure I am just missing something simple.
>
> d
>
>  
>



-- 

Cheers,
Nate
----------------------------------------
http://blog.natebeck.net

Reply via email to