Importing user defined classes into other .as files.

sandeep akula sandeep.akula at gmail.com
Wed Jan 16 19:46:01 PST 2008


I followed your steps Mark and its working fine now.

Thank you very much.

Sandeep

On Jan 15, 2008 7:00 AM, Mark Hammond <mhammond at skippinet.com.au > wrote:

> > I am trying to import one class into another class. For example I have
>
> > package avmclass
> > {
> > public class A
> > {
> > public function func()
> > {
> > trace ("A::func123");
> > }
> > }
> > }
>
> You need to tell the compiler where 'trace' is located.  Inserting:
>
>    import avmplus.System.*
>
> just before the class definition should do the job.  You then need to
> compile this to a .abc file.  I used the command:
>
> % java -ea -DAS3 -Xmx200m -DAVMPLUS -classpath ../utils/asc.jar
> macromedia.asc.embedding.ScriptCompiler -abcfuture -builtin -import
> ../core/builtin.abc -import ../shell/toplevel.abc A.as
>
> Note that 2 imports seem necessary - the core builtins (for Object) and
> the
> shell's toplevel, for avmplus.System.trace.  If you use the 'esc' compiler
> this doesn't seem necessary.
>
> > I have named this file as " A.as" and kept it in "avmclass" under root
> folder.
>
> > Then I have created new file " caller.as" in root folder.
> > The contents of caller.as is
>
> > package
> > {
> > import avmclass.A;
> > var b1 = new avmplus.A();
>
> Note the typo in the above line - you want to create avmclass.A -
> avmplus.A
> doesn't exist.
>
> > b1.func();
> > }
>
> I can then compile this file with:
>
> % java -ea -DAS3 -Xmx200m -DAVMPLUS -classpath utils/asc.jar
> macromedia.asc.embedding.ScriptCompiler -abcfuture -builtin -import
> core/builtin.abc -import ./avmclass/A.abc caller.as
>
> Note that this time I did not need to reference the shell's .abc, as we
> didn't use anything from it - but I did need to reference the .abc we
> compiled above.
>
> Once you have the 2 .abc files, you can execute 'avmplus_sd.exe
> avmclass/A.abc caller.abc', and you see the trace on your console.
>
> Hope this helps,
>
> Mark
>
>
>


-- 
Thanks & Regards

A.Sandeep,
Member Technical Staff,
Adobe Software India Pvt. Ltd,
Bangalore,
Ph:   91.80.41939832
Mobile:  9886750426
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/tamarin-devel/attachments/20080117/04e4e86a/attachment.html 


More information about the Tamarin-devel mailing list